@ionic/portals-react-native 0.5.1 → 0.6.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.
Files changed (48) hide show
  1. package/ReactNativePortals.podspec +39 -14
  2. package/android/build.gradle +78 -108
  3. package/android/gradle.properties +5 -3
  4. package/android/src/main/java/io/ionic/portals/reactnative/PortalView.kt +11 -8
  5. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalManager.kt +37 -16
  6. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativePortalsModule.kt +2 -3
  7. package/android/src/main/java/io/ionic/portals/reactnative/ReactNativeWebVitalsModule.kt +11 -19
  8. package/ios/IonicPortals+Codable.swift +77 -0
  9. package/ios/LiveUpdateManager+Async.swift +16 -46
  10. package/ios/Podfile +29 -4
  11. package/ios/Podfile.lock +478 -241
  12. package/ios/Portal.swift +50 -54
  13. package/ios/PortalView.swift +26 -8
  14. package/ios/PortalsConfig.swift +1 -88
  15. package/ios/PortalsReactNative-Bridging-Header.h +2 -0
  16. package/ios/PortalsReactNative.swift +41 -36
  17. package/ios/SyncResult+SyncError+Encodable.swift +55 -0
  18. package/ios/WebVitals.swift +19 -26
  19. package/package.json +62 -43
  20. package/src/{PortalView.android.tsx → BasePortalView.android.tsx} +2 -3
  21. package/src/{PortalView.tsx → BasePortalView.tsx} +2 -3
  22. package/src/{index.ts → index.tsx} +77 -39
  23. package/ios/LiveUpdate+Dict.swift +0 -30
  24. package/ios/LiveUpdateManagerError+Dict.swift +0 -19
  25. package/ios/ReactNativePortals.xcodeproj/project.pbxproj +0 -465
  26. package/ios/ReactNativePortals.xcodeproj/xcshareddata/xcschemes/ReactNativePortals.xcscheme +0 -67
  27. package/ios/ReactNativePortals.xcworkspace/contents.xcworkspacedata +0 -10
  28. package/ios/ReactNativePortals.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  29. package/ios/SyncResult+Dict.swift +0 -35
  30. package/lib/commonjs/PortalView.android.js +0 -28
  31. package/lib/commonjs/PortalView.android.js.map +0 -1
  32. package/lib/commonjs/PortalView.js +0 -15
  33. package/lib/commonjs/PortalView.js.map +0 -1
  34. package/lib/commonjs/index.js +0 -200
  35. package/lib/commonjs/index.js.map +0 -1
  36. package/lib/module/PortalView.android.js +0 -20
  37. package/lib/module/PortalView.android.js.map +0 -1
  38. package/lib/module/PortalView.js +0 -8
  39. package/lib/module/PortalView.js.map +0 -1
  40. package/lib/module/index.js +0 -176
  41. package/lib/module/index.js.map +0 -1
  42. package/lib/typescript/PortalView.android.d.ts +0 -4
  43. package/lib/typescript/PortalView.d.ts +0 -4
  44. package/lib/typescript/index.d.ts +0 -181
  45. /package/ios/{PortalManager.m → PortalManager.mm} +0 -0
  46. /package/ios/{PortalView.m → PortalView.mm} +0 -0
  47. /package/ios/{PortalWebVitals.m → PortalWebVitals.mm} +0 -0
  48. /package/ios/{PortalsPubSub.m → PortalsPubSub.mm} +0 -0
@@ -7,63 +7,33 @@
7
7
  //
8
8
 
9
9
  import IonicLiveUpdates
10
+ import Capacitor
10
11
 
11
- struct SyncResults {
12
+ struct SyncResults: Encodable {
12
13
  var results: [LiveUpdateManager.SyncResult]
13
- var errors: [LiveUpdateManager.Error]
14
+ var errors: [LiveUpdateManager.SyncError]
14
15
  }
15
16
 
16
17
  extension SyncResults {
17
- var dict: [String: Any] {
18
- return [
19
- "results": results.map(\.dict),
20
- "errors": errors.map(\.dict)
21
- ]
18
+ init(_ results: ([LiveUpdateManager.SyncResult], [LiveUpdateManager.SyncError])) {
19
+ self.results = results.0
20
+ self.errors = results.1
21
+ }
22
+
23
+ var dict: JSValue {
24
+ get throws {
25
+ try JSValueEncoder(optionalEncodingStrategy: .undefined)
26
+ .encode(self)
27
+ }
22
28
  }
23
29
  }
24
30
 
25
31
  extension LiveUpdateManager {
26
32
  func syncSome(_ appIds: [String]) async -> SyncResults {
27
- await _syncSome(appIds).syncResults
28
- }
29
-
30
- private func _syncSome(_ appIds: [String]) -> AsyncStream<Result<LiveUpdateManager.SyncResult, LiveUpdateManager.Error>> {
31
- AsyncStream { continuation in
32
- sync(appIds: appIds, isParallel: true) {
33
- continuation.finish()
34
- } appComplete: { result in
35
- continuation.yield(result)
36
- }
37
- }
38
- }
39
-
40
- func syncAll() async -> SyncResults {
41
- await _syncAll().syncResults
42
- }
43
-
44
-
45
- private func _syncAll() -> AsyncStream<Result<LiveUpdateManager.SyncResult, LiveUpdateManager.Error>> {
46
- AsyncStream { continuation in
47
- sync(isParallel: true) {
48
- continuation.finish()
49
- } appComplete: { result in
50
- continuation.yield(result)
51
- }
52
- }
33
+ SyncResults(await sync(appIds: appIds))
53
34
  }
54
- }
55
35
 
56
- extension AsyncStream where Element == Result<LiveUpdateManager.SyncResult, LiveUpdateManager.Error> {
57
- var syncResults: SyncResults {
58
- get async {
59
- await reduce(into: SyncResults(results: [], errors: [])) { acc, next in
60
- switch next {
61
- case .success(let liveUpdate):
62
- acc.results.append(liveUpdate)
63
- case .failure(let error):
64
- acc.errors.append(error)
65
- }
66
- }
67
- }
36
+ func syncAll() async -> SyncResults {
37
+ SyncResults(await sync())
68
38
  }
69
39
  }
package/ios/Podfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../node_modules/react-native/scripts/react_native_pods'
2
4
  require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3
5
 
@@ -6,9 +8,32 @@ platform :ios, '14.0'
6
8
  target 'ReactNativePortals' do
7
9
  # Comment the next line if you don't want to use dynamic frameworks
8
10
  config = use_native_modules!
9
- use_frameworks!
10
- use_react_native!(path: config['reactNativePath'])
11
+ use_react_native!(path: config[:reactNativePath])
11
12
  # Pods for ReactNativePortals
12
- pod 'IonicPortals', '~> 0.8.0'
13
- pod 'IonicLiveUpdates', '~> 0.4.0'
13
+ pod 'IonicPortals', '~> 0.11.0'
14
+ pod 'IonicLiveUpdates', '~> 0.5.2'
15
+ end
16
+
17
+ dynamic_frameworks = ['Capacitor', 'CapacitorCordova']
18
+
19
+ pre_install do |installer|
20
+ installer.pod_targets.each do |pod|
21
+ if dynamic_frameworks.include?(pod.name)
22
+ def pod.static_framework?
23
+ false
24
+ end
25
+ def pod.build_type
26
+ Pod::BuildType.dynamic_framework
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ post_install do |installer|
33
+ installer.pods_project.targets.each do |target|
34
+ target.build_configurations.each do |config|
35
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)',
36
+ '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
37
+ end
38
+ end
14
39
  end