Skip to content

Commit 6f8e160

Browse files
committed
chore: cleanup portal testing notes
1 parent c8fa9f9 commit 6f8e160

File tree

4 files changed

+78
-13
lines changed

4 files changed

+78
-13
lines changed

apps/demo/src/app.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ import { Application } from '@nativescript/core';
1212
// LoginManager.init();
1313

1414
// uncomment to test Ionic Portals
15-
// import { IonicPortalManager } from '@nativescript/ionic-portals';
15+
import { IonicPortalManager } from '@nativescript/ionic-portals';
16+
// IonicPortalManager.configureLiveUpdates('ionicWebPortalSample', {
17+
// appId: 'e29e2c2e',
18+
// channel: 'production',
19+
// syncOnAdd: true
20+
// })
1621

17-
// Application.on(Application.launchEvent, () => {
18-
// // Register IonicPortals
19-
// IonicPortalManager.register('<portal-api-key>');
20-
// });
22+
Application.on(Application.launchEvent, () => {
23+
// Register IonicPortals
24+
IonicPortalManager.register('<portal-api-key>');
25+
});
2126

2227
Application.run({ moduleName: 'app-root' });
Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,67 @@
1-
import { Observable, EventData, Page } from '@nativescript/core';
1+
import { Observable, EventData, Page, GridLayout, CoreTypes, Screen, Dialogs } from '@nativescript/core';
22
import { DemoSharedIonicPortals } from '@demo/shared';
3-
import { } from '@nativescript/ionic-portals';
3+
import {} from '@nativescript/ionic-portals';
4+
// import { LoadingIndicator } from '@nstudio/nativescript-loading-indicator';
45

56
export function navigatingTo(args: EventData) {
67
const page = <Page>args.object;
78
page.bindingContext = new DemoModel(page);
89
}
910

1011
export class DemoModel extends DemoSharedIonicPortals {
11-
12+
// Note: can uncomment following to test more with live updates
13+
// top: GridLayout;
14+
// progress = new LoadingIndicator();
15+
// tryThis() {
16+
// if (this.top) {
17+
// // this.top.animate({
18+
// // opacity: 0,
19+
// // duration: 2000,
20+
// // curve: CoreTypes.AnimationCurve.easeInOut
21+
// // });
22+
// if (this.portal) {
23+
// this.top.ios.alpha = 1;
24+
// this.page.actionBarHidden = true;
25+
// UIView.animateWithDurationAnimationsCompletion(2, () => {
26+
// // this.portal.marginTop = 0;
27+
// this.top.ios.alpha = 0;
28+
// // this.portal.marginTop = 150;
29+
// this.portal.ios.frame = CGRectMake(0, 0,Screen.mainScreen.widthDIPs, Screen.mainScreen.heightDIPs)
30+
// }, ()=> {
31+
// })
32+
// }
33+
// }
34+
// }
35+
// syncNow() {
36+
// this.progress.show({
37+
// message: 'Syncing Portal to Ionic AppFlow...'
38+
// })
39+
// return new Promise<void>(() => {
40+
// super.syncNow().then(() => {
41+
// setTimeout(() => {
42+
// this.progress.hide();
43+
// Dialogs.confirm({
44+
// title: 'Portal Synced!',
45+
// message: 'Would you like to reload it now?',
46+
// okButtonText: `Yes!`
47+
// }).then(ok => {
48+
// this.reload();
49+
// setTimeout(() => {
50+
// this.tryThis();
51+
// }, 500);
52+
// })
53+
// }, 3000)
54+
// })
55+
// })
56+
// }
57+
// loadedTop(args) {
58+
// this.top = args.object;
59+
// }
60+
// loadedPortal(args: any): void {
61+
// // args.object.ios.frame = CGRectMake(0, 300,Screen.mainScreen.widthDIPs, Screen.mainScreen.heightDIPs-300)
62+
// super.loadedPortal(args);
63+
// setTimeout(() => {
64+
// args.object.ios.frame = CGRectMake(0, 190,Screen.mainScreen.widthDIPs, Screen.mainScreen.heightDIPs-190)
65+
// })
66+
// }
1267
}

apps/demo/src/plugin-demos/ionic-portals.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
</ActionBar>
66
</Page.actionBar>
77
<GridLayout rows="auto,*">
8-
<StackLayout row="0" class="p-t-20 p-l-20 p-r-20">
8+
<StackLayout row="0" class="p-t-20 p-l-20 p-r-20"><!--loaded="{{loadedTop}}"-->
99
<Label text="Ionic Portal inside NativeScript" class="text-center font-weight-bold m-b-5" fontSize="22"></Label>
1010
<Label text="Mix native and webviews for unlimited creativity" fontSize="15" class="font-italic m-b-10 text-center" color="green"></Label>
1111
<Button text="Bounce with Joy 🎉" tap="{{ testIt }}" margin="0" padding="0" color="blue" height="24"/>
12-
<Button text="Sync Now" tap="{{ syncNow }}" margin="0" padding="0" color="blue" height="24"/>
13-
<Button text="Reload" tap="{{ reload }}" margin="0" padding="0" color="blue" height="24"/>
12+
<!-- <Button text="Sync Now and Display Update" tap="{{ syncNow }}" margin="0" padding="0" color="blue" height="24"/> -->
13+
<!-- <Button text="Reload" tap="{{ reload }}" margin="0" padding="0" color="blue" height="24"/> -->
14+
15+
<!-- <Button text="Try It" tap="{{ tryThis }}" margin="0" padding="0" color="blue" height="24"/> -->
1416
</StackLayout>
1517

1618
<!-- backgroundColor is used to ensure the Portal sizes itself on orientation change - when working properly the yellow should never show when changing size -->

tools/demo/ionic-portals/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ export class DemoSharedIonicPortals extends DemoSharedBase {
1212
}
1313

1414
syncNow() {
15-
IonicPortalManager.syncNow(['e29e2c2e'], false, (status) => {
16-
console.log('sync complete:', status);
15+
return new Promise<void>((resolve) => {
16+
IonicPortalManager.syncNow(['e29e2c2e'], false, (status) => {
17+
console.log('sync complete:', status);
18+
resolve();
19+
});
1720
});
1821
}
1922

0 commit comments

Comments
 (0)