@trycourier/courier-react-native 2.0.0-beta1 → 2.0.0-beta2
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/ios/CourierReactNative-Bridging-Header.h +1 -0
- package/ios/CourierReactNative.xcodeproj/project.pbxproj +5 -3
- package/ios/CourierReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/CourierReactNative.xcodeproj/project.xcworkspace/xcuserdata/mike.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/CourierReactNative.xcodeproj/xcuserdata/mike.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/CourierReactNativeDelegate.h +18 -0
- package/ios/CourierReactNativeDelegate.m +125 -0
- package/ios/CourierReactNativeModule.m +13 -0
- package/ios/CourierReactNativeModule.swift +26 -0
- package/ios/CourierReactNativeViewManager.swift +10 -1
- package/lib/commonjs/index.js +32 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +32 -11
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +15 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +33 -12
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
-
|
|
11
|
-
F4FF95D7245B92E800C19C63 /* CourierReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* CourierReactNative.swift */; };
|
|
10
|
+
F4FF95D7245B92E800C19C63 /* CourierReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* CourierReactNative.swift */; };
|
|
12
11
|
/* End PBXBuildFile section */
|
|
13
12
|
|
|
14
13
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -25,6 +24,8 @@
|
|
|
25
24
|
|
|
26
25
|
/* Begin PBXFileReference section */
|
|
27
26
|
134814201AA4EA6300B7C361 /* libCourierReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCourierReactNative.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
27
|
+
27960AF02A9E722F0076CE04 /* CourierReactNativeDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourierReactNativeDelegate.h; sourceTree = "<group>"; };
|
|
28
|
+
27960AF12A9E722F0076CE04 /* CourierReactNativeDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CourierReactNativeDelegate.m; sourceTree = "<group>"; };
|
|
28
29
|
B3E7B5891CC2AC0600A0062D /* CourierReactNative.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CourierReactNative.mm; sourceTree = "<group>"; };
|
|
29
30
|
F4FF95D5245B92E700C19C63 /* CourierReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CourierReactNative-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
30
31
|
F4FF95D6245B92E800C19C63 /* CourierReactNative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourierReactNative.swift; sourceTree = "<group>"; };
|
|
@@ -52,6 +53,8 @@
|
|
|
52
53
|
58B511D21A9E6C8500147676 = {
|
|
53
54
|
isa = PBXGroup;
|
|
54
55
|
children = (
|
|
56
|
+
27960AF02A9E722F0076CE04 /* CourierReactNativeDelegate.h */,
|
|
57
|
+
27960AF12A9E722F0076CE04 /* CourierReactNativeDelegate.m */,
|
|
55
58
|
F4FF95D6245B92E800C19C63 /* CourierReactNative.swift */,
|
|
56
59
|
B3E7B5891CC2AC0600A0062D /* CourierReactNative.mm */,
|
|
57
60
|
F4FF95D5245B92E700C19C63 /* CourierReactNative-Bridging-Header.h */,
|
|
@@ -117,7 +120,6 @@
|
|
|
117
120
|
buildActionMask = 2147483647;
|
|
118
121
|
files = (
|
|
119
122
|
F4FF95D7245B92E800C19C63 /* CourierReactNative.swift in Sources */,
|
|
120
|
-
B3E7B58A1CC2AC0600A0062D /* CourierReactNative.mm in Sources */,
|
|
121
123
|
);
|
|
122
124
|
runOnlyForDeploymentPostprocessing = 0;
|
|
123
125
|
};
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>CourierReactNative.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CourierReactNativeDelegate.h
|
|
3
|
+
// courier-react-native
|
|
4
|
+
//
|
|
5
|
+
// Created by Michael Miller on 8/29/23.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import "RCTAppDelegate.h"
|
|
9
|
+
#import <UIKit/UIKit.h>
|
|
10
|
+
#import <UserNotifications/UserNotifications.h>
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface CourierReactNativeDelegate : RCTAppDelegate<UNUserNotificationCenterDelegate>
|
|
15
|
+
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CourierReactNativeDelegate.m
|
|
3
|
+
// courier-react-native
|
|
4
|
+
//
|
|
5
|
+
// Created by Michael Miller on 10/7/22.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
@import Courier_iOS;
|
|
9
|
+
#import "CourierReactNativeDelegate.h"
|
|
10
|
+
#pragma GCC diagnostic ignored "-Wprotocol"
|
|
11
|
+
#pragma clang diagnostic ignored "-Wprotocol"
|
|
12
|
+
|
|
13
|
+
@implementation CourierReactNativeDelegate
|
|
14
|
+
|
|
15
|
+
NSString *iosForegroundNotificationPresentationOptions = @"iosForegroundNotificationPresentationOptions";
|
|
16
|
+
NSUInteger notificationPresentationOptions = UNNotificationPresentationOptionNone;
|
|
17
|
+
|
|
18
|
+
- (id) init {
|
|
19
|
+
|
|
20
|
+
self = [super init];
|
|
21
|
+
|
|
22
|
+
if (self) {
|
|
23
|
+
|
|
24
|
+
// Register for remote notifications
|
|
25
|
+
UIApplication *app = [UIApplication sharedApplication];
|
|
26
|
+
[app registerForRemoteNotifications];
|
|
27
|
+
|
|
28
|
+
// Register notification center changes
|
|
29
|
+
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
|
|
30
|
+
center.delegate = self;
|
|
31
|
+
|
|
32
|
+
[[NSNotificationCenter defaultCenter]
|
|
33
|
+
addObserver:self
|
|
34
|
+
selector:@selector(notificationPresentationOptionsUpdate:)
|
|
35
|
+
name:iosForegroundNotificationPresentationOptions
|
|
36
|
+
object:nil
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return(self);
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (void) notificationPresentationOptionsUpdate:(NSNotification *) notification
|
|
46
|
+
{
|
|
47
|
+
if ([[notification name] isEqualToString:iosForegroundNotificationPresentationOptions])
|
|
48
|
+
{
|
|
49
|
+
NSDictionary *userInfo = notification.userInfo;
|
|
50
|
+
notificationPresentationOptions = ((NSNumber *) [userInfo objectForKey:@"options"]).unsignedIntegerValue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
|
|
55
|
+
{
|
|
56
|
+
|
|
57
|
+
UNNotificationContent *content = notification.request.content;
|
|
58
|
+
NSDictionary *message = content.userInfo;
|
|
59
|
+
|
|
60
|
+
[[Courier shared] trackNotificationWithMessage:message event:CourierPushEventDelivered completionHandler:^(NSError *error)
|
|
61
|
+
{
|
|
62
|
+
if (error != nil) {
|
|
63
|
+
[self log:error];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
NSDictionary *pushNotification = [Courier formatPushNotificationWithContent:content];
|
|
69
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"pushNotificationDelivered" object:nil userInfo:pushNotification];
|
|
70
|
+
|
|
71
|
+
completionHandler(notificationPresentationOptions);
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler
|
|
76
|
+
{
|
|
77
|
+
|
|
78
|
+
UNNotificationContent *content = response.notification.request.content;
|
|
79
|
+
NSDictionary *message = content.userInfo;
|
|
80
|
+
|
|
81
|
+
[[Courier shared] trackNotificationWithMessage:message event:CourierPushEventClicked completionHandler:^(NSError *error)
|
|
82
|
+
{
|
|
83
|
+
if (error != nil) {
|
|
84
|
+
[self log:error];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
NSDictionary *pushNotification = [Courier formatPushNotificationWithContent:content];
|
|
90
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"pushNotificationClicked" object:nil userInfo:pushNotification];
|
|
91
|
+
|
|
92
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
93
|
+
completionHandler();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
|
|
99
|
+
{
|
|
100
|
+
[self log:error];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
|
|
104
|
+
{
|
|
105
|
+
|
|
106
|
+
[[Courier shared]
|
|
107
|
+
setAPNSToken:deviceToken
|
|
108
|
+
onSuccess:^()
|
|
109
|
+
{
|
|
110
|
+
// Empty
|
|
111
|
+
}
|
|
112
|
+
onFailure:^(NSError *error)
|
|
113
|
+
{
|
|
114
|
+
[self log:error];
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
- (void)log: (NSError*)error {
|
|
121
|
+
NSString *err = [NSString stringWithFormat:@"%@", error];
|
|
122
|
+
[Courier log:err];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@end
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(CourierReactNativeModule, NSObject)
|
|
4
4
|
|
|
5
|
+
RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(
|
|
6
|
+
setDebugMode: (BOOL*)isDebugging
|
|
7
|
+
)
|
|
8
|
+
|
|
5
9
|
RCT_EXTERN_METHOD(
|
|
6
10
|
signIn: (NSString*)accessToken
|
|
7
11
|
withClientKey: (NSString*)clientKey
|
|
@@ -50,4 +54,13 @@ RCT_EXTERN_METHOD(
|
|
|
50
54
|
withRejecter: (RCTPromiseRejectBlock)reject
|
|
51
55
|
)
|
|
52
56
|
|
|
57
|
+
RCT_EXTERN_METHOD(
|
|
58
|
+
fetchNextPageOfMessages: (RCTPromiseResolveBlock)resolve
|
|
59
|
+
withRejecter: (RCTPromiseRejectBlock)reject
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(
|
|
63
|
+
setInboxPaginationLimit: (nonnull NSNumber*)limit
|
|
64
|
+
)
|
|
65
|
+
|
|
53
66
|
@end
|
|
@@ -37,6 +37,12 @@ class CourierReactNativeModule: RCTEventEmitter {
|
|
|
37
37
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
@objc(setDebugMode:)
|
|
41
|
+
func setDebugMode(isDebugging: Bool) -> String {
|
|
42
|
+
Courier.shared.isDebugging = isDebugging
|
|
43
|
+
return String(describing: Courier.shared.isDebugging)
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
override func startObserving() {
|
|
41
47
|
|
|
42
48
|
hasListeners = true
|
|
@@ -366,6 +372,26 @@ class CourierReactNativeModule: RCTEventEmitter {
|
|
|
366
372
|
return id
|
|
367
373
|
|
|
368
374
|
}
|
|
375
|
+
|
|
376
|
+
@objc(fetchNextPageOfMessages: withRejecter:)
|
|
377
|
+
func fetchNextPageOfMessages(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
378
|
+
|
|
379
|
+
Courier.shared.fetchNextPageOfMessages(
|
|
380
|
+
onSuccess: { messages in
|
|
381
|
+
resolve(messages.map { $0.toDictionary() })
|
|
382
|
+
},
|
|
383
|
+
onFailure: { error in
|
|
384
|
+
reject(String(describing: error), CourierReactNativeModule.COURIER_ERROR_TAG, nil)
|
|
385
|
+
}
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
@objc(setInboxPaginationLimit:)
|
|
391
|
+
func setInboxPaginationLimit(limit: NSNumber) -> String {
|
|
392
|
+
Courier.shared.inboxPaginationLimit = limit.intValue
|
|
393
|
+
return String(describing: limit.intValue)
|
|
394
|
+
}
|
|
369
395
|
|
|
370
396
|
override func supportedEvents() -> [String]! {
|
|
371
397
|
return [
|
|
@@ -45,7 +45,13 @@ class CourierReactNativeView : UIView {
|
|
|
45
45
|
|
|
46
46
|
private func refreshInbox() {
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
// Disable animations
|
|
49
|
+
UIView.setAnimationsEnabled(false)
|
|
50
|
+
|
|
51
|
+
// Remove all previous views
|
|
52
|
+
subviews.forEach {
|
|
53
|
+
$0.removeFromSuperview()
|
|
54
|
+
}
|
|
49
55
|
|
|
50
56
|
// Create the view
|
|
51
57
|
let courierInbox = CourierInbox(
|
|
@@ -86,6 +92,9 @@ class CourierReactNativeView : UIView {
|
|
|
86
92
|
courierInbox.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
87
93
|
])
|
|
88
94
|
|
|
95
|
+
// Enable animations
|
|
96
|
+
UIView.setAnimationsEnabled(true)
|
|
97
|
+
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
func dictionaryToTheme(dictionary: NSDictionary?) -> CourierInboxTheme? {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -40,15 +40,17 @@ class Courier {
|
|
|
40
40
|
return this._sharedInstance;
|
|
41
41
|
}
|
|
42
42
|
async setDefaults() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
43
|
+
this.setIsDebugging(__DEV__);
|
|
44
|
+
// try {
|
|
45
|
+
// await Promise.all([
|
|
46
|
+
// this.setIsDebugging(__DEV__),
|
|
47
|
+
// // this.iOSForegroundPresentationOptions({
|
|
48
|
+
// // options: ['sound', 'badge', 'list', 'banner'],
|
|
49
|
+
// // }),
|
|
50
|
+
// ]);
|
|
51
|
+
// } catch (error) {
|
|
52
|
+
// console.log(error);
|
|
53
|
+
// }
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
/**
|
|
@@ -56,7 +58,7 @@ class Courier {
|
|
|
56
58
|
* Defaults to the React __DEV__ mode
|
|
57
59
|
* @example Courier.setIsDebugging(true)
|
|
58
60
|
*/
|
|
59
|
-
|
|
61
|
+
setIsDebugging(isDebugging) {
|
|
60
62
|
var _this$debugListener;
|
|
61
63
|
// Remove the existing listener if needed
|
|
62
64
|
(_this$debugListener = this.debugListener) === null || _this$debugListener === void 0 ? void 0 : _this$debugListener.remove();
|
|
@@ -68,7 +70,8 @@ class Courier {
|
|
|
68
70
|
console.log('\x1b[36m%s\x1b[0m', 'COURIER', event);
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
|
-
|
|
73
|
+
CourierReactNativeModules.setDebugMode(isDebugging);
|
|
74
|
+
this._isDebugging = isDebugging;
|
|
72
75
|
return this._isDebugging;
|
|
73
76
|
}
|
|
74
77
|
get isDebugging() {
|
|
@@ -174,6 +177,24 @@ class Courier {
|
|
|
174
177
|
async refreshInbox() {
|
|
175
178
|
return CourierReactNativeModules.refreshInbox();
|
|
176
179
|
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* TODO
|
|
183
|
+
* @param props
|
|
184
|
+
* @returns
|
|
185
|
+
*/
|
|
186
|
+
async fetchNextPageOfMessages() {
|
|
187
|
+
return CourierReactNativeModules.fetchNextPageOfMessages();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* TODO
|
|
192
|
+
* @param props
|
|
193
|
+
* @returns
|
|
194
|
+
*/
|
|
195
|
+
setInboxPaginationLimit(props) {
|
|
196
|
+
CourierReactNativeModules.setInboxPaginationLimit(props.limit);
|
|
197
|
+
}
|
|
177
198
|
}
|
|
178
199
|
var _default = Courier;
|
|
179
200
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_CourierInboxListener","_CourierInboxView","LINKING_ERROR","Platform","select","ios","default","CourierReactNativeModules","NativeModules","CourierReactNativeModule","Proxy","get","Error","CourierEventEmitter","NativeEventEmitter","Courier","_isDebugging","constructor","setDefaults","shared","_sharedInstance","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_CourierInboxListener","_CourierInboxView","LINKING_ERROR","Platform","select","ios","default","CourierReactNativeModules","NativeModules","CourierReactNativeModule","Proxy","get","Error","CourierEventEmitter","NativeEventEmitter","Courier","_isDebugging","constructor","setDefaults","shared","_sharedInstance","setIsDebugging","__DEV__","isDebugging","_this$debugListener","debugListener","remove","addListener","event","console","log","setDebugMode","userId","getUserId","signIn","props","accessToken","clientKey","readMessage","messageId","unreadMessage","readAllInboxMessages","addInboxListener","inboxListener","CourierInboxListener","onInitialLoad","onError","onMessagesChanged","messages","unreadMessageCount","totalMessageCount","canPaginate","listenerId","removeInboxListener","refreshInbox","fetchNextPageOfMessages","setInboxPaginationLimit","limit","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,qBAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,MAAMG,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,yBAAyB,GAAGC,0BAAa,CAACC,wBAAwB,GACpED,0BAAa,CAACC,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMW,mBAAmB,GAAG,IAAIC,+BAAkB,CAChDN,0BAAa,CAACC,wBAChB,CAAC;AAED,MAAMM,OAAO,CAAC;EAGJC,YAAY,GAAG,KAAK;EAGrBC,WAAWA,CAAA,EAAG;IAEnB;IACA;IACA;IACA,IAAI,CAACC,WAAW,CAAC,CAAC;EACpB;;EAEA;EACA,WAAkBC,MAAMA,CAAA,EAAY;IAElC,IAAI,CAAC,IAAI,CAACC,eAAe,EAAE;MACzB,IAAI,CAACA,eAAe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ACA;AACA;EACSU,mBAAmBA,CAAClB,KAA6B,EAAU;IAChE,OAAO5B,yBAAyB,CAAC8C,mBAAmB,CAAClB,KAAK,CAACiB,UAAU,CAAC;EACxE;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAaE,YAAYA,CAAA,EAAkB;IACzC,OAAO/C,yBAAyB,CAAC+C,YAAY,CAAC,CAAC;EACjD;;EAEA;AACF;AACA;AACA;AACA;EACG,MAAaC,uBAAuBA,CAAA,EAA4B;IAC/D,OAAOhD,yBAAyB,CAACgD,uBAAuB,CAAC,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;EACUC,uBAAuBA,CAACrB,KAAwB,EAAQ;IAC9D5B,yBAAyB,CAACiD,uBAAuB,CAACrB,KAAK,CAACsB,KAAK,CAAC;EAChE;AAEF;AAAC,IAAAC,QAAA,GAEc3C,OAAO;AAAA4C,OAAA,CAAArD,OAAA,GAAAoD,QAAA"}
|
package/lib/module/index.js
CHANGED
|
@@ -28,15 +28,17 @@ class Courier {
|
|
|
28
28
|
return this._sharedInstance;
|
|
29
29
|
}
|
|
30
30
|
async setDefaults() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
31
|
+
this.setIsDebugging(__DEV__);
|
|
32
|
+
// try {
|
|
33
|
+
// await Promise.all([
|
|
34
|
+
// this.setIsDebugging(__DEV__),
|
|
35
|
+
// // this.iOSForegroundPresentationOptions({
|
|
36
|
+
// // options: ['sound', 'badge', 'list', 'banner'],
|
|
37
|
+
// // }),
|
|
38
|
+
// ]);
|
|
39
|
+
// } catch (error) {
|
|
40
|
+
// console.log(error);
|
|
41
|
+
// }
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -44,7 +46,7 @@ class Courier {
|
|
|
44
46
|
* Defaults to the React __DEV__ mode
|
|
45
47
|
* @example Courier.setIsDebugging(true)
|
|
46
48
|
*/
|
|
47
|
-
|
|
49
|
+
setIsDebugging(isDebugging) {
|
|
48
50
|
var _this$debugListener;
|
|
49
51
|
// Remove the existing listener if needed
|
|
50
52
|
(_this$debugListener = this.debugListener) === null || _this$debugListener === void 0 ? void 0 : _this$debugListener.remove();
|
|
@@ -56,7 +58,8 @@ class Courier {
|
|
|
56
58
|
console.log('\x1b[36m%s\x1b[0m', 'COURIER', event);
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
CourierReactNativeModules.setDebugMode(isDebugging);
|
|
62
|
+
this._isDebugging = isDebugging;
|
|
60
63
|
return this._isDebugging;
|
|
61
64
|
}
|
|
62
65
|
get isDebugging() {
|
|
@@ -162,6 +165,24 @@ class Courier {
|
|
|
162
165
|
async refreshInbox() {
|
|
163
166
|
return CourierReactNativeModules.refreshInbox();
|
|
164
167
|
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* TODO
|
|
171
|
+
* @param props
|
|
172
|
+
* @returns
|
|
173
|
+
*/
|
|
174
|
+
async fetchNextPageOfMessages() {
|
|
175
|
+
return CourierReactNativeModules.fetchNextPageOfMessages();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* TODO
|
|
180
|
+
* @param props
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
183
|
+
setInboxPaginationLimit(props) {
|
|
184
|
+
CourierReactNativeModules.setInboxPaginationLimit(props.limit);
|
|
185
|
+
}
|
|
165
186
|
}
|
|
166
187
|
export default Courier;
|
|
167
188
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","CourierInboxListener","CourierInboxView","LINKING_ERROR","select","ios","default","CourierReactNativeModules","CourierReactNativeModule","Proxy","get","Error","CourierEventEmitter","Courier","_isDebugging","constructor","setDefaults","shared","_sharedInstance","
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","Platform","CourierInboxListener","CourierInboxView","LINKING_ERROR","select","ios","default","CourierReactNativeModules","CourierReactNativeModule","Proxy","get","Error","CourierEventEmitter","Courier","_isDebugging","constructor","setDefaults","shared","_sharedInstance","setIsDebugging","__DEV__","isDebugging","_this$debugListener","debugListener","remove","addListener","event","console","log","setDebugMode","userId","getUserId","signIn","props","accessToken","clientKey","readMessage","messageId","unreadMessage","readAllInboxMessages","addInboxListener","inboxListener","onInitialLoad","onError","onMessagesChanged","messages","unreadMessageCount","totalMessageCount","canPaginate","listenerId","removeInboxListener","refreshInbox","fetchNextPageOfMessages","setInboxPaginationLimit","limit"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,aAAa,EACbC,kBAAkB,EAElBC,QAAQ,QACH,cAAc;AAErB,SAASC,oBAAoB,QAAQ,+BAA+B;AAEpE,SAASC,gBAAgB,QAAQ,0BAA0B;AAE3D,MAAMC,aAAa,GAChB,2FAA0F,GAC3FH,QAAQ,CAACI,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,yBAAyB,GAAGT,aAAa,CAACU,wBAAwB,GACpEV,aAAa,CAACU,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMS,mBAAmB,GAAG,IAAIb,kBAAkB,CAChDD,aAAa,CAACU,wBAChB,CAAC;AAED,MAAMK,OAAO,CAAC;EAGJC,YAAY,GAAG,KAAK;EAGrBC,WAAWA,CAAA,EAAG;IAEnB;IACA;IACA;IACA,IAAI,CAACC,WAAW,CAAC,CAAC;EACpB;;EAEA;EACA,WAAkBC,MAAMA,CAAA,EAAY;IAElC,IAAI,CAAC,IAAI,CAACC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OAAOC,aAAa;EAEtB;;EAEA;AACF;AACA;AACA;AACA;EACSS,mBAAmBA,CAACjB,KAA6B,EAAU;IAChE,OAAO1B,yBAAyB,CAAC2C,mBAAmB,CAACjB,KAAK,CAACgB,UAAU,CAAC;EACxE;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAaE,YAAYA,CAAA,EAAkB;IACzC,OAAO5C,yBAAyB,CAAC4C,YAAY,CAAC,CAAC;EACjD;;EAEA;AACF;AACA;AACA;AACA;EACG,MAAaC,uBAAuBA,CAAA,EAA4B;IAC/D,OAAO7C,yBAAyB,CAAC6C,uBAAuB,CAAC,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;EACUC,uBAAuBA,CAACpB,KAAwB,EAAQ;IAC9D1B,yBAAyB,CAAC8C,uBAAuB,CAACpB,KAAK,CAACqB,KAAK,CAAC;EAChE;AAEF;AAEA,eAAezC,OAAO"}
|
|
@@ -13,7 +13,7 @@ declare class Courier {
|
|
|
13
13
|
* Defaults to the React __DEV__ mode
|
|
14
14
|
* @example Courier.setIsDebugging(true)
|
|
15
15
|
*/
|
|
16
|
-
setIsDebugging(isDebugging: boolean):
|
|
16
|
+
setIsDebugging(isDebugging: boolean): boolean;
|
|
17
17
|
get isDebugging(): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Returns the current user id stored in local native storage
|
|
@@ -87,6 +87,20 @@ declare class Courier {
|
|
|
87
87
|
* @returns
|
|
88
88
|
*/
|
|
89
89
|
refreshInbox(): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* TODO
|
|
92
|
+
* @param props
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
fetchNextPageOfMessages(): Promise<InboxMessage[]>;
|
|
96
|
+
/**
|
|
97
|
+
* TODO
|
|
98
|
+
* @param props
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
setInboxPaginationLimit(props: {
|
|
102
|
+
limit: number;
|
|
103
|
+
}): void;
|
|
90
104
|
}
|
|
91
105
|
export default Courier;
|
|
92
106
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAuB5D,cAAM,OAAO;IAEX,OAAO,CAAC,MAAM,CAAC,eAAe,CAAU;IACxC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAkC;;IAWvD,WAAkB,MAAM,IAAI,OAAO,CAQlC;YAEa,WAAW;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAuB5D,cAAM,OAAO;IAEX,OAAO,CAAC,MAAM,CAAC,eAAe,CAAU;IACxC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAkC;;IAWvD,WAAkB,MAAM,IAAI,OAAO,CAQlC;YAEa,WAAW;IAczB;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO;IAqBpD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAExC;IAED;;;;;;;;;;;;;;;OAeG;IACI,MAAM,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KA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
-
|
|
59
|
+
this.setIsDebugging(__DEV__);
|
|
60
|
+
// try {
|
|
61
|
+
// await Promise.all([
|
|
62
|
+
// this.setIsDebugging(__DEV__),
|
|
63
|
+
// // this.iOSForegroundPresentationOptions({
|
|
64
|
+
// // options: ['sound', 'badge', 'list', 'banner'],
|
|
65
|
+
// // }),
|
|
66
|
+
// ]);
|
|
67
|
+
// } catch (error) {
|
|
68
|
+
// console.log(error);
|
|
69
|
+
// }
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/**
|
|
@@ -73,7 +74,7 @@ class Courier {
|
|
|
73
74
|
* Defaults to the React __DEV__ mode
|
|
74
75
|
* @example Courier.setIsDebugging(true)
|
|
75
76
|
*/
|
|
76
|
-
public
|
|
77
|
+
public setIsDebugging(isDebugging: boolean): boolean {
|
|
77
78
|
|
|
78
79
|
// Remove the existing listener if needed
|
|
79
80
|
this.debugListener?.remove();
|
|
@@ -86,7 +87,9 @@ class Courier {
|
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
CourierReactNativeModules.setDebugMode(isDebugging);
|
|
91
|
+
|
|
92
|
+
this._isDebugging = isDebugging
|
|
90
93
|
|
|
91
94
|
return this._isDebugging;
|
|
92
95
|
|
|
@@ -207,6 +210,24 @@ class Courier {
|
|
|
207
210
|
public async refreshInbox(): Promise<void> {
|
|
208
211
|
return CourierReactNativeModules.refreshInbox();
|
|
209
212
|
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* TODO
|
|
216
|
+
* @param props
|
|
217
|
+
* @returns
|
|
218
|
+
*/
|
|
219
|
+
public async fetchNextPageOfMessages(): Promise<InboxMessage[]> {
|
|
220
|
+
return CourierReactNativeModules.fetchNextPageOfMessages();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* TODO
|
|
225
|
+
* @param props
|
|
226
|
+
* @returns
|
|
227
|
+
*/
|
|
228
|
+
public setInboxPaginationLimit(props: { limit: number }): void {
|
|
229
|
+
CourierReactNativeModules.setInboxPaginationLimit(props.limit);
|
|
230
|
+
}
|
|
210
231
|
|
|
211
232
|
}
|
|
212
233
|
|