@ionic/portals-react-native 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -159
- package/ReactNativePortals.podspec +2 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/ionic/portals/reactnative/PortalView.kt +132 -0
- package/android/src/main/java/io/ionic/portals/reactnative/ReactNativeLiveUpdatesModule.kt +10 -28
- package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalManager.kt +149 -0
- package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsModule.kt +73 -232
- package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsPackage.kt +0 -1
- package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsPubSub.kt +45 -0
- package/ios/LiveUpdate+Dict.swift +30 -0
- package/ios/LiveUpdateManager+Async.swift +69 -0
- package/ios/LiveUpdateManagerError+Dict.swift +19 -0
- package/ios/Podfile +2 -1
- package/ios/Podfile.lock +8 -7
- package/ios/Portal+Dict.swift +35 -0
- package/ios/PortalManager.m +10 -4
- package/ios/PortalView.m +1 -1
- package/ios/PortalView.swift +67 -0
- package/ios/PortalsConfig.swift +92 -0
- package/ios/PortalsPubSub.m +3 -3
- package/ios/PortalsPubSub.swift +47 -0
- package/ios/PortalsReactNative.swift +104 -0
- package/ios/ReactNativePortals.xcodeproj/project.pbxproj +32 -8
- package/lib/commonjs/PortalView.android.js +2 -10
- package/lib/commonjs/PortalView.android.js.map +1 -1
- package/lib/commonjs/PortalView.js +0 -6
- package/lib/commonjs/PortalView.js.map +1 -1
- package/lib/commonjs/index.js +54 -38
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/PortalView.android.js +2 -5
- package/lib/module/PortalView.android.js.map +1 -1
- package/lib/module/PortalView.js +0 -2
- package/lib/module/PortalView.js.map +1 -1
- package/lib/module/index.js +52 -19
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +27 -2
- package/package.json +3 -1
- package/src/index.ts +47 -12
- package/ios/LiveUpdatesManager.m +0 -16
- package/ios/ReactNativePortals.swift +0 -262
package/lib/commonjs/index.js
CHANGED
|
@@ -9,21 +9,17 @@ Object.defineProperty(exports, "PortalView", {
|
|
|
9
9
|
return _PortalView.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
exports.unsubscribe = exports.syncSome = exports.syncOne = exports.syncAll = exports.subscribe = exports.register = exports.publish = exports.addPortal = void 0;
|
|
13
|
-
|
|
12
|
+
exports.unsubscribe = exports.syncSome = exports.syncOne = exports.syncAll = exports.subscribe = exports.register = exports.publish = exports.getPortal = exports.enableSecureLiveUpdates = exports.addPortals = exports.addPortal = void 0;
|
|
14
13
|
var _reactNative = require("react-native");
|
|
15
|
-
|
|
16
14
|
var _PortalView = _interopRequireDefault(require("./PortalView"));
|
|
17
|
-
|
|
18
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
16
|
const {
|
|
21
17
|
IONPortalPubSub,
|
|
22
|
-
|
|
23
|
-
IONLiveUpdatesManager
|
|
18
|
+
IONPortalsReactNative
|
|
24
19
|
} = _reactNative.NativeModules;
|
|
25
20
|
const PortalsPubSub = new _reactNative.NativeEventEmitter(IONPortalPubSub);
|
|
26
21
|
const subscriptionMap = new Map();
|
|
22
|
+
|
|
27
23
|
/**
|
|
28
24
|
* Subscribes to messages for a topic
|
|
29
25
|
*
|
|
@@ -31,7 +27,6 @@ const subscriptionMap = new Map();
|
|
|
31
27
|
* @param onMessageReceived The callback to invoke when a message is received
|
|
32
28
|
* @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
|
|
33
29
|
*/
|
|
34
|
-
|
|
35
30
|
const subscribe = async (topic, onMessageReceived) => {
|
|
36
31
|
const subscriptionRef = await IONPortalPubSub.subscribe(topic);
|
|
37
32
|
const subscriber = PortalsPubSub.addListener('PortalsSubscription', message => {
|
|
@@ -42,69 +37,94 @@ const subscribe = async (topic, onMessageReceived) => {
|
|
|
42
37
|
subscriptionMap.set(subscriptionRef, subscriber);
|
|
43
38
|
return subscriptionRef;
|
|
44
39
|
};
|
|
40
|
+
|
|
45
41
|
/**
|
|
46
42
|
* Unsubscribes from events for the provided topic and subscription reference
|
|
47
43
|
*
|
|
48
44
|
* @param topic The topic to unsubscribe from
|
|
49
45
|
* @param subRef The unique subscription reference received when initially calling {@link subscribe}
|
|
50
46
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
47
|
exports.subscribe = subscribe;
|
|
54
|
-
|
|
55
48
|
const unsubscribe = (topic, subRef) => {
|
|
56
49
|
IONPortalPubSub.unsubscribe(topic, subRef);
|
|
57
50
|
const subscription = subscriptionMap.get(subRef);
|
|
58
|
-
|
|
59
51
|
if (subscription !== undefined) {
|
|
60
52
|
subscription.remove();
|
|
61
53
|
subscriptionMap.delete(subRef);
|
|
62
54
|
}
|
|
63
55
|
};
|
|
56
|
+
|
|
64
57
|
/**
|
|
65
58
|
* Publishes a message to the provided topic
|
|
66
59
|
*
|
|
67
60
|
* @param topic The topic to publish the message to
|
|
68
61
|
* @param data The data to publish to subscribers
|
|
69
62
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
63
|
exports.unsubscribe = unsubscribe;
|
|
73
|
-
|
|
74
64
|
const publish = (topic, data) => {
|
|
75
65
|
const msg = {
|
|
76
66
|
message: data
|
|
77
67
|
};
|
|
78
68
|
IONPortalPubSub.publish(topic, msg);
|
|
79
69
|
};
|
|
70
|
+
|
|
80
71
|
/**
|
|
81
72
|
* Validates that a valid registration key has been procured from http://ionic.io/register-portals
|
|
82
73
|
* @param key The registration key
|
|
74
|
+
* @returns Promise<void>
|
|
83
75
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
76
|
exports.publish = publish;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
IONPortalManager.register(key);
|
|
77
|
+
const register = async key => {
|
|
78
|
+
return IONPortalsReactNative.register(key);
|
|
90
79
|
};
|
|
80
|
+
|
|
91
81
|
/**
|
|
92
82
|
* The configuration of a web application to be embedded in a React Native application.
|
|
93
83
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
84
|
exports.register = register;
|
|
97
|
-
|
|
98
85
|
/**
|
|
99
86
|
* Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.
|
|
100
87
|
*
|
|
101
88
|
* @param portal The portal to add to the internal registry.
|
|
89
|
+
* @returns Promise containing the Portal that was added to the registry.
|
|
102
90
|
*/
|
|
103
|
-
const addPortal = portal => {
|
|
104
|
-
|
|
91
|
+
const addPortal = async portal => {
|
|
92
|
+
return IONPortalsReactNative.addPortal(portal);
|
|
105
93
|
};
|
|
106
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}
|
|
97
|
+
*
|
|
98
|
+
* @param portals The portals to add to the internal registry.
|
|
99
|
+
* @returns Promise containing the Portals that were added to the registry.
|
|
100
|
+
*/
|
|
107
101
|
exports.addPortal = addPortal;
|
|
102
|
+
const addPortals = async portals => {
|
|
103
|
+
return IONPortalsReactNative.addPortals(portals);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.
|
|
108
|
+
*
|
|
109
|
+
* @param name The portal name to retrieve from the internal registry.
|
|
110
|
+
* @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.
|
|
111
|
+
*/
|
|
112
|
+
exports.addPortals = addPortals;
|
|
113
|
+
const getPortal = async name => {
|
|
114
|
+
return IONPortalsReactNative.getPortal(name);
|
|
115
|
+
};
|
|
116
|
+
exports.getPortal = getPortal;
|
|
117
|
+
/**
|
|
118
|
+
* Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
|
|
119
|
+
* This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
|
|
120
|
+
*
|
|
121
|
+
* @param pathToKey The *relative* path to the public key for verification.
|
|
122
|
+
* This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
|
|
123
|
+
* @returns Promise<void>
|
|
124
|
+
*/
|
|
125
|
+
const enableSecureLiveUpdates = async pathToKey => {
|
|
126
|
+
return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);
|
|
127
|
+
};
|
|
108
128
|
|
|
109
129
|
/**
|
|
110
130
|
* Syncs a single live update.
|
|
@@ -112,33 +132,29 @@ exports.addPortal = addPortal;
|
|
|
112
132
|
* @param appId The AppFlow application ID to sync.
|
|
113
133
|
* @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
|
|
114
134
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
135
|
+
exports.enableSecureLiveUpdates = enableSecureLiveUpdates;
|
|
136
|
+
const syncOne = async appId => {
|
|
137
|
+
return IONPortalsReactNative.syncOne(appId);
|
|
117
138
|
};
|
|
139
|
+
|
|
118
140
|
/**
|
|
119
141
|
* Syncs many live updates.
|
|
120
142
|
*
|
|
121
143
|
* @param appIds The AppFlow application IDs to sync.
|
|
122
144
|
* @returns Promise<SyncResults>
|
|
123
145
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
146
|
exports.syncOne = syncOne;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return IONLiveUpdatesManager.syncSome(appIds);
|
|
147
|
+
const syncSome = async appIds => {
|
|
148
|
+
return IONPortalsReactNative.syncSome(appIds);
|
|
130
149
|
};
|
|
150
|
+
|
|
131
151
|
/**
|
|
132
152
|
* Syncs all registered LiveUpdates
|
|
133
153
|
* @returns Promise<SyncResults>
|
|
134
154
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
155
|
exports.syncSome = syncSome;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return IONLiveUpdatesManager.syncAll();
|
|
156
|
+
const syncAll = async () => {
|
|
157
|
+
return IONPortalsReactNative.syncAll();
|
|
141
158
|
};
|
|
142
|
-
|
|
143
159
|
exports.syncAll = syncAll;
|
|
144
160
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["IONPortalPubSub","
|
|
1
|
+
{"version":3,"names":["IONPortalPubSub","IONPortalsReactNative","NativeModules","PortalsPubSub","NativeEventEmitter","subscriptionMap","Map","subscribe","topic","onMessageReceived","subscriptionRef","subscriber","addListener","message","set","unsubscribe","subRef","subscription","get","undefined","remove","delete","publish","data","msg","register","key","addPortal","portal","addPortals","portals","getPortal","name","enableSecureLiveUpdates","pathToKey","syncOne","appId","syncSome","appIds","syncAll"],"sources":["index.ts"],"sourcesContent":["import {\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n ViewProps,\n} from 'react-native';\n\nconst { IONPortalPubSub, IONPortalsReactNative } = NativeModules;\n\nexport { default as PortalView } from './PortalView';\n\n/**\n * The data that is received from a subscription event.\n */\nexport interface Message {\n /** The unique subscription reference received from {@link subscribe}*/\n subscriptionRef: number;\n data: any;\n /** The topic the message was sent from */\n topic: string;\n}\n\nconst PortalsPubSub = new NativeEventEmitter(IONPortalPubSub);\n\nconst subscriptionMap = new Map<number, EmitterSubscription>();\n\n/**\n * Subscribes to messages for a topic\n *\n * @param topic The topic to subscribe to\n * @param onMessageReceived The callback to invoke when a message is received\n * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.\n */\nexport const subscribe = async (\n topic: string,\n onMessageReceived: (message: Message) => void\n): Promise<number> => {\n const subscriptionRef = await IONPortalPubSub.subscribe(topic);\n\n const subscriber = PortalsPubSub.addListener(\n 'PortalsSubscription',\n (message: Message) => {\n if (message.subscriptionRef === subscriptionRef) {\n onMessageReceived(message);\n }\n }\n );\n\n subscriptionMap.set(subscriptionRef, subscriber);\n\n return subscriptionRef;\n};\n\n/**\n * Unsubscribes from events for the provided topic and subscription reference\n *\n * @param topic The topic to unsubscribe from\n * @param subRef The unique subscription reference received when initially calling {@link subscribe}\n */\nexport const unsubscribe = (topic: string, subRef: number) => {\n IONPortalPubSub.unsubscribe(topic, subRef);\n\n const subscription = subscriptionMap.get(subRef);\n if (subscription !== undefined) {\n subscription.remove();\n subscriptionMap.delete(subRef);\n }\n};\n\n/**\n * Publishes a message to the provided topic\n *\n * @param topic The topic to publish the message to\n * @param data The data to publish to subscribers\n */\nexport const publish = (topic: string, data: any) => {\n const msg = { message: data };\n IONPortalPubSub.publish(topic, msg);\n};\n\n/**\n * Validates that a valid registration key has been procured from http://ionic.io/register-portals\n * @param key The registration key\n * @returns Promise<void>\n */\nexport const register = async (key: string): Promise<void> => {\n return IONPortalsReactNative.register(key);\n};\n\n/**\n * The configuration of a web application to be embedded in a React Native application.\n */\nexport interface Portal {\n /** The name of the Portal to be referenced. Must be **unique** */\n name: string;\n /** The classpath of all Capacitor plugins used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */\n androidPlugins?: string[];\n /**\n * The root directory of the web application relative to Bundle.main on iOS\n * and src/main/assets on Android. If omitted, `name` is used.\n */\n startDir?: string;\n /** The name of the initial file to load. If omitted, 'index.html' is used. */\n index?: string;\n /** Any data needed at initial render when a portal is loaded. */\n initialContext?: {\n [key: string]: any;\n };\n liveUpdate?: LiveUpdateConfig;\n}\n\n/**\n * A subset of {@link Portal} properties needed for rendering a Portal. `initialContext` can be used to override\n * any initialContext defined in the original {@link Portal} definition.\n */\nexport type PortalProp = {\n portal: Pick<Portal, 'name' | 'initialContext'>;\n};\n\n/**\n * Props needed for rendering a {@link Portal}\n */\nexport type PortalProps = PortalProp & ViewProps;\n\n/**\n * Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.\n *\n * @param portal The portal to add to the internal registry.\n * @returns Promise containing the Portal that was added to the registry.\n */\nexport const addPortal = async (portal: Portal): Promise<Portal> => {\n return IONPortalsReactNative.addPortal(portal);\n};\n\n/**\n * Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}\n *\n * @param portals The portals to add to the internal registry.\n * @returns Promise containing the Portals that were added to the registry.\n */\nexport const addPortals = async (portals: Portal[]): Promise<Portal[]> => {\n return IONPortalsReactNative.addPortals(portals);\n};\n\n/**\n * Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.\n *\n * @param name The portal name to retrieve from the internal registry.\n * @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.\n */\nexport const getPortal = async (name: string): Promise<Portal> => {\n return IONPortalsReactNative.getPortal(name);\n};\n\nexport interface LiveUpdate {\n /** The AppFlow application ID */\n appId: string;\n /** The AppFlow distribution channel */\n channel: string;\n}\n\n/** Data needed to register a live update to be managed */\nexport type LiveUpdateConfig = LiveUpdate & { syncOnAdd: boolean };\n\nexport interface LiveUpdateError {\n /** The AppFlow application ID relating to the failure */\n appId: string;\n /** The step in the sync process the LiveUpdate failed on. (e.g. CHECK, UNPACK)*/\n failStep: string;\n /** A human readable error message */\n message: string;\n}\n\n/** Used for communicating sync results of multiple live updates */\nexport interface SyncResults {\n liveUpdates: LiveUpdate[];\n errors: LiveUpdateError[];\n}\n\n/**\n * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.\n * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.\n *\n * @param pathToKey The *relative* path to the public key for verification.\n * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.\n * @returns Promise<void>\n */\nexport const enableSecureLiveUpdates = async (\n pathToKey: string\n): Promise<void> => {\n return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);\n};\n\n/**\n * Syncs a single live update.\n *\n * @param appId The AppFlow application ID to sync.\n * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.\n */\nexport const syncOne = async (appId: string): Promise<LiveUpdate> => {\n return IONPortalsReactNative.syncOne(appId);\n};\n\n/**\n * Syncs many live updates.\n *\n * @param appIds The AppFlow application IDs to sync.\n * @returns Promise<SyncResults>\n */\nexport const syncSome = async (appIds: string[]): Promise<SyncResults> => {\n return IONPortalsReactNative.syncSome(appIds);\n};\n\n/**\n * Syncs all registered LiveUpdates\n * @returns Promise<SyncResults>\n */\nexport const syncAll = async (): Promise<SyncResults> => {\n return IONPortalsReactNative.syncAll();\n};\n"],"mappings":"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"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
2
|
import React, { useEffect, useRef } from 'react';
|
|
4
3
|
import { findNodeHandle, requireNativeComponent, UIManager } from 'react-native';
|
|
5
4
|
const PortalViewManager = requireNativeComponent('AndroidPortalView');
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const createFragment = viewId => UIManager.dispatchViewManagerCommand(viewId,
|
|
6
|
+
// we are calling the 'create' command
|
|
8
7
|
// @ts-expect-error
|
|
9
8
|
UIManager.AndroidPortalView.Commands.create.toString(), [viewId]);
|
|
10
|
-
|
|
11
9
|
const PortalView = props => {
|
|
12
10
|
const ref = useRef(null);
|
|
13
11
|
useEffect(() => {
|
|
@@ -18,6 +16,5 @@ const PortalView = props => {
|
|
|
18
16
|
ref: ref
|
|
19
17
|
}));
|
|
20
18
|
};
|
|
21
|
-
|
|
22
19
|
export default PortalView;
|
|
23
20
|
//# sourceMappingURL=PortalView.android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","findNodeHandle","requireNativeComponent","UIManager","PortalViewManager","createFragment","viewId","dispatchViewManagerCommand","AndroidPortalView","Commands","create","toString","PortalView","props","ref","current"],"sources":["PortalView.android.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\nimport type { PortalProps } from '.';\n\nconst PortalViewManager = requireNativeComponent('AndroidPortalView');\n\nconst createFragment = (viewId: number | null) =>\n UIManager.dispatchViewManagerCommand(\n viewId,\n // we are calling the 'create' command\n // @ts-expect-error\n UIManager.AndroidPortalView.Commands.create.toString(),\n [viewId]\n );\n\nconst PortalView = (props: PortalProps) => {\n const ref = useRef(null);\n\n useEffect(() => {\n const viewId = findNodeHandle(ref.current);\n createFragment(viewId);\n }, []);\n\n return <PortalViewManager {...props} ref={ref} />;\n};\n\nexport default PortalView;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","findNodeHandle","requireNativeComponent","UIManager","PortalViewManager","createFragment","viewId","dispatchViewManagerCommand","AndroidPortalView","Commands","create","toString","PortalView","props","ref","current"],"sources":["PortalView.android.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport {\n findNodeHandle,\n requireNativeComponent,\n UIManager,\n} from 'react-native';\nimport type { PortalProps } from '.';\n\nconst PortalViewManager = requireNativeComponent('AndroidPortalView');\n\nconst createFragment = (viewId: number | null) =>\n UIManager.dispatchViewManagerCommand(\n viewId,\n // we are calling the 'create' command\n // @ts-expect-error\n UIManager.AndroidPortalView.Commands.create.toString(),\n [viewId]\n );\n\nconst PortalView = (props: PortalProps) => {\n const ref = useRef(null);\n\n useEffect(() => {\n const viewId = findNodeHandle(ref.current);\n createFragment(viewId);\n }, []);\n\n return <PortalViewManager {...props} ref={ref} />;\n};\n\nexport default PortalView;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,cAAc,EACdC,sBAAsB,EACtBC,SAAS,QACJ,cAAc;AAGrB,MAAMC,iBAAiB,GAAGF,sBAAsB,CAAC,mBAAmB,CAAC;AAErE,MAAMG,cAAc,GAAIC,MAAqB,IAC3CH,SAAS,CAACI,0BAA0B,CAClCD,MAAM;AACN;AACA;AACAH,SAAS,CAACK,iBAAiB,CAACC,QAAQ,CAACC,MAAM,CAACC,QAAQ,EAAE,EACtD,CAACL,MAAM,CAAC,CACT;AAEH,MAAMM,UAAU,GAAIC,KAAkB,IAAK;EACzC,MAAMC,GAAG,GAAGd,MAAM,CAAC,IAAI,CAAC;EAExBD,SAAS,CAAC,MAAM;IACd,MAAMO,MAAM,GAAGL,cAAc,CAACa,GAAG,CAACC,OAAO,CAAC;IAC1CV,cAAc,CAACC,MAAM,CAAC;EACxB,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAO,oBAAC,iBAAiB,eAAKO,KAAK;IAAE,GAAG,EAAEC;EAAI,GAAG;AACnD,CAAC;AAED,eAAeF,UAAU"}
|
package/lib/module/PortalView.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { requireNativeComponent } from 'react-native';
|
|
3
3
|
const HostComponentPortal = requireNativeComponent('IONPortalView');
|
|
4
|
-
|
|
5
4
|
const PortalView = props => {
|
|
6
5
|
return /*#__PURE__*/React.createElement(HostComponentPortal, props);
|
|
7
6
|
};
|
|
8
|
-
|
|
9
7
|
export default PortalView;
|
|
10
8
|
//# sourceMappingURL=PortalView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","requireNativeComponent","HostComponentPortal","PortalView","props"],"sources":["PortalView.tsx"],"sourcesContent":["import React from 'react';\nimport { requireNativeComponent } from 'react-native';\nimport type { PortalProps } from '.';\n\nconst HostComponentPortal = requireNativeComponent('IONPortalView');\n\nconst PortalView = (props: PortalProps) => {\n return <HostComponentPortal {...props} />;\n};\n\nexport default PortalView;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["React","requireNativeComponent","HostComponentPortal","PortalView","props"],"sources":["PortalView.tsx"],"sourcesContent":["import React from 'react';\nimport { requireNativeComponent } from 'react-native';\nimport type { PortalProps } from '.';\n\nconst HostComponentPortal = requireNativeComponent('IONPortalView');\n\nconst PortalView = (props: PortalProps) => {\n return <HostComponentPortal {...props} />;\n};\n\nexport default PortalView;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,sBAAsB,QAAQ,cAAc;AAGrD,MAAMC,mBAAmB,GAAGD,sBAAsB,CAAC,eAAe,CAAC;AAEnE,MAAME,UAAU,GAAIC,KAAkB,IAAK;EACzC,oBAAO,oBAAC,mBAAmB,EAAKA,KAAK,CAAI;AAC3C,CAAC;AAED,eAAeD,UAAU"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
2
2
|
const {
|
|
3
3
|
IONPortalPubSub,
|
|
4
|
-
|
|
5
|
-
IONLiveUpdatesManager
|
|
4
|
+
IONPortalsReactNative
|
|
6
5
|
} = NativeModules;
|
|
7
6
|
export { default as PortalView } from './PortalView';
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* The data that is received from a subscription event.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
const PortalsPubSub = new NativeEventEmitter(IONPortalPubSub);
|
|
13
13
|
const subscriptionMap = new Map();
|
|
14
|
+
|
|
14
15
|
/**
|
|
15
16
|
* Subscribes to messages for a topic
|
|
16
17
|
*
|
|
@@ -18,7 +19,6 @@ const subscriptionMap = new Map();
|
|
|
18
19
|
* @param onMessageReceived The callback to invoke when a message is received
|
|
19
20
|
* @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
22
|
export const subscribe = async (topic, onMessageReceived) => {
|
|
23
23
|
const subscriptionRef = await IONPortalPubSub.subscribe(topic);
|
|
24
24
|
const subscriber = PortalsPubSub.addListener('PortalsSubscription', message => {
|
|
@@ -29,43 +29,44 @@ export const subscribe = async (topic, onMessageReceived) => {
|
|
|
29
29
|
subscriptionMap.set(subscriptionRef, subscriber);
|
|
30
30
|
return subscriptionRef;
|
|
31
31
|
};
|
|
32
|
+
|
|
32
33
|
/**
|
|
33
34
|
* Unsubscribes from events for the provided topic and subscription reference
|
|
34
35
|
*
|
|
35
36
|
* @param topic The topic to unsubscribe from
|
|
36
37
|
* @param subRef The unique subscription reference received when initially calling {@link subscribe}
|
|
37
38
|
*/
|
|
38
|
-
|
|
39
39
|
export const unsubscribe = (topic, subRef) => {
|
|
40
40
|
IONPortalPubSub.unsubscribe(topic, subRef);
|
|
41
41
|
const subscription = subscriptionMap.get(subRef);
|
|
42
|
-
|
|
43
42
|
if (subscription !== undefined) {
|
|
44
43
|
subscription.remove();
|
|
45
44
|
subscriptionMap.delete(subRef);
|
|
46
45
|
}
|
|
47
46
|
};
|
|
47
|
+
|
|
48
48
|
/**
|
|
49
49
|
* Publishes a message to the provided topic
|
|
50
50
|
*
|
|
51
51
|
* @param topic The topic to publish the message to
|
|
52
52
|
* @param data The data to publish to subscribers
|
|
53
53
|
*/
|
|
54
|
-
|
|
55
54
|
export const publish = (topic, data) => {
|
|
56
55
|
const msg = {
|
|
57
56
|
message: data
|
|
58
57
|
};
|
|
59
58
|
IONPortalPubSub.publish(topic, msg);
|
|
60
59
|
};
|
|
60
|
+
|
|
61
61
|
/**
|
|
62
62
|
* Validates that a valid registration key has been procured from http://ionic.io/register-portals
|
|
63
63
|
* @param key The registration key
|
|
64
|
+
* @returns Promise<void>
|
|
64
65
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
IONPortalManager.register(key);
|
|
66
|
+
export const register = async key => {
|
|
67
|
+
return IONPortalsReactNative.register(key);
|
|
68
68
|
};
|
|
69
|
+
|
|
69
70
|
/**
|
|
70
71
|
* The configuration of a web application to be embedded in a React Native application.
|
|
71
72
|
*/
|
|
@@ -74,9 +75,41 @@ export const register = key => {
|
|
|
74
75
|
* Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.
|
|
75
76
|
*
|
|
76
77
|
* @param portal The portal to add to the internal registry.
|
|
78
|
+
* @returns Promise containing the Portal that was added to the registry.
|
|
77
79
|
*/
|
|
78
|
-
export const addPortal = portal => {
|
|
79
|
-
|
|
80
|
+
export const addPortal = async portal => {
|
|
81
|
+
return IONPortalsReactNative.addPortal(portal);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}
|
|
86
|
+
*
|
|
87
|
+
* @param portals The portals to add to the internal registry.
|
|
88
|
+
* @returns Promise containing the Portals that were added to the registry.
|
|
89
|
+
*/
|
|
90
|
+
export const addPortals = async portals => {
|
|
91
|
+
return IONPortalsReactNative.addPortals(portals);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.
|
|
96
|
+
*
|
|
97
|
+
* @param name The portal name to retrieve from the internal registry.
|
|
98
|
+
* @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.
|
|
99
|
+
*/
|
|
100
|
+
export const getPortal = async name => {
|
|
101
|
+
return IONPortalsReactNative.getPortal(name);
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
|
|
105
|
+
* This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
|
|
106
|
+
*
|
|
107
|
+
* @param pathToKey The *relative* path to the public key for verification.
|
|
108
|
+
* This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
|
|
109
|
+
* @returns Promise<void>
|
|
110
|
+
*/
|
|
111
|
+
export const enableSecureLiveUpdates = async pathToKey => {
|
|
112
|
+
return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);
|
|
80
113
|
};
|
|
81
114
|
|
|
82
115
|
/**
|
|
@@ -85,25 +118,25 @@ export const addPortal = portal => {
|
|
|
85
118
|
* @param appId The AppFlow application ID to sync.
|
|
86
119
|
* @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.
|
|
87
120
|
*/
|
|
88
|
-
export const syncOne = appId => {
|
|
89
|
-
return
|
|
121
|
+
export const syncOne = async appId => {
|
|
122
|
+
return IONPortalsReactNative.syncOne(appId);
|
|
90
123
|
};
|
|
124
|
+
|
|
91
125
|
/**
|
|
92
126
|
* Syncs many live updates.
|
|
93
127
|
*
|
|
94
128
|
* @param appIds The AppFlow application IDs to sync.
|
|
95
129
|
* @returns Promise<SyncResults>
|
|
96
130
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return IONLiveUpdatesManager.syncSome(appIds);
|
|
131
|
+
export const syncSome = async appIds => {
|
|
132
|
+
return IONPortalsReactNative.syncSome(appIds);
|
|
100
133
|
};
|
|
134
|
+
|
|
101
135
|
/**
|
|
102
136
|
* Syncs all registered LiveUpdates
|
|
103
137
|
* @returns Promise<SyncResults>
|
|
104
138
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return IONLiveUpdatesManager.syncAll();
|
|
139
|
+
export const syncAll = async () => {
|
|
140
|
+
return IONPortalsReactNative.syncAll();
|
|
108
141
|
};
|
|
109
142
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","IONPortalPubSub","
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","IONPortalPubSub","IONPortalsReactNative","default","PortalView","PortalsPubSub","subscriptionMap","Map","subscribe","topic","onMessageReceived","subscriptionRef","subscriber","addListener","message","set","unsubscribe","subRef","subscription","get","undefined","remove","delete","publish","data","msg","register","key","addPortal","portal","addPortals","portals","getPortal","name","enableSecureLiveUpdates","pathToKey","syncOne","appId","syncSome","appIds","syncAll"],"sources":["index.ts"],"sourcesContent":["import {\n EmitterSubscription,\n NativeEventEmitter,\n NativeModules,\n ViewProps,\n} from 'react-native';\n\nconst { IONPortalPubSub, IONPortalsReactNative } = NativeModules;\n\nexport { default as PortalView } from './PortalView';\n\n/**\n * The data that is received from a subscription event.\n */\nexport interface Message {\n /** The unique subscription reference received from {@link subscribe}*/\n subscriptionRef: number;\n data: any;\n /** The topic the message was sent from */\n topic: string;\n}\n\nconst PortalsPubSub = new NativeEventEmitter(IONPortalPubSub);\n\nconst subscriptionMap = new Map<number, EmitterSubscription>();\n\n/**\n * Subscribes to messages for a topic\n *\n * @param topic The topic to subscribe to\n * @param onMessageReceived The callback to invoke when a message is received\n * @returns A Promise<number> containing the unique subscription reference. This will need to be stored for calling {@link unsubscribe}.\n */\nexport const subscribe = async (\n topic: string,\n onMessageReceived: (message: Message) => void\n): Promise<number> => {\n const subscriptionRef = await IONPortalPubSub.subscribe(topic);\n\n const subscriber = PortalsPubSub.addListener(\n 'PortalsSubscription',\n (message: Message) => {\n if (message.subscriptionRef === subscriptionRef) {\n onMessageReceived(message);\n }\n }\n );\n\n subscriptionMap.set(subscriptionRef, subscriber);\n\n return subscriptionRef;\n};\n\n/**\n * Unsubscribes from events for the provided topic and subscription reference\n *\n * @param topic The topic to unsubscribe from\n * @param subRef The unique subscription reference received when initially calling {@link subscribe}\n */\nexport const unsubscribe = (topic: string, subRef: number) => {\n IONPortalPubSub.unsubscribe(topic, subRef);\n\n const subscription = subscriptionMap.get(subRef);\n if (subscription !== undefined) {\n subscription.remove();\n subscriptionMap.delete(subRef);\n }\n};\n\n/**\n * Publishes a message to the provided topic\n *\n * @param topic The topic to publish the message to\n * @param data The data to publish to subscribers\n */\nexport const publish = (topic: string, data: any) => {\n const msg = { message: data };\n IONPortalPubSub.publish(topic, msg);\n};\n\n/**\n * Validates that a valid registration key has been procured from http://ionic.io/register-portals\n * @param key The registration key\n * @returns Promise<void>\n */\nexport const register = async (key: string): Promise<void> => {\n return IONPortalsReactNative.register(key);\n};\n\n/**\n * The configuration of a web application to be embedded in a React Native application.\n */\nexport interface Portal {\n /** The name of the Portal to be referenced. Must be **unique** */\n name: string;\n /** The classpath of all Capacitor plugins used in Android. (e.g. com.capacitorjs.plugins.camera.CameraPlugin) */\n androidPlugins?: string[];\n /**\n * The root directory of the web application relative to Bundle.main on iOS\n * and src/main/assets on Android. If omitted, `name` is used.\n */\n startDir?: string;\n /** The name of the initial file to load. If omitted, 'index.html' is used. */\n index?: string;\n /** Any data needed at initial render when a portal is loaded. */\n initialContext?: {\n [key: string]: any;\n };\n liveUpdate?: LiveUpdateConfig;\n}\n\n/**\n * A subset of {@link Portal} properties needed for rendering a Portal. `initialContext` can be used to override\n * any initialContext defined in the original {@link Portal} definition.\n */\nexport type PortalProp = {\n portal: Pick<Portal, 'name' | 'initialContext'>;\n};\n\n/**\n * Props needed for rendering a {@link Portal}\n */\nexport type PortalProps = PortalProp & ViewProps;\n\n/**\n * Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.\n *\n * @param portal The portal to add to the internal registry.\n * @returns Promise containing the Portal that was added to the registry.\n */\nexport const addPortal = async (portal: Portal): Promise<Portal> => {\n return IONPortalsReactNative.addPortal(portal);\n};\n\n/**\n * Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}\n *\n * @param portals The portals to add to the internal registry.\n * @returns Promise containing the Portals that were added to the registry.\n */\nexport const addPortals = async (portals: Portal[]): Promise<Portal[]> => {\n return IONPortalsReactNative.addPortals(portals);\n};\n\n/**\n * Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.\n *\n * @param name The portal name to retrieve from the internal registry.\n * @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.\n */\nexport const getPortal = async (name: string): Promise<Portal> => {\n return IONPortalsReactNative.getPortal(name);\n};\n\nexport interface LiveUpdate {\n /** The AppFlow application ID */\n appId: string;\n /** The AppFlow distribution channel */\n channel: string;\n}\n\n/** Data needed to register a live update to be managed */\nexport type LiveUpdateConfig = LiveUpdate & { syncOnAdd: boolean };\n\nexport interface LiveUpdateError {\n /** The AppFlow application ID relating to the failure */\n appId: string;\n /** The step in the sync process the LiveUpdate failed on. (e.g. CHECK, UNPACK)*/\n failStep: string;\n /** A human readable error message */\n message: string;\n}\n\n/** Used for communicating sync results of multiple live updates */\nexport interface SyncResults {\n liveUpdates: LiveUpdate[];\n errors: LiveUpdateError[];\n}\n\n/**\n * Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.\n * This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.\n *\n * @param pathToKey The *relative* path to the public key for verification.\n * This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.\n * @returns Promise<void>\n */\nexport const enableSecureLiveUpdates = async (\n pathToKey: string\n): Promise<void> => {\n return IONPortalsReactNative.enableSecureLiveUpdates(pathToKey);\n};\n\n/**\n * Syncs a single live update.\n *\n * @param appId The AppFlow application ID to sync.\n * @returns A Promise<LiveUpdate>. A failure should result in a {@link LiveUpdateError}.\n */\nexport const syncOne = async (appId: string): Promise<LiveUpdate> => {\n return IONPortalsReactNative.syncOne(appId);\n};\n\n/**\n * Syncs many live updates.\n *\n * @param appIds The AppFlow application IDs to sync.\n * @returns Promise<SyncResults>\n */\nexport const syncSome = async (appIds: string[]): Promise<SyncResults> => {\n return IONPortalsReactNative.syncSome(appIds);\n};\n\n/**\n * Syncs all registered LiveUpdates\n * @returns Promise<SyncResults>\n */\nexport const syncAll = async (): Promise<SyncResults> => {\n return IONPortalsReactNative.syncAll();\n};\n"],"mappings":"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"}
|
|
@@ -35,8 +35,9 @@ export declare const publish: (topic: string, data: any) => void;
|
|
|
35
35
|
/**
|
|
36
36
|
* Validates that a valid registration key has been procured from http://ionic.io/register-portals
|
|
37
37
|
* @param key The registration key
|
|
38
|
+
* @returns Promise<void>
|
|
38
39
|
*/
|
|
39
|
-
export declare const register: (key: string) => void
|
|
40
|
+
export declare const register: (key: string) => Promise<void>;
|
|
40
41
|
/**
|
|
41
42
|
* The configuration of a web application to be embedded in a React Native application.
|
|
42
43
|
*/
|
|
@@ -73,8 +74,23 @@ export declare type PortalProps = PortalProp & ViewProps;
|
|
|
73
74
|
* Adds a Portal to an internal registry. Must be called before attempting to render a {@link PortalView}.
|
|
74
75
|
*
|
|
75
76
|
* @param portal The portal to add to the internal registry.
|
|
77
|
+
* @returns Promise containing the Portal that was added to the registry.
|
|
76
78
|
*/
|
|
77
|
-
export declare const addPortal: (portal: Portal) =>
|
|
79
|
+
export declare const addPortal: (portal: Portal) => Promise<Portal>;
|
|
80
|
+
/**
|
|
81
|
+
* Adds all portals to an internal registry. This or {@link addPortal} must be called before attempting to render a {@link PortalView}
|
|
82
|
+
*
|
|
83
|
+
* @param portals The portals to add to the internal registry.
|
|
84
|
+
* @returns Promise containing the Portals that were added to the registry.
|
|
85
|
+
*/
|
|
86
|
+
export declare const addPortals: (portals: Portal[]) => Promise<Portal[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Gets a {@link Portal} previously registered via {@link addPortal} or {@link addPortals}.
|
|
89
|
+
*
|
|
90
|
+
* @param name The portal name to retrieve from the internal registry.
|
|
91
|
+
* @returns Promise containing the registered {@link Portal}. If the {@link Portal} was not registered, the Promise will fail.
|
|
92
|
+
*/
|
|
93
|
+
export declare const getPortal: (name: string) => Promise<Portal>;
|
|
78
94
|
export interface LiveUpdate {
|
|
79
95
|
/** The AppFlow application ID */
|
|
80
96
|
appId: string;
|
|
@@ -98,6 +114,15 @@ export interface SyncResults {
|
|
|
98
114
|
liveUpdates: LiveUpdate[];
|
|
99
115
|
errors: LiveUpdateError[];
|
|
100
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Configures LiveUpdates to cyrptographically verify the contents of the downloaded bundles.
|
|
119
|
+
* This method must be called before any LiveUpdates are registered otherwise they will no longer be tracked.
|
|
120
|
+
*
|
|
121
|
+
* @param pathToKey The *relative* path to the public key for verification.
|
|
122
|
+
* This path should be the same relatibe to the main application bundle on iOS and the assets directory on Android.
|
|
123
|
+
* @returns Promise<void>
|
|
124
|
+
*/
|
|
125
|
+
export declare const enableSecureLiveUpdates: (pathToKey: string) => Promise<void>;
|
|
101
126
|
/**
|
|
102
127
|
* Syncs a single live update.
|
|
103
128
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ionic/portals-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Ionic Portals for React Native",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"typescript": "tsc --noEmit",
|
|
30
30
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
31
31
|
"lint:fix": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
|
32
|
+
"docs": "typedoc --out ./docs/documentation ./src --tsconfig ./tsconfig.build.json",
|
|
32
33
|
"prepare": "bob build",
|
|
33
34
|
"release": "release-it",
|
|
34
35
|
"example": "yarn --cwd example",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"react": "16.13.1",
|
|
69
70
|
"react-native": "0.63.4",
|
|
70
71
|
"react-native-builder-bob": "^0.18.2",
|
|
72
|
+
"typedoc": "^0.23.16",
|
|
71
73
|
"typescript": "^4.1.3"
|
|
72
74
|
},
|
|
73
75
|
"peerDependencies": {
|