@trycourier/courier-react-native 5.7.1 → 5.8.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 +2 -2
- package/android/build.gradle +8 -7
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/courierreactnative/CourierClientModule.kt +2 -6
- package/android/src/main/java/com/courierreactnative/CourierPreferencesViewManager.kt +2 -2
- package/android/src/main/java/com/courierreactnative/CourierSystemModule.kt +6 -8
- package/android/src/main/java/com/courierreactnative/ReactNativeModule.kt +2 -6
- package/android/src/main/java/com/courierreactnative/Utils.kt +1 -1
- package/ios/CourierReactNativeDelegate.m +1 -1
- package/ios/CourierReactNativeEventEmitter.swift +1 -1
- package/lib/commonjs/Modules.js +6 -5
- package/lib/commonjs/Modules.js.map +1 -1
- package/lib/module/Modules.js +7 -6
- package/lib/module/Modules.js.map +1 -1
- package/lib/typescript/src/Modules.d.ts +1 -1
- package/lib/typescript/src/Modules.d.ts.map +1 -1
- package/package.json +13 -8
- package/src/Modules.tsx +14 -3
package/README.md
CHANGED
|
@@ -161,8 +161,8 @@ Starter projects using this SDK.
|
|
|
161
161
|
<tbody>
|
|
162
162
|
<tr width="1000px">
|
|
163
163
|
<td align="left">
|
|
164
|
-
<a href="https://github.com/trycourier/courier-react-native/tree/master/example">
|
|
165
|
-
<code>Example</code>
|
|
164
|
+
<a href="https://github.com/trycourier/courier-react-native/tree/master/example-085">
|
|
165
|
+
<code>Example (React Native 0.85+, New Architecture)</code>
|
|
166
166
|
</a>
|
|
167
167
|
</td>
|
|
168
168
|
</tr>
|
package/android/build.gradle
CHANGED
|
@@ -21,13 +21,16 @@ def isNewArchitectureEnabled() {
|
|
|
21
21
|
apply plugin: "com.android.library"
|
|
22
22
|
apply plugin: "kotlin-android"
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
26
25
|
|
|
27
26
|
if (isNewArchitectureEnabled()) {
|
|
28
27
|
apply plugin: "com.facebook.react"
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
def safeExtGet(prop, fallback) {
|
|
31
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
32
|
+
}
|
|
33
|
+
|
|
31
34
|
def getExtOrDefault(name) {
|
|
32
35
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["CourierReactNative_" + name]
|
|
33
36
|
}
|
|
@@ -61,15 +64,15 @@ android {
|
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
67
|
+
compileSdkVersion safeExtGet("compileSdkVersion", getExtOrIntegerDefault("compileSdkVersion"))
|
|
65
68
|
|
|
66
69
|
buildFeatures {
|
|
67
70
|
buildConfig true
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
defaultConfig {
|
|
71
|
-
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
72
|
-
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
74
|
+
minSdkVersion safeExtGet("minSdkVersion", getExtOrIntegerDefault("minSdkVersion"))
|
|
75
|
+
targetSdkVersion safeExtGet("targetSdkVersion", getExtOrIntegerDefault("targetSdkVersion"))
|
|
73
76
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
74
77
|
}
|
|
75
78
|
|
|
@@ -100,10 +103,8 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
100
103
|
|
|
101
104
|
dependencies {
|
|
102
105
|
|
|
103
|
-
// For < 0.71, this will be from the local maven repo
|
|
104
|
-
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
105
106
|
//noinspection GradleDynamicVersion
|
|
106
|
-
implementation "com.facebook.react:react-android
|
|
107
|
+
implementation "com.facebook.react:react-android:+"
|
|
107
108
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
108
109
|
|
|
109
110
|
// For converting to json
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
CourierReactNative_kotlinVersion=1.
|
|
2
|
-
CourierReactNative_minSdkVersion=
|
|
3
|
-
CourierReactNative_targetSdkVersion=
|
|
4
|
-
CourierReactNative_compileSdkVersion=
|
|
5
|
-
CourierReactNative_ndkversion=
|
|
1
|
+
CourierReactNative_kotlinVersion=1.9.24
|
|
2
|
+
CourierReactNative_minSdkVersion=24
|
|
3
|
+
CourierReactNative_targetSdkVersion=34
|
|
4
|
+
CourierReactNative_compileSdkVersion=34
|
|
5
|
+
CourierReactNative_ndkversion=26.1.10909125
|
|
@@ -77,11 +77,7 @@ class CourierClientModule(
|
|
|
77
77
|
return@launch
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
promise.rejectMissingContext()
|
|
82
|
-
return@launch
|
|
83
|
-
}
|
|
84
|
-
|
|
80
|
+
val context = reactApplicationContext
|
|
85
81
|
val courierDevice = device?.let {
|
|
86
82
|
CourierDevice(
|
|
87
83
|
appId = it.getString("appId"),
|
|
@@ -97,7 +93,7 @@ class CourierClientModule(
|
|
|
97
93
|
client.tokens.putUserToken(
|
|
98
94
|
token = token,
|
|
99
95
|
provider = provider,
|
|
100
|
-
device = courierDevice ?: CourierDevice.current(
|
|
96
|
+
device = courierDevice ?: CourierDevice.current(context)
|
|
101
97
|
)
|
|
102
98
|
promise.resolve(null)
|
|
103
99
|
} catch (e: Exception) {
|
|
@@ -43,8 +43,8 @@ class CourierPreferencesViewManager : SimpleViewManager<CourierPreferences>() {
|
|
|
43
43
|
|
|
44
44
|
override fun createViewInstance(reactContext: ThemedReactContext): CourierPreferences {
|
|
45
45
|
themedReactContext = reactContext
|
|
46
|
-
val
|
|
47
|
-
return CourierReactNativePreferencesView(
|
|
46
|
+
val context = (reactContext.currentActivity as? FragmentActivity) ?: reactContext
|
|
47
|
+
return CourierReactNativePreferencesView(context)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
@ReactProp(name = "onScrollPreferences")
|
|
@@ -22,7 +22,6 @@ class CourierSystemModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
22
22
|
|
|
23
23
|
init {
|
|
24
24
|
|
|
25
|
-
// Listen to push notification events
|
|
26
25
|
Courier.shared.onPushNotificationEvent { event ->
|
|
27
26
|
when (event.trackingEvent) {
|
|
28
27
|
CLICKED -> postPushNotificationJavascriptEvent(CourierEvents.Push.CLICKED_EVENT, event.remoteMessage)
|
|
@@ -45,8 +44,8 @@ class CourierSystemModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
45
44
|
|
|
46
45
|
@ReactMethod
|
|
47
46
|
fun registerPushNotificationClickedOnKilledState() {
|
|
48
|
-
|
|
49
|
-
checkIntentForPushNotificationClick(
|
|
47
|
+
activity?.let { act ->
|
|
48
|
+
checkIntentForPushNotificationClick(act.intent)
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -66,8 +65,8 @@ class CourierSystemModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
66
65
|
@ReactMethod
|
|
67
66
|
fun requestNotificationPermission(promise: Promise) {
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
Courier.shared.requestNotificationPermission(
|
|
68
|
+
activity?.let { act ->
|
|
69
|
+
Courier.shared.requestNotificationPermission(act)
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
promise.resolve("unknown")
|
|
@@ -77,9 +76,9 @@ class CourierSystemModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
77
76
|
@ReactMethod
|
|
78
77
|
fun getNotificationPermissionStatus(promise: Promise) {
|
|
79
78
|
|
|
80
|
-
|
|
79
|
+
activity?.let { act ->
|
|
81
80
|
|
|
82
|
-
val isGranted = Courier.shared.isPushPermissionGranted(
|
|
81
|
+
val isGranted = Courier.shared.isPushPermissionGranted(act)
|
|
83
82
|
val status = if (isGranted) "authorized" else "denied"
|
|
84
83
|
promise.resolve(status)
|
|
85
84
|
return
|
|
@@ -92,7 +91,6 @@ class CourierSystemModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
92
91
|
|
|
93
92
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
94
93
|
fun openSettingsForApp(): String? {
|
|
95
|
-
// TODO: Move this to the native package in the future
|
|
96
94
|
val context = reactApplicationContext
|
|
97
95
|
try {
|
|
98
96
|
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
package com.courierreactnative
|
|
2
2
|
|
|
3
|
+
import android.app.Activity
|
|
3
4
|
import com.courier.android.Courier
|
|
4
|
-
import com.facebook.react.ReactActivity
|
|
5
5
|
import com.facebook.react.bridge.Promise
|
|
6
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
7
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
@@ -10,14 +10,10 @@ abstract class ReactNativeModule(val tag: String, private val name: String, reac
|
|
|
10
10
|
|
|
11
11
|
override fun getName() = name
|
|
12
12
|
|
|
13
|
-
val
|
|
13
|
+
val activity: Activity? get() = reactApplicationContext.currentActivity
|
|
14
14
|
|
|
15
15
|
init {
|
|
16
|
-
|
|
17
|
-
// User Agent is used to ensure we know the SDK
|
|
18
|
-
// the requests come from
|
|
19
16
|
Courier.agent = Utils.COURIER_AGENT
|
|
20
|
-
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
internal fun Promise.rejectMissingContext() {
|
|
@@ -15,7 +15,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
15
15
|
import com.google.gson.GsonBuilder
|
|
16
16
|
|
|
17
17
|
internal object Utils {
|
|
18
|
-
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "5.
|
|
18
|
+
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "5.8.0")
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
internal fun ReactContext.sendEvent(eventName: String, value: Any?) {
|
|
@@ -33,7 +33,7 @@ static NSString *const CourierForegroundOptionsDidChangeNotification = @"iosFore
|
|
|
33
33
|
if (self) {
|
|
34
34
|
|
|
35
35
|
// Set the user agent
|
|
36
|
-
Courier.agent = [CourierAgent reactNativeIOS:@"5.
|
|
36
|
+
Courier.agent = [CourierAgent reactNativeIOS:@"5.8.0"];
|
|
37
37
|
|
|
38
38
|
// Register for remote notifications
|
|
39
39
|
UIApplication *app = [UIApplication sharedApplication];
|
|
@@ -14,7 +14,7 @@ internal class CourierReactNativeEventEmitter: RCTEventEmitter {
|
|
|
14
14
|
|
|
15
15
|
// Set the user agent
|
|
16
16
|
// Used to know the platform performing requests
|
|
17
|
-
Courier.agent = CourierAgent.reactNativeIOS("5.
|
|
17
|
+
Courier.agent = CourierAgent.reactNativeIOS("5.8.0")
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
|
package/lib/commonjs/Modules.js
CHANGED
|
@@ -10,11 +10,12 @@ class Modules {
|
|
|
10
10
|
ios: "- You have run 'pod install'\n",
|
|
11
11
|
default: ''
|
|
12
12
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
13
|
-
static Client = Modules.getNativeModule(_reactNative.NativeModules.CourierClientModule);
|
|
14
|
-
static Shared = Modules.getNativeModule(_reactNative.NativeModules.CourierSharedModule);
|
|
15
|
-
static System = Modules.getNativeModule(_reactNative.NativeModules.CourierSystemModule);
|
|
16
|
-
static getNativeModule(
|
|
17
|
-
|
|
13
|
+
static Client = Modules.getNativeModule('CourierClientModule', _reactNative.NativeModules.CourierClientModule);
|
|
14
|
+
static Shared = Modules.getNativeModule('CourierSharedModule', _reactNative.NativeModules.CourierSharedModule);
|
|
15
|
+
static System = Modules.getNativeModule('CourierSystemModule', _reactNative.NativeModules.CourierSystemModule);
|
|
16
|
+
static getNativeModule(moduleName, bridgeModule) {
|
|
17
|
+
const resolved = (_reactNative.TurboModuleRegistry === null || _reactNative.TurboModuleRegistry === void 0 ? void 0 : _reactNative.TurboModuleRegistry.get(moduleName)) ?? bridgeModule ?? undefined;
|
|
18
|
+
return resolved ? resolved : new Proxy({}, {
|
|
18
19
|
get() {
|
|
19
20
|
throw new Error(Modules.LINKING_ERROR);
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","Modules","LINKING_ERROR","Platform","select","ios","default","Client","getNativeModule","NativeModules","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","Modules","LINKING_ERROR","Platform","select","ios","default","Client","getNativeModule","NativeModules","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","moduleName","bridgeModule","resolved","TurboModuleRegistry","get","undefined","Proxy","Error","getNativeComponent","componentName","UIManager","getViewManagerConfig","requireNativeComponent","exports"],"sourceRoot":"../../src","sources":["Modules.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQO,MAAMC,OAAO,CAAC;EACnB,OAAgBC,aAAa,GAC3B,2FAA2F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;IAAEC,GAAG,EAAE,gCAAgC;IAAEC,OAAO,EAAE;EAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;EAEjC,OAAgBC,MAAM,GAAGN,OAAO,CAACO,eAAe,CAC9C,qBAAqB,EACrBC,0BAAa,CAACC,mBAChB,CAAC;EACD,OAAgBC,MAAM,GAAGV,OAAO,CAACO,eAAe,CAC9C,qBAAqB,EACrBC,0BAAa,CAACG,mBAChB,CAAC;EACD,OAAgBC,MAAM,GAAGZ,OAAO,CAACO,eAAe,CAC9C,qBAAqB,EACrBC,0BAAa,CAACK,mBAChB,CAAC;EAED,OAAON,eAAeA,CACpBO,UAAkB,EAClBC,YAA2B,EACxB;IACH,MAAMC,QAAQ,GACZ,CAACC,gCAAmB,aAAnBA,gCAAmB,uBAAnBA,gCAAmB,CAAEC,GAAG,CAACJ,UAAU,CAAC,KACrCC,YAAY,IACZI,SAAS;IACX,OAAOH,QAAQ,GACXA,QAAQ,GACP,IAAII,KAAK,CACR,CAAC,CAAC,EACF;MACEF,GAAGA,CAAA,EAAG;QACJ,MAAM,IAAIG,KAAK,CAACrB,OAAO,CAACC,aAAa,CAAC;MACxC;IACF,CACF,CAAO;EACb;EAEA,OAAOqB,kBAAkBA,CAACC,aAAqB,EAAE;IAC/C,OAAOC,sBAAS,CAACC,oBAAoB,CAACF,aAAa,CAAC,IAAI,IAAI,GACxD,IAAAG,mCAAsB,EAAMH,aAAa,CAAC,GAC1C,MAAM;MACJ,MAAM,IAAIF,KAAK,CAACrB,OAAO,CAACC,aAAa,CAAC;IACxC,CAAC;EACP;AACF;AAAC0B,OAAA,CAAA3B,OAAA,GAAAA,OAAA","ignoreList":[]}
|
package/lib/module/Modules.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { NativeModules, Platform, UIManager, requireNativeComponent } from 'react-native';
|
|
1
|
+
import { NativeModules, Platform, UIManager, TurboModuleRegistry, requireNativeComponent } from 'react-native';
|
|
2
2
|
export class Modules {
|
|
3
3
|
static LINKING_ERROR = `The package '@trycourier/courier-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
4
4
|
ios: "- You have run 'pod install'\n",
|
|
5
5
|
default: ''
|
|
6
6
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
7
|
-
static Client = Modules.getNativeModule(NativeModules.CourierClientModule);
|
|
8
|
-
static Shared = Modules.getNativeModule(NativeModules.CourierSharedModule);
|
|
9
|
-
static System = Modules.getNativeModule(NativeModules.CourierSystemModule);
|
|
10
|
-
static getNativeModule(
|
|
11
|
-
|
|
7
|
+
static Client = Modules.getNativeModule('CourierClientModule', NativeModules.CourierClientModule);
|
|
8
|
+
static Shared = Modules.getNativeModule('CourierSharedModule', NativeModules.CourierSharedModule);
|
|
9
|
+
static System = Modules.getNativeModule('CourierSystemModule', NativeModules.CourierSystemModule);
|
|
10
|
+
static getNativeModule(moduleName, bridgeModule) {
|
|
11
|
+
const resolved = (TurboModuleRegistry === null || TurboModuleRegistry === void 0 ? void 0 : TurboModuleRegistry.get(moduleName)) ?? bridgeModule ?? undefined;
|
|
12
|
+
return resolved ? resolved : new Proxy({}, {
|
|
12
13
|
get() {
|
|
13
14
|
throw new Error(Modules.LINKING_ERROR);
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","UIManager","requireNativeComponent","Modules","LINKING_ERROR","select","ios","default","Client","getNativeModule","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","UIManager","TurboModuleRegistry","requireNativeComponent","Modules","LINKING_ERROR","select","ios","default","Client","getNativeModule","CourierClientModule","Shared","CourierSharedModule","System","CourierSystemModule","moduleName","bridgeModule","resolved","get","undefined","Proxy","Error","getNativeComponent","componentName","getViewManagerConfig"],"sourceRoot":"../../src","sources":["Modules.tsx"],"mappings":"AAAA,SACEA,aAAa,EACbC,QAAQ,EACRC,SAAS,EACTC,mBAAmB,EACnBC,sBAAsB,QACjB,cAAc;AAErB,OAAO,MAAMC,OAAO,CAAC;EACnB,OAAgBC,aAAa,GAC3B,2FAA2F,GAC3FL,QAAQ,CAACM,MAAM,CAAC;IAAEC,GAAG,EAAE,gCAAgC;IAAEC,OAAO,EAAE;EAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;EAEjC,OAAgBC,MAAM,GAAGL,OAAO,CAACM,eAAe,CAC9C,qBAAqB,EACrBX,aAAa,CAACY,mBAChB,CAAC;EACD,OAAgBC,MAAM,GAAGR,OAAO,CAACM,eAAe,CAC9C,qBAAqB,EACrBX,aAAa,CAACc,mBAChB,CAAC;EACD,OAAgBC,MAAM,GAAGV,OAAO,CAACM,eAAe,CAC9C,qBAAqB,EACrBX,aAAa,CAACgB,mBAChB,CAAC;EAED,OAAOL,eAAeA,CACpBM,UAAkB,EAClBC,YAA2B,EACxB;IACH,MAAMC,QAAQ,GACZ,CAAChB,mBAAmB,aAAnBA,mBAAmB,uBAAnBA,mBAAmB,CAAEiB,GAAG,CAACH,UAAU,CAAC,KACrCC,YAAY,IACZG,SAAS;IACX,OAAOF,QAAQ,GACXA,QAAQ,GACP,IAAIG,KAAK,CACR,CAAC,CAAC,EACF;MACEF,GAAGA,CAAA,EAAG;QACJ,MAAM,IAAIG,KAAK,CAAClB,OAAO,CAACC,aAAa,CAAC;MACxC;IACF,CACF,CAAO;EACb;EAEA,OAAOkB,kBAAkBA,CAACC,aAAqB,EAAE;IAC/C,OAAOvB,SAAS,CAACwB,oBAAoB,CAACD,aAAa,CAAC,IAAI,IAAI,GACxDrB,sBAAsB,CAAMqB,aAAa,CAAC,GAC1C,MAAM;MACJ,MAAM,IAAIF,KAAK,CAAClB,OAAO,CAACC,aAAa,CAAC;IACxC,CAAC;EACP;AACF","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ export declare class Modules {
|
|
|
3
3
|
static readonly Client: any;
|
|
4
4
|
static readonly Shared: any;
|
|
5
5
|
static readonly System: any;
|
|
6
|
-
static getNativeModule<T>(
|
|
6
|
+
static getNativeModule<T>(moduleName: string, bridgeModule: T | undefined): T;
|
|
7
7
|
static getNativeComponent(componentName: string): import("react-native").HostComponent<any> | (() => never);
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=Modules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modules.d.ts","sourceRoot":"","sources":["../../../src/Modules.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modules.d.ts","sourceRoot":"","sources":["../../../src/Modules.tsx"],"names":[],"mappings":"AAQA,qBAAa,OAAO;IAClB,MAAM,CAAC,QAAQ,CAAC,aAAa,SAIK;IAElC,MAAM,CAAC,QAAQ,CAAC,MAAM,MAGpB;IACF,MAAM,CAAC,QAAQ,CAAC,MAAM,MAGpB;IACF,MAAM,CAAC,QAAQ,CAAC,MAAM,MAGpB;IAEF,MAAM,CAAC,eAAe,CAAC,CAAC,EACtB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,CAAC,GAAG,SAAS,GAC1B,CAAC;IAiBJ,MAAM,CAAC,kBAAkB,CAAC,aAAa,EAAE,MAAM;CAOhD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/courier-react-native",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Inbox, Push Notifications, and Preferences for React Native",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"ios",
|
|
15
15
|
"cpp",
|
|
16
16
|
"*.podspec",
|
|
17
|
-
"!lib/typescript/example",
|
|
17
|
+
"!lib/typescript/example-073",
|
|
18
|
+
"!lib/typescript/example-085",
|
|
18
19
|
"!ios/build",
|
|
19
20
|
"!android/build",
|
|
20
21
|
"!android/gradle",
|
|
@@ -32,11 +33,12 @@
|
|
|
32
33
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
34
|
"prepack": "bob build",
|
|
34
35
|
"release": "release-it",
|
|
35
|
-
"example": "yarn --cwd example",
|
|
36
|
-
"
|
|
37
|
-
"build:
|
|
36
|
+
"example": "yarn --cwd example-085",
|
|
37
|
+
"example-073": "yarn --cwd example-073",
|
|
38
|
+
"build:android": "cd example-085/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
|
|
39
|
+
"build:ios": "cd example-085/ios && xcodebuild -workspace CourierReactNativeExample.xcworkspace -scheme CourierReactNativeExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
|
|
38
40
|
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
39
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
|
|
41
|
+
"clean": "del-cli android/build example-085/android/build example-085/android/app/build example-085/ios/build",
|
|
40
42
|
"linkPackage": "yarn link && yarn example link @trycourier/courier-react-native && yarn example setupEnv",
|
|
41
43
|
"setup": "sh setup.sh"
|
|
42
44
|
},
|
|
@@ -96,7 +98,9 @@
|
|
|
96
98
|
"jest": {
|
|
97
99
|
"preset": "react-native",
|
|
98
100
|
"modulePathIgnorePatterns": [
|
|
99
|
-
"<rootDir>/example/node_modules",
|
|
101
|
+
"<rootDir>/example-085/node_modules",
|
|
102
|
+
"<rootDir>/example-073/node_modules",
|
|
103
|
+
"<rootDir>/example-expo-55/node_modules",
|
|
100
104
|
"<rootDir>/lib/"
|
|
101
105
|
]
|
|
102
106
|
},
|
|
@@ -144,7 +148,8 @@
|
|
|
144
148
|
},
|
|
145
149
|
"eslintIgnore": [
|
|
146
150
|
"node_modules/",
|
|
147
|
-
"lib/"
|
|
151
|
+
"lib/",
|
|
152
|
+
"example-expo-55/"
|
|
148
153
|
],
|
|
149
154
|
"prettier": {
|
|
150
155
|
"quoteProps": "consistent",
|
package/src/Modules.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
NativeModules,
|
|
3
3
|
Platform,
|
|
4
4
|
UIManager,
|
|
5
|
+
TurboModuleRegistry,
|
|
5
6
|
requireNativeComponent,
|
|
6
7
|
} from 'react-native';
|
|
7
8
|
|
|
@@ -13,18 +14,28 @@ export class Modules {
|
|
|
13
14
|
'- You are not using Expo Go\n';
|
|
14
15
|
|
|
15
16
|
static readonly Client = Modules.getNativeModule(
|
|
17
|
+
'CourierClientModule',
|
|
16
18
|
NativeModules.CourierClientModule
|
|
17
19
|
);
|
|
18
20
|
static readonly Shared = Modules.getNativeModule(
|
|
21
|
+
'CourierSharedModule',
|
|
19
22
|
NativeModules.CourierSharedModule
|
|
20
23
|
);
|
|
21
24
|
static readonly System = Modules.getNativeModule(
|
|
25
|
+
'CourierSystemModule',
|
|
22
26
|
NativeModules.CourierSystemModule
|
|
23
27
|
);
|
|
24
28
|
|
|
25
|
-
static getNativeModule<T>(
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
static getNativeModule<T>(
|
|
30
|
+
moduleName: string,
|
|
31
|
+
bridgeModule: T | undefined
|
|
32
|
+
): T {
|
|
33
|
+
const resolved =
|
|
34
|
+
(TurboModuleRegistry?.get(moduleName) as T | null) ??
|
|
35
|
+
bridgeModule ??
|
|
36
|
+
undefined;
|
|
37
|
+
return resolved
|
|
38
|
+
? resolved
|
|
28
39
|
: (new Proxy(
|
|
29
40
|
{},
|
|
30
41
|
{
|