@grouplinknetwork/rn-grouplink-sdk 2.3.12 → 2.5.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/android/build.gradle +8 -115
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/grouplinksdk/GrouplinkSdkModule.java +112 -92
- package/android/src/main/java/com/grouplinksdk/GrouplinkSdkPackage.java +30 -14
- package/grouplink-sdk.podspec +5 -3
- package/ios/GrouplinkSdk-Bridging-Header.h +2 -2
- package/ios/GrouplinkSdk.mm +180 -0
- package/ios/GrouplinkSdk.swift +18 -27
- package/ios/GrouplinkSdk.xcodeproj/project.pbxproj +27 -4
- package/lib/commonjs/NativeGrouplinkSdk.js +9 -0
- package/lib/commonjs/NativeGrouplinkSdk.js.map +1 -0
- package/lib/commonjs/index.js +69 -64
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeGrouplinkSdk.js +3 -0
- package/lib/module/NativeGrouplinkSdk.js.map +1 -0
- package/lib/module/index.js +64 -65
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/NativeGrouplinkSdk.d.ts +21 -0
- package/lib/typescript/NativeGrouplinkSdk.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +13 -8
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +10 -2
- package/src/NativeGrouplinkSdk.ts +25 -0
- package/src/index.tsx +88 -82
- package/ios/GrouplinkSdk.m +0 -19
- package/ios/GrouplinkSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/GrouplinkSdk.xcodeproj/project.xcworkspace/xcuserdata/alessandrodearaujo.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/GrouplinkSdk.xcodeproj/xcuserdata/alessandrodearaujo.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GrouplinkSdk.mm
|
|
3
|
+
*
|
|
4
|
+
* Implements the RNGroupLinkSDK TurboModule for both Old and New Architecture.
|
|
5
|
+
*
|
|
6
|
+
* Old Architecture: uses RCT_EXPORT_MODULE() + RCT_EXPORT_METHOD() macros.
|
|
7
|
+
* New Architecture: conforms to NativeGrouplinkSdkSpec (generated by Codegen
|
|
8
|
+
* from src/NativeGroupLinkSDK.ts) and exposes getTurboModule:.
|
|
9
|
+
*
|
|
10
|
+
* GroupLink SDK calls are routed through GrouplinkBridge (GrouplinkSdk.swift)
|
|
11
|
+
* because GroupLink.xcframework only exports Swift ABI symbols — direct ObjC++
|
|
12
|
+
*
|
|
13
|
+
* NOTE: Delete ios/GrouplinkSdk.m after adding this file — both cannot coexist.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
#import <React/RCTBridgeModule.h>
|
|
17
|
+
#import "grouplink_sdk-Swift.h"
|
|
18
|
+
|
|
19
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
20
|
+
// #import "GrouplinkSdkSpec/GrouplinkSdkSpec.h"
|
|
21
|
+
#import "GrouplinkSdkSpec.h"
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
// In-memory store for the iOS notification name.
|
|
25
|
+
// GroupLinkSDK only exposes a setter, not a getter, so we cache it locally.
|
|
26
|
+
static NSString *_iosNotificationName = @"";
|
|
27
|
+
|
|
28
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
29
|
+
|
|
30
|
+
@interface RNGroupLinkSDK : NSObject <NativeGrouplinkSdkSpec>
|
|
31
|
+
@end
|
|
32
|
+
|
|
33
|
+
@implementation RNGroupLinkSDK
|
|
34
|
+
|
|
35
|
+
RCT_EXPORT_MODULE(RNGroupLinkSDK)
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// iOS-only methods
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
- (void)startIOS:(NSString *)withToken {
|
|
42
|
+
[GrouplinkBridge startWithToken:withToken];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (void)setDevicePushToken:(NSString *)withPushToken {
|
|
46
|
+
[GrouplinkBridge setRemoteNotificationToken:withPushToken];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (void)startBluetoothIOS {
|
|
50
|
+
[GrouplinkBridge startBluetooth];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
- (void)checkBluetoothIOS {
|
|
54
|
+
[GrouplinkBridge checkBluetooth];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)startLocationIOS {
|
|
58
|
+
[GrouplinkBridge startLocation];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
- (void)setNotificationNameIOS:(NSString *)withNotificationName {
|
|
62
|
+
_iosNotificationName = withNotificationName;
|
|
63
|
+
[GrouplinkBridge setNotificationName:withNotificationName];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (void)getUserID:(RCTPromiseResolveBlock)resolve
|
|
67
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
68
|
+
NSString *userId = [GrouplinkBridge getUserID];
|
|
69
|
+
if (userId != nil) {
|
|
70
|
+
resolve(userId);
|
|
71
|
+
} else {
|
|
72
|
+
reject(@"NO_USER_ID", @"Could not get userID at this moment", nil);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- (void)getNotificationNameIOS:(RCTPromiseResolveBlock)resolve
|
|
77
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
78
|
+
resolve(_iosNotificationName);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Android-only methods — no-ops on iOS
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
- (void)getUserIdAndroid:(RCTPromiseResolveBlock)resolve
|
|
86
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
87
|
+
reject(@"unsupported", @"getUserIdAndroid is Android only", nil);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (void)startAndroid:(NSString *)token debbugable:(BOOL)debbugable {}
|
|
91
|
+
|
|
92
|
+
- (void)setFirebaseToken:(NSString *)token {}
|
|
93
|
+
|
|
94
|
+
- (void)requestFullIntentPermissionAndroid {}
|
|
95
|
+
|
|
96
|
+
- (void)setNotificationNameAndroid:(NSString *)notificationName {}
|
|
97
|
+
|
|
98
|
+
- (void)getNotificationNameAndroid:(RCTPromiseResolveBlock)resolve
|
|
99
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
100
|
+
reject(@"unsupported", @"getNotificationNameAndroid is Android only", nil);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
- (void)requestScheduleExactAlarm {}
|
|
104
|
+
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
// TurboModule bridge
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
|
|
109
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
110
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
111
|
+
return std::make_shared<facebook::react::NativeGrouplinkSdkSpecJSI>(params);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@end
|
|
115
|
+
|
|
116
|
+
#else // Old Architecture -------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
@interface RNGroupLinkSDK : NSObject <RCTBridgeModule>
|
|
119
|
+
@end
|
|
120
|
+
|
|
121
|
+
@implementation RNGroupLinkSDK
|
|
122
|
+
|
|
123
|
+
RCT_EXPORT_MODULE(RNGroupLinkSDK)
|
|
124
|
+
|
|
125
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
126
|
+
return YES;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
// iOS-only methods
|
|
131
|
+
// ---------------------------------------------------------------------------
|
|
132
|
+
|
|
133
|
+
RCT_EXPORT_METHOD(startIOS:(NSString *)withToken) {
|
|
134
|
+
[GrouplinkBridge startWithToken:withToken];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
RCT_EXPORT_METHOD(setDevicePushToken:(NSString *)withPushToken) {
|
|
138
|
+
[GrouplinkBridge setRemoteNotificationToken:withPushToken];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
RCT_EXPORT_METHOD(startBluetoothIOS) {
|
|
142
|
+
[GrouplinkBridge startBluetooth];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
RCT_EXPORT_METHOD(checkBluetoothIOS) {
|
|
146
|
+
[GrouplinkBridge checkBluetooth];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
RCT_EXPORT_METHOD(startLocationIOS) {
|
|
150
|
+
[GrouplinkBridge startLocation];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
RCT_EXPORT_METHOD(setNotificationNameIOS:(NSString *)withNotificationName) {
|
|
154
|
+
_iosNotificationName = withNotificationName;
|
|
155
|
+
[GrouplinkBridge setNotificationName:withNotificationName];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
RCT_EXPORT_METHOD(getUserID:(RCTPromiseResolveBlock)resolve
|
|
159
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
160
|
+
NSString *userId = [GrouplinkBridge getUserID];
|
|
161
|
+
if (userId != nil) {
|
|
162
|
+
resolve(userId);
|
|
163
|
+
} else {
|
|
164
|
+
reject(@"NO_USER_ID", @"Could not get userID at this moment", nil);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
RCT_EXPORT_METHOD(getNotificationNameIOS:(RCTPromiseResolveBlock)resolve
|
|
169
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
170
|
+
resolve(_iosNotificationName);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Android-only methods — not registered on iOS in Old Architecture
|
|
175
|
+
// (JS guards with Platform.OS checks; not needed here)
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
|
|
178
|
+
@end
|
|
179
|
+
|
|
180
|
+
#endif // RCT_NEW_ARCH_ENABLED
|
package/ios/GrouplinkSdk.swift
CHANGED
|
@@ -1,44 +1,35 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import GroupLink
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
func
|
|
9
|
-
GroupLinkSDK.
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@objc(startIOS:)
|
|
13
|
-
func startIOS(withToken: String) -> Void {
|
|
14
|
-
GroupLinkSDK.start(withToken:withToken)
|
|
4
|
+
/// Bridges GroupLink SDK calls from Obj-C++ (GrouplinkSdk.mm) to Swift.
|
|
5
|
+
/// Necessary because GroupLink.xcframework only exports Swift ABI symbols,
|
|
6
|
+
/// not ObjC class symbols, so direct ObjC++ calls would fail at link time.
|
|
7
|
+
@objc public class GrouplinkBridge: NSObject {
|
|
8
|
+
@objc public static func start(token: String) {
|
|
9
|
+
GroupLinkSDK.start(withToken: token)
|
|
15
10
|
}
|
|
16
11
|
|
|
17
|
-
@objc(
|
|
18
|
-
func startBluetoothIOS() -> Void {
|
|
12
|
+
@objc public static func startBluetooth() {
|
|
19
13
|
GroupLinkSDK.startBluetooth()
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
@objc(
|
|
23
|
-
func checkBluetoothIOS() -> Void {
|
|
16
|
+
@objc public static func checkBluetooth() {
|
|
24
17
|
GroupLinkSDK.checkBluetooth()
|
|
25
18
|
}
|
|
26
19
|
|
|
27
|
-
@objc(
|
|
28
|
-
func startLocationIOS() -> Void {
|
|
20
|
+
@objc public static func startLocation() {
|
|
29
21
|
GroupLinkSDK.startLocation()
|
|
30
22
|
}
|
|
31
23
|
|
|
32
|
-
@objc(
|
|
33
|
-
|
|
34
|
-
if GroupLinkSDK.getUserID() != nil {
|
|
35
|
-
reject("NO_USER_ID", "Could not get userID at this moment", SDK_ERROR.NO_USER_ID)
|
|
36
|
-
} else {
|
|
37
|
-
resolve(GroupLinkSDK.getUserID())
|
|
38
|
-
}
|
|
24
|
+
@objc public static func setNotificationName(_ name: String) {
|
|
25
|
+
GroupLinkSDK.setNotificationName(name)
|
|
39
26
|
}
|
|
40
|
-
}
|
|
41
27
|
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
@objc public static func getUserID() -> String? {
|
|
29
|
+
return GroupLinkSDK.getUserID()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc public static func setRemoteNotificationToken(_ token: String) {
|
|
33
|
+
GroupLinkNotifications.setRemoteNotificationToken(token)
|
|
34
|
+
}
|
|
44
35
|
}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
archiveVersion = 1;
|
|
4
4
|
classes = {
|
|
5
5
|
};
|
|
6
|
-
objectVersion =
|
|
6
|
+
objectVersion = 60;
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
966330A12F2BFAC000A9BFD7 /* GroupLink.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 966330A02F2BFAC000A9BFD7 /* GroupLink.xcframework */; };
|
|
11
|
+
966330A22F2BFAC000A9BFD7 /* GroupLink.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 966330A02F2BFAC000A9BFD7 /* GroupLink.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
|
12
|
+
F4FF95D7245B92E800C19C63 /* GrouplinkSdk.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* GrouplinkSdk.swift */; };
|
|
12
13
|
/* End PBXBuildFile section */
|
|
13
14
|
|
|
14
15
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -21,10 +22,22 @@
|
|
|
21
22
|
);
|
|
22
23
|
runOnlyForDeploymentPostprocessing = 0;
|
|
23
24
|
};
|
|
25
|
+
966330972F2BEBE500A9BFD7 /* Embed Frameworks */ = {
|
|
26
|
+
isa = PBXCopyFilesBuildPhase;
|
|
27
|
+
buildActionMask = 2147483647;
|
|
28
|
+
dstPath = "";
|
|
29
|
+
dstSubfolderSpec = 10;
|
|
30
|
+
files = (
|
|
31
|
+
966330A22F2BFAC000A9BFD7 /* GroupLink.xcframework in Embed Frameworks */,
|
|
32
|
+
);
|
|
33
|
+
name = "Embed Frameworks";
|
|
34
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
35
|
+
};
|
|
24
36
|
/* End PBXCopyFilesBuildPhase section */
|
|
25
37
|
|
|
26
38
|
/* Begin PBXFileReference section */
|
|
27
39
|
134814201AA4EA6300B7C361 /* libGrouplinkSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libGrouplinkSdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
40
|
+
966330A02F2BFAC000A9BFD7 /* GroupLink.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:S2LL5Y3GUV:Group Link Network LTDA"; lastKnownFileType = wrapper.xcframework; name = GroupLink.xcframework; path = Frameworks/GroupLink.xcframework; sourceTree = "<group>"; };
|
|
28
41
|
B3E7B5891CC2AC0600A0062D /* GrouplinkSdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GrouplinkSdk.m; sourceTree = "<group>"; };
|
|
29
42
|
F4FF95D5245B92E700C19C63 /* GrouplinkSdk-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GrouplinkSdk-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
30
43
|
F4FF95D6245B92E800C19C63 /* GrouplinkSdk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GrouplinkSdk.swift; sourceTree = "<group>"; };
|
|
@@ -35,6 +48,7 @@
|
|
|
35
48
|
isa = PBXFrameworksBuildPhase;
|
|
36
49
|
buildActionMask = 2147483647;
|
|
37
50
|
files = (
|
|
51
|
+
966330A12F2BFAC000A9BFD7 /* GroupLink.xcframework in Frameworks */,
|
|
38
52
|
);
|
|
39
53
|
runOnlyForDeploymentPostprocessing = 0;
|
|
40
54
|
};
|
|
@@ -56,7 +70,16 @@
|
|
|
56
70
|
B3E7B5891CC2AC0600A0062D /* GrouplinkSdk.m */,
|
|
57
71
|
F4FF95D5245B92E700C19C63 /* GrouplinkSdk-Bridging-Header.h */,
|
|
58
72
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
73
|
+
966330922F2BEBA600A9BFD7 /* Frameworks */,
|
|
74
|
+
);
|
|
75
|
+
sourceTree = "<group>";
|
|
76
|
+
};
|
|
77
|
+
966330922F2BEBA600A9BFD7 /* Frameworks */ = {
|
|
78
|
+
isa = PBXGroup;
|
|
79
|
+
children = (
|
|
80
|
+
966330A02F2BFAC000A9BFD7 /* GroupLink.xcframework */,
|
|
59
81
|
);
|
|
82
|
+
name = Frameworks;
|
|
60
83
|
sourceTree = "<group>";
|
|
61
84
|
};
|
|
62
85
|
/* End PBXGroup section */
|
|
@@ -69,6 +92,7 @@
|
|
|
69
92
|
58B511D71A9E6C8500147676 /* Sources */,
|
|
70
93
|
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
71
94
|
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
95
|
+
966330972F2BEBE500A9BFD7 /* Embed Frameworks */,
|
|
72
96
|
);
|
|
73
97
|
buildRules = (
|
|
74
98
|
);
|
|
@@ -117,7 +141,6 @@
|
|
|
117
141
|
buildActionMask = 2147483647;
|
|
118
142
|
files = (
|
|
119
143
|
F4FF95D7245B92E800C19C63 /* GrouplinkSdk.swift in Sources */,
|
|
120
|
-
B3E7B58A1CC2AC0600A0062D /* GrouplinkSdk.m in Sources */,
|
|
121
144
|
);
|
|
122
145
|
runOnlyForDeploymentPostprocessing = 0;
|
|
123
146
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('RNGroupLinkSDK');
|
|
9
|
+
//# sourceMappingURL=NativeGrouplinkSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGrouplinkSdk.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAuBpCC,gCAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -5,147 +5,152 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.checkBluetoothIOS = checkBluetoothIOS;
|
|
7
7
|
exports.getNotificationNameAndroid = getNotificationNameAndroid;
|
|
8
|
+
exports.getNotificationNameIOS = getNotificationNameIOS;
|
|
8
9
|
exports.getUserId = getUserId;
|
|
9
10
|
exports.requestFullIntentPermissionAndroid = requestFullIntentPermissionAndroid;
|
|
10
11
|
exports.requestScheduleExactAlarmPermissionAndroid = requestScheduleExactAlarmPermissionAndroid;
|
|
11
12
|
exports.setDevicePushTokenIOS = setDevicePushTokenIOS;
|
|
12
13
|
exports.setFirebaseToken = setFirebaseToken;
|
|
14
|
+
exports.setNotificationName = setNotificationName;
|
|
13
15
|
exports.setNotificationNameAndroid = setNotificationNameAndroid;
|
|
16
|
+
exports.setNotificationNameIOS = setNotificationNameIOS;
|
|
17
|
+
exports.startBluetooth = startBluetooth;
|
|
14
18
|
exports.startBluetoothAndroid = startBluetoothAndroid;
|
|
15
19
|
exports.startBluetoothIOS = startBluetoothIOS;
|
|
16
20
|
exports.startGrouplink = startGrouplink;
|
|
17
21
|
exports.startGrouplinkAndroid = startGrouplinkAndroid;
|
|
18
22
|
exports.startGrouplinkIOS = startGrouplinkIOS;
|
|
23
|
+
exports.startLocation = startLocation;
|
|
19
24
|
exports.startLocationAndroid = startLocationAndroid;
|
|
20
25
|
exports.startLocationIOS = startLocationIOS;
|
|
21
26
|
var _reactNative = require("react-native");
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
default: ''
|
|
25
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
26
|
-
const RNGroupLinkSDK = _reactNative.NativeModules.RNGroupLinkSDK ? _reactNative.NativeModules.RNGroupLinkSDK : new Proxy({}, {
|
|
27
|
-
get() {
|
|
28
|
-
throw new Error(LINKING_ERROR);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
27
|
+
var _NativeGrouplinkSdk = _interopRequireDefault(require("./NativeGrouplinkSdk"));
|
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
31
29
|
async function getUserId() {
|
|
32
30
|
if (isAndroid()) {
|
|
33
|
-
const userID = await
|
|
34
|
-
if (userID
|
|
31
|
+
const userID = await _NativeGrouplinkSdk.default.getUserIdAndroid();
|
|
32
|
+
if (userID !== 'User not registered yet.') {
|
|
35
33
|
return Promise.resolve(userID);
|
|
36
34
|
} else {
|
|
37
|
-
return Promise.reject(
|
|
35
|
+
return Promise.reject('UserID not registered yet');
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
if (isiOS()) {
|
|
41
|
-
|
|
42
|
-
if (userID != null) {
|
|
43
|
-
return Promise.resolve(userID);
|
|
44
|
-
} else {
|
|
45
|
-
return Promise.reject("UserID not registered yet");
|
|
46
|
-
}
|
|
39
|
+
return _NativeGrouplinkSdk.default.getUserID();
|
|
47
40
|
}
|
|
48
|
-
return Promise.reject(
|
|
41
|
+
return Promise.reject('Internal Error');
|
|
49
42
|
}
|
|
50
43
|
function setFirebaseToken(token) {
|
|
51
44
|
if (isAndroid()) {
|
|
52
|
-
|
|
53
|
-
RNGroupLinkSDK.setFirebaseToken(token);
|
|
45
|
+
_NativeGrouplinkSdk.default.setFirebaseToken(token);
|
|
54
46
|
}
|
|
55
47
|
}
|
|
56
48
|
function startBluetoothIOS() {
|
|
57
49
|
if (isiOS()) {
|
|
58
|
-
|
|
59
|
-
return RNGroupLinkSDK.startBluetoothIOS();
|
|
50
|
+
_NativeGrouplinkSdk.default.startBluetoothIOS();
|
|
60
51
|
}
|
|
61
|
-
return;
|
|
62
52
|
}
|
|
63
53
|
function setDevicePushTokenIOS(token) {
|
|
64
|
-
|
|
54
|
+
if (isiOS()) {
|
|
55
|
+
_NativeGrouplinkSdk.default.setDevicePushToken(token);
|
|
56
|
+
}
|
|
65
57
|
}
|
|
66
58
|
function startLocationIOS() {
|
|
67
59
|
if (isiOS()) {
|
|
68
|
-
|
|
69
|
-
return RNGroupLinkSDK.startLocationIOS();
|
|
60
|
+
_NativeGrouplinkSdk.default.startLocationIOS();
|
|
70
61
|
}
|
|
71
|
-
return;
|
|
72
62
|
}
|
|
73
63
|
function isAndroid() {
|
|
74
|
-
return _reactNative.Platform.OS
|
|
64
|
+
return _reactNative.Platform.OS === 'android';
|
|
75
65
|
}
|
|
76
66
|
function isiOS() {
|
|
77
|
-
return _reactNative.Platform.OS
|
|
78
|
-
}
|
|
79
|
-
function startAndroid(withToken, debbugable) {
|
|
80
|
-
console.log('Group Link SDK (Android) - Start with token: ', withToken);
|
|
81
|
-
return RNGroupLinkSDK.startAndroid(withToken, debbugable);
|
|
82
|
-
}
|
|
83
|
-
function startIOS(withToken) {
|
|
84
|
-
console.log('Group Link SDK (IOS) - Start with token: ', withToken);
|
|
85
|
-
return RNGroupLinkSDK.startIOS(withToken);
|
|
67
|
+
return _reactNative.Platform.OS === 'ios';
|
|
86
68
|
}
|
|
87
69
|
function startGrouplink(withToken, debbugable) {
|
|
88
70
|
if (isiOS()) {
|
|
89
|
-
startIOS(withToken);
|
|
71
|
+
_NativeGrouplinkSdk.default.startIOS(withToken);
|
|
90
72
|
}
|
|
91
73
|
if (isAndroid()) {
|
|
92
|
-
startAndroid(withToken, debbugable);
|
|
74
|
+
_NativeGrouplinkSdk.default.startAndroid(withToken, debbugable);
|
|
93
75
|
}
|
|
94
76
|
}
|
|
95
77
|
function startGrouplinkAndroid(withToken, debbugable) {
|
|
96
78
|
if (isAndroid()) {
|
|
97
|
-
startAndroid(withToken, debbugable);
|
|
79
|
+
_NativeGrouplinkSdk.default.startAndroid(withToken, debbugable);
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
82
|
function startGrouplinkIOS(withToken) {
|
|
101
83
|
if (isiOS()) {
|
|
102
|
-
startIOS(withToken);
|
|
84
|
+
_NativeGrouplinkSdk.default.startIOS(withToken);
|
|
103
85
|
}
|
|
104
86
|
}
|
|
105
87
|
function checkBluetoothIOS() {
|
|
106
|
-
if (isiOS())
|
|
88
|
+
if (isiOS()) {
|
|
89
|
+
_NativeGrouplinkSdk.default.checkBluetoothIOS();
|
|
90
|
+
}
|
|
107
91
|
}
|
|
108
92
|
async function startBluetoothAndroid() {
|
|
109
|
-
if (!(_reactNative.Platform.OS ===
|
|
93
|
+
if (!(_reactNative.Platform.OS === 'android' && _reactNative.Platform.Version >= 31)) return;
|
|
110
94
|
const bluetoothPermission = await _reactNative.PermissionsAndroid.requestMultiple([_reactNative.PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN, _reactNative.PermissionsAndroid.PERMISSIONS.BLUETOOTH_ADVERTISE, _reactNative.PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT]);
|
|
111
|
-
if (bluetoothPermission[
|
|
95
|
+
if (bluetoothPermission['android.permission.BLUETOOTH_SCAN'] === _reactNative.PermissionsAndroid.RESULTS.GRANTED && bluetoothPermission['android.permission.BLUETOOTH_ADVERTISE'] === _reactNative.PermissionsAndroid.RESULTS.GRANTED && bluetoothPermission['android.permission.BLUETOOTH_CONNECT'] === _reactNative.PermissionsAndroid.RESULTS.GRANTED) {
|
|
96
|
+
_NativeGrouplinkSdk.default.startAndroid('', false);
|
|
97
|
+
}
|
|
112
98
|
}
|
|
113
|
-
;
|
|
114
99
|
async function startLocationAndroid() {
|
|
115
|
-
if (!(_reactNative.Platform.OS
|
|
100
|
+
if (!(_reactNative.Platform.OS === 'android' && _reactNative.Platform.Version >= 23)) return;
|
|
116
101
|
const locationPermission = await _reactNative.PermissionsAndroid.requestMultiple([_reactNative.PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, _reactNative.PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION]);
|
|
117
|
-
if (locationPermission[
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
102
|
+
if (locationPermission['android.permission.ACCESS_COARSE_LOCATION'] === _reactNative.PermissionsAndroid.RESULTS.GRANTED && locationPermission['android.permission.ACCESS_FINE_LOCATION'] === _reactNative.PermissionsAndroid.RESULTS.GRANTED) {
|
|
103
|
+
// Permissions granted
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function startLocation() {
|
|
107
|
+
if (isiOS()) {
|
|
108
|
+
_NativeGrouplinkSdk.default.startLocationIOS();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function startBluetooth() {
|
|
112
|
+
if (isiOS()) {
|
|
113
|
+
_NativeGrouplinkSdk.default.startBluetoothIOS();
|
|
121
114
|
}
|
|
122
115
|
}
|
|
123
116
|
function requestFullIntentPermissionAndroid() {
|
|
124
117
|
if (isAndroid()) {
|
|
125
|
-
|
|
118
|
+
_NativeGrouplinkSdk.default.requestFullIntentPermissionAndroid();
|
|
126
119
|
}
|
|
127
120
|
}
|
|
128
121
|
function setNotificationNameAndroid(name) {
|
|
129
122
|
if (isAndroid()) {
|
|
130
|
-
|
|
123
|
+
_NativeGrouplinkSdk.default.setNotificationNameAndroid(name);
|
|
131
124
|
}
|
|
132
125
|
}
|
|
133
|
-
function getNotificationNameAndroid() {
|
|
126
|
+
async function getNotificationNameAndroid() {
|
|
134
127
|
if (isAndroid()) {
|
|
135
|
-
return
|
|
128
|
+
return _NativeGrouplinkSdk.default.getNotificationNameAndroid();
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
function setNotificationNameIOS(name) {
|
|
133
|
+
if (isiOS()) {
|
|
134
|
+
_NativeGrouplinkSdk.default.setNotificationNameIOS(name);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function getNotificationNameIOS() {
|
|
138
|
+
if (isiOS()) {
|
|
139
|
+
return _NativeGrouplinkSdk.default.getNotificationNameIOS();
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
function setNotificationName(name) {
|
|
144
|
+
if (isAndroid()) {
|
|
145
|
+
_NativeGrouplinkSdk.default.setNotificationNameAndroid(name);
|
|
146
|
+
}
|
|
147
|
+
if (isiOS()) {
|
|
148
|
+
_NativeGrouplinkSdk.default.setNotificationNameIOS(name);
|
|
136
149
|
}
|
|
137
150
|
}
|
|
138
151
|
function requestScheduleExactAlarmPermissionAndroid() {
|
|
139
152
|
if (isAndroid()) {
|
|
140
|
-
|
|
153
|
+
_NativeGrouplinkSdk.default.requestScheduleExactAlarm();
|
|
141
154
|
}
|
|
142
155
|
}
|
|
143
|
-
|
|
144
|
-
// function getUserIDiOS(success: (userId: string) => void) {
|
|
145
|
-
// RNGroupLinkSDK.getUserID(success);
|
|
146
|
-
// }
|
|
147
|
-
|
|
148
|
-
// function success(userId: string): void {
|
|
149
|
-
// throw new Error('Function not implemented.');
|
|
150
|
-
// }
|
|
151
156
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeGrouplinkSdk","_interopRequireDefault","e","__esModule","default","getUserId","isAndroid","userID","NativeGroupLinkSDK","getUserIdAndroid","Promise","resolve","reject","isiOS","getUserID","setFirebaseToken","token","startBluetoothIOS","setDevicePushTokenIOS","setDevicePushToken","startLocationIOS","Platform","OS","startGrouplink","withToken","debbugable","startIOS","startAndroid","startGrouplinkAndroid","startGrouplinkIOS","checkBluetoothIOS","startBluetoothAndroid","Version","bluetoothPermission","PermissionsAndroid","requestMultiple","PERMISSIONS","BLUETOOTH_SCAN","BLUETOOTH_ADVERTISE","BLUETOOTH_CONNECT","RESULTS","GRANTED","startLocationAndroid","locationPermission","ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION","startLocation","startBluetooth","requestFullIntentPermissionAndroid","setNotificationNameAndroid","name","getNotificationNameAndroid","setNotificationNameIOS","getNotificationNameIOS","setNotificationName","requestScheduleExactAlarmPermissionAndroid","requestScheduleExactAlarm"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsD,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/C,eAAeG,SAASA,CAAA,EAA2B;EACxD,IAAIC,SAAS,CAAC,CAAC,EAAE;IACf,MAAMC,MAAc,GAAG,MAAMC,2BAAkB,CAACC,gBAAgB,CAAC,CAAC;IAClE,IAAIF,MAAM,KAAK,0BAA0B,EAAE;MACzC,OAAOG,OAAO,CAACC,OAAO,CAACJ,MAAM,CAAC;IAChC,CAAC,MAAM;MACL,OAAOG,OAAO,CAACE,MAAM,CAAC,2BAA2B,CAAC;IACpD;EACF;EACA,IAAIC,KAAK,CAAC,CAAC,EAAE;IACX,OAAOL,2BAAkB,CAACM,SAAS,CAAC,CAAC;EACvC;EACA,OAAOJ,OAAO,CAACE,MAAM,CAAC,gBAAgB,CAAC;A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CA,CAAA,EAAG;EAC3D,IAAIjD,SAAS,CAAC,CAAC,EAAE;IACfE,2BAAkB,CAACgD,yBAAyB,CAAC,CAAC;EAChD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGrouplinkSdk.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAuBlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
|