@ionic/portals-react-native 0.0.1

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.
Files changed (38) hide show
  1. package/LICENSE.md +67 -0
  2. package/README.md +192 -0
  3. package/ReactNativePortals.podspec +20 -0
  4. package/android/build.gradle +122 -0
  5. package/android/gradle.properties +4 -0
  6. package/android/src/main/AndroidManifest.xml +4 -0
  7. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsModule.kt +203 -0
  8. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsPackage.kt +20 -0
  9. package/ios/Podfile +14 -0
  10. package/ios/Podfile.lock +389 -0
  11. package/ios/PortalManager.m +14 -0
  12. package/ios/PortalView.m +14 -0
  13. package/ios/PortalsPubSub.m +16 -0
  14. package/ios/ReactNativePortals-Bridging-Header.h +3 -0
  15. package/ios/ReactNativePortals.swift +113 -0
  16. package/ios/ReactNativePortals.xcodeproj/project.pbxproj +417 -0
  17. package/ios/ReactNativePortals.xcodeproj/xcshareddata/xcschemes/ReactNativePortals.xcscheme +67 -0
  18. package/ios/ReactNativePortals.xcworkspace/contents.xcworkspacedata +10 -0
  19. package/ios/ReactNativePortals.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  20. package/lib/commonjs/PortalView.android.js +37 -0
  21. package/lib/commonjs/PortalView.android.js.map +1 -0
  22. package/lib/commonjs/PortalView.js +22 -0
  23. package/lib/commonjs/PortalView.js.map +1 -0
  24. package/lib/commonjs/index.js +62 -0
  25. package/lib/commonjs/index.js.map +1 -0
  26. package/lib/module/PortalView.android.js +23 -0
  27. package/lib/module/PortalView.android.js.map +1 -0
  28. package/lib/module/PortalView.js +10 -0
  29. package/lib/module/PortalView.js.map +1 -0
  30. package/lib/module/index.js +30 -0
  31. package/lib/module/index.js.map +1 -0
  32. package/lib/typescript/PortalView.android.d.ts +4 -0
  33. package/lib/typescript/PortalView.d.ts +4 -0
  34. package/lib/typescript/index.d.ts +18 -0
  35. package/package.json +133 -0
  36. package/src/PortalView.android.tsx +31 -0
  37. package/src/PortalView.tsx +11 -0
  38. package/src/index.ts +53 -0
@@ -0,0 +1,389 @@
1
+ PODS:
2
+ - boost-for-react-native (1.63.0)
3
+ - Capacitor (3.4.3):
4
+ - CapacitorCordova
5
+ - CapacitorCordova (3.4.3)
6
+ - DoubleConversion (1.1.6)
7
+ - FBLazyVector (0.63.4)
8
+ - FBReactNativeSpec (0.63.4):
9
+ - Folly (= 2020.01.13.00)
10
+ - RCTRequired (= 0.63.4)
11
+ - RCTTypeSafety (= 0.63.4)
12
+ - React-Core (= 0.63.4)
13
+ - React-jsi (= 0.63.4)
14
+ - ReactCommon/turbomodule/core (= 0.63.4)
15
+ - Folly (2020.01.13.00):
16
+ - boost-for-react-native
17
+ - DoubleConversion
18
+ - Folly/Default (= 2020.01.13.00)
19
+ - glog
20
+ - Folly/Default (2020.01.13.00):
21
+ - boost-for-react-native
22
+ - DoubleConversion
23
+ - glog
24
+ - glog (0.3.5)
25
+ - IonicLiveUpdates (0.0.5):
26
+ - ZIPFoundation
27
+ - IonicPortals (0.5.1):
28
+ - Capacitor
29
+ - IonicLiveUpdates
30
+ - RCTRequired (0.63.4)
31
+ - RCTTypeSafety (0.63.4):
32
+ - FBLazyVector (= 0.63.4)
33
+ - Folly (= 2020.01.13.00)
34
+ - RCTRequired (= 0.63.4)
35
+ - React-Core (= 0.63.4)
36
+ - React (0.63.4):
37
+ - React-Core (= 0.63.4)
38
+ - React-Core/DevSupport (= 0.63.4)
39
+ - React-Core/RCTWebSocket (= 0.63.4)
40
+ - React-RCTActionSheet (= 0.63.4)
41
+ - React-RCTAnimation (= 0.63.4)
42
+ - React-RCTBlob (= 0.63.4)
43
+ - React-RCTImage (= 0.63.4)
44
+ - React-RCTLinking (= 0.63.4)
45
+ - React-RCTNetwork (= 0.63.4)
46
+ - React-RCTSettings (= 0.63.4)
47
+ - React-RCTText (= 0.63.4)
48
+ - React-RCTVibration (= 0.63.4)
49
+ - React-callinvoker (0.63.4)
50
+ - React-Core (0.63.4):
51
+ - Folly (= 2020.01.13.00)
52
+ - glog
53
+ - React-Core/Default (= 0.63.4)
54
+ - React-cxxreact (= 0.63.4)
55
+ - React-jsi (= 0.63.4)
56
+ - React-jsiexecutor (= 0.63.4)
57
+ - Yoga
58
+ - React-Core/CoreModulesHeaders (0.63.4):
59
+ - Folly (= 2020.01.13.00)
60
+ - glog
61
+ - React-Core/Default
62
+ - React-cxxreact (= 0.63.4)
63
+ - React-jsi (= 0.63.4)
64
+ - React-jsiexecutor (= 0.63.4)
65
+ - Yoga
66
+ - React-Core/Default (0.63.4):
67
+ - Folly (= 2020.01.13.00)
68
+ - glog
69
+ - React-cxxreact (= 0.63.4)
70
+ - React-jsi (= 0.63.4)
71
+ - React-jsiexecutor (= 0.63.4)
72
+ - Yoga
73
+ - React-Core/DevSupport (0.63.4):
74
+ - Folly (= 2020.01.13.00)
75
+ - glog
76
+ - React-Core/Default (= 0.63.4)
77
+ - React-Core/RCTWebSocket (= 0.63.4)
78
+ - React-cxxreact (= 0.63.4)
79
+ - React-jsi (= 0.63.4)
80
+ - React-jsiexecutor (= 0.63.4)
81
+ - React-jsinspector (= 0.63.4)
82
+ - Yoga
83
+ - React-Core/RCTActionSheetHeaders (0.63.4):
84
+ - Folly (= 2020.01.13.00)
85
+ - glog
86
+ - React-Core/Default
87
+ - React-cxxreact (= 0.63.4)
88
+ - React-jsi (= 0.63.4)
89
+ - React-jsiexecutor (= 0.63.4)
90
+ - Yoga
91
+ - React-Core/RCTAnimationHeaders (0.63.4):
92
+ - Folly (= 2020.01.13.00)
93
+ - glog
94
+ - React-Core/Default
95
+ - React-cxxreact (= 0.63.4)
96
+ - React-jsi (= 0.63.4)
97
+ - React-jsiexecutor (= 0.63.4)
98
+ - Yoga
99
+ - React-Core/RCTBlobHeaders (0.63.4):
100
+ - Folly (= 2020.01.13.00)
101
+ - glog
102
+ - React-Core/Default
103
+ - React-cxxreact (= 0.63.4)
104
+ - React-jsi (= 0.63.4)
105
+ - React-jsiexecutor (= 0.63.4)
106
+ - Yoga
107
+ - React-Core/RCTImageHeaders (0.63.4):
108
+ - Folly (= 2020.01.13.00)
109
+ - glog
110
+ - React-Core/Default
111
+ - React-cxxreact (= 0.63.4)
112
+ - React-jsi (= 0.63.4)
113
+ - React-jsiexecutor (= 0.63.4)
114
+ - Yoga
115
+ - React-Core/RCTLinkingHeaders (0.63.4):
116
+ - Folly (= 2020.01.13.00)
117
+ - glog
118
+ - React-Core/Default
119
+ - React-cxxreact (= 0.63.4)
120
+ - React-jsi (= 0.63.4)
121
+ - React-jsiexecutor (= 0.63.4)
122
+ - Yoga
123
+ - React-Core/RCTNetworkHeaders (0.63.4):
124
+ - Folly (= 2020.01.13.00)
125
+ - glog
126
+ - React-Core/Default
127
+ - React-cxxreact (= 0.63.4)
128
+ - React-jsi (= 0.63.4)
129
+ - React-jsiexecutor (= 0.63.4)
130
+ - Yoga
131
+ - React-Core/RCTSettingsHeaders (0.63.4):
132
+ - Folly (= 2020.01.13.00)
133
+ - glog
134
+ - React-Core/Default
135
+ - React-cxxreact (= 0.63.4)
136
+ - React-jsi (= 0.63.4)
137
+ - React-jsiexecutor (= 0.63.4)
138
+ - Yoga
139
+ - React-Core/RCTTextHeaders (0.63.4):
140
+ - Folly (= 2020.01.13.00)
141
+ - glog
142
+ - React-Core/Default
143
+ - React-cxxreact (= 0.63.4)
144
+ - React-jsi (= 0.63.4)
145
+ - React-jsiexecutor (= 0.63.4)
146
+ - Yoga
147
+ - React-Core/RCTVibrationHeaders (0.63.4):
148
+ - Folly (= 2020.01.13.00)
149
+ - glog
150
+ - React-Core/Default
151
+ - React-cxxreact (= 0.63.4)
152
+ - React-jsi (= 0.63.4)
153
+ - React-jsiexecutor (= 0.63.4)
154
+ - Yoga
155
+ - React-Core/RCTWebSocket (0.63.4):
156
+ - Folly (= 2020.01.13.00)
157
+ - glog
158
+ - React-Core/Default (= 0.63.4)
159
+ - React-cxxreact (= 0.63.4)
160
+ - React-jsi (= 0.63.4)
161
+ - React-jsiexecutor (= 0.63.4)
162
+ - Yoga
163
+ - React-CoreModules (0.63.4):
164
+ - FBReactNativeSpec (= 0.63.4)
165
+ - Folly (= 2020.01.13.00)
166
+ - RCTTypeSafety (= 0.63.4)
167
+ - React-Core/CoreModulesHeaders (= 0.63.4)
168
+ - React-jsi (= 0.63.4)
169
+ - React-RCTImage (= 0.63.4)
170
+ - ReactCommon/turbomodule/core (= 0.63.4)
171
+ - React-cxxreact (0.63.4):
172
+ - boost-for-react-native (= 1.63.0)
173
+ - DoubleConversion
174
+ - Folly (= 2020.01.13.00)
175
+ - glog
176
+ - React-callinvoker (= 0.63.4)
177
+ - React-jsinspector (= 0.63.4)
178
+ - React-jsi (0.63.4):
179
+ - boost-for-react-native (= 1.63.0)
180
+ - DoubleConversion
181
+ - Folly (= 2020.01.13.00)
182
+ - glog
183
+ - React-jsi/Default (= 0.63.4)
184
+ - React-jsi/Default (0.63.4):
185
+ - boost-for-react-native (= 1.63.0)
186
+ - DoubleConversion
187
+ - Folly (= 2020.01.13.00)
188
+ - glog
189
+ - React-jsiexecutor (0.63.4):
190
+ - DoubleConversion
191
+ - Folly (= 2020.01.13.00)
192
+ - glog
193
+ - React-cxxreact (= 0.63.4)
194
+ - React-jsi (= 0.63.4)
195
+ - React-jsinspector (0.63.4)
196
+ - React-RCTActionSheet (0.63.4):
197
+ - React-Core/RCTActionSheetHeaders (= 0.63.4)
198
+ - React-RCTAnimation (0.63.4):
199
+ - FBReactNativeSpec (= 0.63.4)
200
+ - Folly (= 2020.01.13.00)
201
+ - RCTTypeSafety (= 0.63.4)
202
+ - React-Core/RCTAnimationHeaders (= 0.63.4)
203
+ - React-jsi (= 0.63.4)
204
+ - ReactCommon/turbomodule/core (= 0.63.4)
205
+ - React-RCTBlob (0.63.4):
206
+ - FBReactNativeSpec (= 0.63.4)
207
+ - Folly (= 2020.01.13.00)
208
+ - React-Core/RCTBlobHeaders (= 0.63.4)
209
+ - React-Core/RCTWebSocket (= 0.63.4)
210
+ - React-jsi (= 0.63.4)
211
+ - React-RCTNetwork (= 0.63.4)
212
+ - ReactCommon/turbomodule/core (= 0.63.4)
213
+ - React-RCTImage (0.63.4):
214
+ - FBReactNativeSpec (= 0.63.4)
215
+ - Folly (= 2020.01.13.00)
216
+ - RCTTypeSafety (= 0.63.4)
217
+ - React-Core/RCTImageHeaders (= 0.63.4)
218
+ - React-jsi (= 0.63.4)
219
+ - React-RCTNetwork (= 0.63.4)
220
+ - ReactCommon/turbomodule/core (= 0.63.4)
221
+ - React-RCTLinking (0.63.4):
222
+ - FBReactNativeSpec (= 0.63.4)
223
+ - React-Core/RCTLinkingHeaders (= 0.63.4)
224
+ - React-jsi (= 0.63.4)
225
+ - ReactCommon/turbomodule/core (= 0.63.4)
226
+ - React-RCTNetwork (0.63.4):
227
+ - FBReactNativeSpec (= 0.63.4)
228
+ - Folly (= 2020.01.13.00)
229
+ - RCTTypeSafety (= 0.63.4)
230
+ - React-Core/RCTNetworkHeaders (= 0.63.4)
231
+ - React-jsi (= 0.63.4)
232
+ - ReactCommon/turbomodule/core (= 0.63.4)
233
+ - React-RCTSettings (0.63.4):
234
+ - FBReactNativeSpec (= 0.63.4)
235
+ - Folly (= 2020.01.13.00)
236
+ - RCTTypeSafety (= 0.63.4)
237
+ - React-Core/RCTSettingsHeaders (= 0.63.4)
238
+ - React-jsi (= 0.63.4)
239
+ - ReactCommon/turbomodule/core (= 0.63.4)
240
+ - React-RCTText (0.63.4):
241
+ - React-Core/RCTTextHeaders (= 0.63.4)
242
+ - React-RCTVibration (0.63.4):
243
+ - FBReactNativeSpec (= 0.63.4)
244
+ - Folly (= 2020.01.13.00)
245
+ - React-Core/RCTVibrationHeaders (= 0.63.4)
246
+ - React-jsi (= 0.63.4)
247
+ - ReactCommon/turbomodule/core (= 0.63.4)
248
+ - ReactCommon/turbomodule/core (0.63.4):
249
+ - DoubleConversion
250
+ - Folly (= 2020.01.13.00)
251
+ - glog
252
+ - React-callinvoker (= 0.63.4)
253
+ - React-Core (= 0.63.4)
254
+ - React-cxxreact (= 0.63.4)
255
+ - React-jsi (= 0.63.4)
256
+ - Yoga (1.14.0)
257
+ - ZIPFoundation (0.9.13)
258
+
259
+ DEPENDENCIES:
260
+ - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
261
+ - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
262
+ - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`)
263
+ - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
264
+ - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
265
+ - IonicPortals (~> 0.5.1)
266
+ - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
267
+ - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
268
+ - React (from `../node_modules/react-native/`)
269
+ - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
270
+ - React-Core (from `../node_modules/react-native/`)
271
+ - React-Core/DevSupport (from `../node_modules/react-native/`)
272
+ - React-Core/RCTWebSocket (from `../node_modules/react-native/`)
273
+ - React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
274
+ - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
275
+ - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
276
+ - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
277
+ - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
278
+ - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
279
+ - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
280
+ - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
281
+ - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
282
+ - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
283
+ - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
284
+ - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
285
+ - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
286
+ - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
287
+ - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
288
+ - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
289
+
290
+ SPEC REPOS:
291
+ trunk:
292
+ - boost-for-react-native
293
+ - Capacitor
294
+ - CapacitorCordova
295
+ - IonicLiveUpdates
296
+ - IonicPortals
297
+ - ZIPFoundation
298
+
299
+ EXTERNAL SOURCES:
300
+ DoubleConversion:
301
+ :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
302
+ FBLazyVector:
303
+ :path: "../node_modules/react-native/Libraries/FBLazyVector"
304
+ FBReactNativeSpec:
305
+ :path: "../node_modules/react-native/Libraries/FBReactNativeSpec"
306
+ Folly:
307
+ :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
308
+ glog:
309
+ :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
310
+ RCTRequired:
311
+ :path: "../node_modules/react-native/Libraries/RCTRequired"
312
+ RCTTypeSafety:
313
+ :path: "../node_modules/react-native/Libraries/TypeSafety"
314
+ React:
315
+ :path: "../node_modules/react-native/"
316
+ React-callinvoker:
317
+ :path: "../node_modules/react-native/ReactCommon/callinvoker"
318
+ React-Core:
319
+ :path: "../node_modules/react-native/"
320
+ React-CoreModules:
321
+ :path: "../node_modules/react-native/React/CoreModules"
322
+ React-cxxreact:
323
+ :path: "../node_modules/react-native/ReactCommon/cxxreact"
324
+ React-jsi:
325
+ :path: "../node_modules/react-native/ReactCommon/jsi"
326
+ React-jsiexecutor:
327
+ :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
328
+ React-jsinspector:
329
+ :path: "../node_modules/react-native/ReactCommon/jsinspector"
330
+ React-RCTActionSheet:
331
+ :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
332
+ React-RCTAnimation:
333
+ :path: "../node_modules/react-native/Libraries/NativeAnimation"
334
+ React-RCTBlob:
335
+ :path: "../node_modules/react-native/Libraries/Blob"
336
+ React-RCTImage:
337
+ :path: "../node_modules/react-native/Libraries/Image"
338
+ React-RCTLinking:
339
+ :path: "../node_modules/react-native/Libraries/LinkingIOS"
340
+ React-RCTNetwork:
341
+ :path: "../node_modules/react-native/Libraries/Network"
342
+ React-RCTSettings:
343
+ :path: "../node_modules/react-native/Libraries/Settings"
344
+ React-RCTText:
345
+ :path: "../node_modules/react-native/Libraries/Text"
346
+ React-RCTVibration:
347
+ :path: "../node_modules/react-native/Libraries/Vibration"
348
+ ReactCommon:
349
+ :path: "../node_modules/react-native/ReactCommon"
350
+ Yoga:
351
+ :path: "../node_modules/react-native/ReactCommon/yoga"
352
+
353
+ SPEC CHECKSUMS:
354
+ boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
355
+ Capacitor: df9b3339e2ccf9fcfa19f90073a83454b3113691
356
+ CapacitorCordova: 7a09a302f17e14a308291bb3fa2b01ad2e4dfcaf
357
+ DoubleConversion: cde416483dac037923206447da6e1454df403714
358
+ FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
359
+ FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
360
+ Folly: b73c3869541e86821df3c387eb0af5f65addfab4
361
+ glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
362
+ IonicLiveUpdates: f3e54dbb5a330eb820a823477c5a75cd4470b65d
363
+ IonicPortals: 4f1621c0fc949119ef78d1f5c39c8de9ba3e12c7
364
+ RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e
365
+ RCTTypeSafety: 8c9c544ecbf20337d069e4ae7fd9a377aadf504b
366
+ React: b0a957a2c44da4113b0c4c9853d8387f8e64e615
367
+ React-callinvoker: c3f44dd3cb195b6aa46621fff95ded79d59043fe
368
+ React-Core: d3b2a1ac9a2c13c3bcde712d9281fc1c8a5b315b
369
+ React-CoreModules: 0581ff36cb797da0943d424f69e7098e43e9be60
370
+ React-cxxreact: c1480d4fda5720086c90df537ee7d285d4c57ac3
371
+ React-jsi: a0418934cf48f25b485631deb27c64dc40fb4c31
372
+ React-jsiexecutor: 93bd528844ad21dc07aab1c67cb10abae6df6949
373
+ React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a
374
+ React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336
375
+ React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b
376
+ React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0
377
+ React-RCTImage: c1b1f2d3f43a4a528c8946d6092384b5c880d2f0
378
+ React-RCTLinking: 35ae4ab9dc0410d1fcbdce4d7623194a27214fb2
379
+ React-RCTNetwork: 29ec2696f8d8cfff7331fac83d3e893c95ef43ae
380
+ React-RCTSettings: 60f0691bba2074ef394f95d4c2265ec284e0a46a
381
+ React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c
382
+ React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
383
+ ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
384
+ Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
385
+ ZIPFoundation: ae5b4b813d216d3bf0a148773267fff14bd51d37
386
+
387
+ PODFILE CHECKSUM: 3d4e1ae438899ba8709c2e19e767a9a9cced011b
388
+
389
+ COCOAPODS: 1.11.2
@@ -0,0 +1,14 @@
1
+ //
2
+ // PortalManager.m
3
+ // ReactNativePortals
4
+ //
5
+ // Created by Steven Sherry on 4/1/22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import <React/RCTBridgeModule.h>
10
+
11
+ @interface RCT_EXTERN_MODULE(IONPortalManager, NSObject)
12
+ RCT_EXTERN_METHOD(register: (NSString *) key)
13
+ RCT_EXTERN_METHOD(addPortal: (NSDictionary) portal)
14
+ @end
@@ -0,0 +1,14 @@
1
+ //
2
+ // PortalView.m
3
+ // ReactNativePortals
4
+ //
5
+ // Created by Steven Sherry on 4/1/22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import <React/RCTViewManager.h>
10
+
11
+ @interface RCT_EXTERN_MODULE(IONPortalViewManager, RCTViewManager)
12
+ RCT_EXPORT_VIEW_PROPERTY(name, NSString)
13
+ RCT_EXPORT_VIEW_PROPERTY(initialContext, NSDictionary)
14
+ @end
@@ -0,0 +1,16 @@
1
+ //
2
+ // PortalsPubSub.m
3
+ // ReactNativePortals
4
+ //
5
+ // Created by Steven Sherry on 4/1/22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import <React/RCTBridgeModule.h>
10
+ #import <React/RCTEventEmitter.h>
11
+
12
+ @interface RCT_EXTERN_MODULE(IONPortalsPubSub, RCTEventEmitter)
13
+ RCT_EXTERN_METHOD(subscribe: (NSString *) topic resolver: (RCTPromiseResolveBlock) resolver rejector: (RCTPromiseRejectBlock) rejector)
14
+ RCT_EXTERN_METHOD(unsubscribe: (NSString *) topic subscriptionRef: (NSNumber) subscriptionRef)
15
+ RCT_EXTERN_METHOD(publish: (NSString *) topic data: (id) data)
16
+ @end
@@ -0,0 +1,3 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,113 @@
1
+ import Foundation
2
+ import IonicPortals
3
+ import React
4
+ import UIKit
5
+
6
+ @objc(IONPortalManager)
7
+ class PortalManager: NSObject {
8
+ private typealias IonPortalManager = IonicPortals.PortalManager
9
+
10
+ @objc func register(_ key: String) {
11
+ IonPortalManager.register(key)
12
+ }
13
+
14
+ @objc func addPortal(_ portalDict: [String: Any]) {
15
+ guard let name = portalDict["name"] as? String else { return }
16
+ let portal = Portal(name, portalDict["startDir"] as? String)
17
+ portal.initialContext = portalDict["initialContext"] as? [String: Any]
18
+ IonPortalManager.addPortal(portal)
19
+ }
20
+
21
+ @objc static func requiresMainQueueSetup() -> Bool { true }
22
+ }
23
+
24
+ @objc(IONPortalsPubSub)
25
+ class PortalsPubSub: RCTEventEmitter {
26
+ private let eventName = "PortalsSubscription"
27
+
28
+ override func supportedEvents() -> [String]! {
29
+ [eventName]
30
+ }
31
+
32
+ @objc func subscribe(_ topic: String, resolver: RCTPromiseResolveBlock, rejector: RCTPromiseRejectBlock) {
33
+ let subRef = PortalsPlugin.subscribe(topic) { [weak self] result in
34
+ guard let self = self else { return }
35
+ self.sendEvent(
36
+ withName: self.eventName,
37
+ body: [
38
+ "subscriptionRef": result.subscriptionRef,
39
+ "topic": result.topic,
40
+ "data": result.data
41
+ ]
42
+ )
43
+ }
44
+
45
+ resolver(subRef)
46
+ }
47
+
48
+ @objc func unsubscribe(_ topic: String, subscriptionRef: Int) {
49
+ PortalsPlugin.unsubscribe(topic, subscriptionRef)
50
+ }
51
+
52
+ @objc func publish(_ topic: String, data: Any) {
53
+ PortalsPlugin.publish(topic, data)
54
+ }
55
+
56
+ override class func requiresMainQueueSetup() -> Bool { true }
57
+ }
58
+
59
+ @objc(IONPortalViewManager)
60
+ class PortalViewManager: RCTViewManager {
61
+ override class func requiresMainQueueSetup() -> Bool { true }
62
+ override func view() -> UIView! { PortalView() }
63
+ }
64
+
65
+ class PortalView: UIView {
66
+ private var webView: PortalWebView?
67
+
68
+ @objc var name: String? {
69
+ get {
70
+ guard let _portal = _portal else { return nil }
71
+ return _portal.name
72
+ }
73
+
74
+ set {
75
+ guard let portalName = newValue else { return }
76
+ _portal = try? IonicPortals.PortalManager.getPortal(portalName)
77
+ }
78
+ }
79
+
80
+ @objc var initialContext: [String: Any]? {
81
+ get {
82
+ guard let portal = _portal else { return nil }
83
+ return portal.initialContext
84
+ }
85
+
86
+ set {
87
+ guard let name = name else { return }
88
+ _portal = try? IonicPortals.PortalManager.getPortal(name)
89
+ _portal?.initialContext = newValue
90
+ }
91
+ }
92
+
93
+ private var _portal: Portal? {
94
+ didSet {
95
+ guard let portal = _portal else { return }
96
+ DispatchQueue.main.async { [weak self] in
97
+ guard let self = self else { return }
98
+ self.webView?.removeFromSuperview()
99
+ let webView = PortalWebView(portal: portal)
100
+ webView.translatesAutoresizingMaskIntoConstraints = false
101
+ self.addSubview(webView)
102
+ NSLayoutConstraint.activate([
103
+ webView.topAnchor.constraint(equalTo: self.topAnchor),
104
+ webView.bottomAnchor.constraint(equalTo: self.bottomAnchor),
105
+ webView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
106
+ webView.trailingAnchor.constraint(equalTo: self.trailingAnchor)
107
+ ])
108
+ self.webView = webView
109
+ }
110
+ }
111
+ }
112
+ }
113
+