Skip to content

Instantly share code, notes, and snippets.

View captaincole's full-sized avatar

Andrew Cole captaincole

View GitHub Profile
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<style>
.onoffswitch {
position: relative; width: 120px;
// sample app.component.js
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { TabsPage } from '../pages/tabs/tabs';
// Branch import
declare var Branch;
@Component({
// app.module.ts
import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2';
// ...
providers: [ InAppPurchase2 ]
configurePurchasing() {
if (!this.platform.is('cordova')) { return; }
console.log('Starting Configurations');
let productId;
try {
if (this.platform.is('ios')) {
productId = this.program.appleProductId;
} else if (this.platform.is('android')) {
productId = this.program.googleProductId;
}
// Fired when a purchase has been approved by the store
this.store.when(productId).approved()
// Fired when a purchase is registered with the store
this.store.when(productId).registered()
// Fired if a purchase is updated
this.store.when(productId).updated()
// If the user cancels a purchase
<!-- Previous Video That A User Might Go Back To -->
<video [hidden]="!isCurrent" [autoplay]="isCurrent" muted="true" playsinline looped preload="auto"></video>
<!-- Current Video That Should Autoplay -->
<video [hidden]="!isCurrent" [autoplay]="isCurrent" muted="true" playsinline looped preload="auto"></video>
<!-- Next Video, Preloaded for content -->
<video [hidden]="!isCurrent" [autoplay]="isCurrent" muted="true" playsinline looped preload="auto"></video>
// workout-completion.page.ts
animations: [
trigger('shift', [
state('previous', style({
opacity: 0,
transform: 'translateX(-100%)',
'-webkit-transform' :'-webkit-translateX(-100%)'
})),
state('current', style({
// workout-completion.page.ts
public vidState1 = 'previous';
public vidState2 = 'current';
public vidState3 = 'next';
@ViewChild('video1') video1;
@ViewChild('video2') video2;
@ViewChild('video3') video3;
// Setup Video Buffer Array, which will contain the urls that we wish to load into each video element
public videoBuffer: Array<any> = [this.emptyVideo, this.emptyVideo, this.emptyVideo];
public emptyVideo = {