@@ -10,45 +10,24 @@ npm install @nativescript/ionic-portals
10
10
11
11
## Usage
12
12
13
- 1 . Register and create portals on app boot:
13
+ 1 . Register and create portals on app boot - [ Get a Portal API Key here ] ( https://ionic.io/docs/portals/getting-started/guide ) :
14
14
15
15
``` ts
16
16
import { Application } from ' @nativescript/core' ;
17
17
import { IonicPortalManager } from ' @nativescript/ionic-portals' ;
18
18
19
- const portalApiKey = ' <portal-api-key>' ;
20
-
21
- const setupIonicPortals = () => {
19
+ Application .on (Application .launchEvent , () => {
22
20
// Register IonicPortals
23
- IonicPortalManager .register (portalApiKey );
21
+ IonicPortalManager .register (' <portal-api-key> ' );
24
22
25
23
// Create as many Portals as you need to use in your app
26
24
// By default, the app will look for folders equal to the portal id you use here
27
25
// For iOS: App_Resources/iOS/webPortal
28
26
// For Android: App_Resources/Android/src/main/asssets/webPortal
29
27
IonicPortalManager .create (' webPortal' );
30
- };
31
-
32
- if (global .isIOS ) {
33
- @NativeClass ()
34
- class CustomAppDelegate extends NSObject implements UIApplicationDelegate {
35
- static ObjCProtocols = [UIApplicationDelegate ];
36
-
37
- applicationDidFinishLaunchingWithOptions(application : UIApplication , launchOptions : NSDictionary <string , any >) {
38
-
39
- setupIonicPortals ();
40
-
41
- return true ;
42
- }
43
- }
44
- Application .ios .delegate = CustomAppDelegate ;
45
- } else {
46
- Application .on (Application .launchEvent , () => {
47
- setupIonicPortals ();
48
- });
49
- }
50
-
51
- // boot app here, e.g.
28
+ });
29
+
30
+ // boot app here, for example:
52
31
Application .run ({ moduleName: ' app-root' });
53
32
```
54
33
0 commit comments