@grouplinknetwork/rn-grouplink-sdk 2.5.0 → 2.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.
- package/README.md +0 -12
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/grouplinksdk/GrouplinkSdkModule.java +17 -0
- package/grouplink-sdk.podspec +1 -1
- package/ios/GrouplinkSdk.mm +11 -2
- package/ios/GrouplinkSdk.swift +6 -1
- package/ios/GrouplinkSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/GrouplinkSdk.xcodeproj/project.xcworkspace/xcuserdata/gabrieltorelo.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/GrouplinkSdk.xcodeproj/xcuserdata/gabrieltorelo.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/commonjs/NativeGrouplinkSdk.js.map +1 -1
- package/lib/commonjs/index.js +122 -38
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeGrouplinkSdk.js.map +1 -1
- package/lib/module/index.js +121 -38
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/NativeGrouplinkSdk.d.ts +14 -0
- package/lib/typescript/NativeGrouplinkSdk.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +27 -5
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/NativeGrouplinkSdk.ts +14 -0
- package/src/index.tsx +170 -38
package/README.md
CHANGED
|
@@ -72,21 +72,9 @@ Usage: Start the bluetooth in Android, and request it in app.
|
|
|
72
72
|
Usage: Start the bluetooth in iOS, and request it in app.
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
### setNotificationToken
|
|
76
|
-
Usage: Set notification by a argument required token.
|
|
77
|
-
|
|
78
|
-
|
|
79
75
|
### requestFullIntentPermissionAndroid
|
|
80
76
|
Usage: Request the full intent permission in settings of android mobile phone.
|
|
81
77
|
|
|
82
78
|
|
|
83
79
|
### requestScheduleExactAlarmPermissionAndroid
|
|
84
80
|
Usage: Request the schedule exact alarm permission.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### setNotificationNameAndroid
|
|
88
|
-
Usage: Set a notification name by argument in android.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
### getNotificationNameAndroid
|
|
92
|
-
Usage: Get the notification name used by a android mobile phone.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<uses-permission
|
|
3
3
|
android:name="android.permission.INTERNET" />
|
|
4
4
|
<uses-permission
|
|
5
|
-
android:name="android.permission.ACCESS_FINE_LOCATION
|
|
5
|
+
android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
6
6
|
<uses-permission
|
|
7
7
|
android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
8
8
|
<uses-permission
|
|
@@ -102,6 +102,17 @@ public class GrouplinkSdkModule extends NativeGrouplinkSdkSpec implements Lifecy
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
@Override
|
|
106
|
+
@ReactMethod
|
|
107
|
+
public void setRemoteId(String remoteId) {
|
|
108
|
+
try {
|
|
109
|
+
Context context = mReactApplicationContext.getApplicationContext();
|
|
110
|
+
GroupLink.setRemoteId(context, remoteId);
|
|
111
|
+
} catch (Exception e) {
|
|
112
|
+
Log.e("setRemoteId", "Failed: " + e.getMessage());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
105
116
|
@Override
|
|
106
117
|
@ReactMethod
|
|
107
118
|
public void setNotificationNameAndroid(String notificationName) {
|
|
@@ -164,6 +175,12 @@ public class GrouplinkSdkModule extends NativeGrouplinkSdkSpec implements Lifecy
|
|
|
164
175
|
// iOS only
|
|
165
176
|
}
|
|
166
177
|
|
|
178
|
+
@Override
|
|
179
|
+
@ReactMethod
|
|
180
|
+
public void setRemoteIdIOS(String remoteId) {
|
|
181
|
+
// iOS only
|
|
182
|
+
}
|
|
183
|
+
|
|
167
184
|
@Override
|
|
168
185
|
@ReactMethod
|
|
169
186
|
public void startBluetoothIOS() {
|
package/grouplink-sdk.podspec
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency "GroupLinkSDK", "~>
|
|
19
|
+
s.dependency "GroupLinkSDK", "~> 6.2.0"
|
|
20
20
|
s.dependency "React-Core"
|
|
21
21
|
|
|
22
22
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
package/ios/GrouplinkSdk.mm
CHANGED
|
@@ -39,7 +39,7 @@ RCT_EXPORT_MODULE(RNGroupLinkSDK)
|
|
|
39
39
|
// ---------------------------------------------------------------------------
|
|
40
40
|
|
|
41
41
|
- (void)startIOS:(NSString *)withToken {
|
|
42
|
-
[GrouplinkBridge
|
|
42
|
+
[GrouplinkBridge startIOSWithToken:withToken];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
- (void)setDevicePushToken:(NSString *)withPushToken {
|
|
@@ -58,6 +58,11 @@ RCT_EXPORT_MODULE(RNGroupLinkSDK)
|
|
|
58
58
|
[GrouplinkBridge startLocation];
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
- (void)setRemoteIdIOS:(NSString *)remoteId {
|
|
62
|
+
_iosNotificationName = remoteId;
|
|
63
|
+
[GrouplinkBridge setRemoteIdIOS:remoteId];
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
- (void)setNotificationNameIOS:(NSString *)withNotificationName {
|
|
62
67
|
_iosNotificationName = withNotificationName;
|
|
63
68
|
[GrouplinkBridge setNotificationName:withNotificationName];
|
|
@@ -131,7 +136,7 @@ RCT_EXPORT_MODULE(RNGroupLinkSDK)
|
|
|
131
136
|
// ---------------------------------------------------------------------------
|
|
132
137
|
|
|
133
138
|
RCT_EXPORT_METHOD(startIOS:(NSString *)withToken) {
|
|
134
|
-
[GrouplinkBridge
|
|
139
|
+
[GrouplinkBridge startIOSWithToken:withToken];
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
RCT_EXPORT_METHOD(setDevicePushToken:(NSString *)withPushToken) {
|
|
@@ -150,6 +155,10 @@ RCT_EXPORT_METHOD(startLocationIOS) {
|
|
|
150
155
|
[GrouplinkBridge startLocation];
|
|
151
156
|
}
|
|
152
157
|
|
|
158
|
+
RCT_EXPORT_METHOD(setRemoteIdIOS:(NSString *)remoteId) {
|
|
159
|
+
[GrouplinkBridge setRemoteIdIOS:remoteId];
|
|
160
|
+
}
|
|
161
|
+
|
|
153
162
|
RCT_EXPORT_METHOD(setNotificationNameIOS:(NSString *)withNotificationName) {
|
|
154
163
|
_iosNotificationName = withNotificationName;
|
|
155
164
|
[GrouplinkBridge setNotificationName:withNotificationName];
|
package/ios/GrouplinkSdk.swift
CHANGED
|
@@ -5,7 +5,8 @@ import GroupLink
|
|
|
5
5
|
/// Necessary because GroupLink.xcframework only exports Swift ABI symbols,
|
|
6
6
|
/// not ObjC class symbols, so direct ObjC++ calls would fail at link time.
|
|
7
7
|
@objc public class GrouplinkBridge: NSObject {
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
@objc public static func startIOS(token: String) {
|
|
9
10
|
GroupLinkSDK.start(withToken: token)
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -25,6 +26,10 @@ import GroupLink
|
|
|
25
26
|
GroupLinkSDK.setNotificationName(name)
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
@objc public static func setRemoteIdIOS(_ remoteId: String) {
|
|
30
|
+
GroupLinkSDK.setRemoteId(remoteId)
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
@objc public static func getUserID() -> String? {
|
|
29
34
|
return GroupLinkSDK.getUserID()
|
|
30
35
|
}
|
|
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>GrouplinkSdk.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -1 +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,
|
|
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,GAqCpCC,gCAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -14,6 +14,7 @@ exports.setFirebaseToken = setFirebaseToken;
|
|
|
14
14
|
exports.setNotificationName = setNotificationName;
|
|
15
15
|
exports.setNotificationNameAndroid = setNotificationNameAndroid;
|
|
16
16
|
exports.setNotificationNameIOS = setNotificationNameIOS;
|
|
17
|
+
exports.setRemoteId = setRemoteId;
|
|
17
18
|
exports.startBluetooth = startBluetooth;
|
|
18
19
|
exports.startBluetoothAndroid = startBluetoothAndroid;
|
|
19
20
|
exports.startBluetoothIOS = startBluetoothIOS;
|
|
@@ -27,65 +28,87 @@ var _reactNative = require("react-native");
|
|
|
27
28
|
var _NativeGrouplinkSdk = _interopRequireDefault(require("./NativeGrouplinkSdk"));
|
|
28
29
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
30
|
async function getUserId() {
|
|
30
|
-
if (
|
|
31
|
+
if (_isAndroid()) {
|
|
31
32
|
const userID = await _NativeGrouplinkSdk.default.getUserIdAndroid();
|
|
32
33
|
if (userID !== 'User not registered yet.') {
|
|
33
34
|
return Promise.resolve(userID);
|
|
34
35
|
} else {
|
|
35
36
|
return Promise.reject('UserID not registered yet');
|
|
36
37
|
}
|
|
37
|
-
}
|
|
38
|
-
if (isiOS()) {
|
|
38
|
+
} else if (_isiOS()) {
|
|
39
39
|
return _NativeGrouplinkSdk.default.getUserID();
|
|
40
40
|
}
|
|
41
41
|
return Promise.reject('Internal Error');
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated No longer supported.
|
|
46
|
+
*/
|
|
43
47
|
function setFirebaseToken(token) {
|
|
44
|
-
if (
|
|
48
|
+
if (token == null || token === '') {
|
|
49
|
+
_reportError('setFirebaseToken(token: string)', 'Requires a valid Firebase (FCM) token string.');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (_isAndroid()) {
|
|
45
53
|
_NativeGrouplinkSdk.default.setFirebaseToken(token);
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
function startBluetoothIOS() {
|
|
49
|
-
if (
|
|
57
|
+
if (_isiOS()) {
|
|
50
58
|
_NativeGrouplinkSdk.default.startBluetoothIOS();
|
|
51
59
|
}
|
|
52
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated No longer supported.
|
|
64
|
+
*/
|
|
53
65
|
function setDevicePushTokenIOS(token) {
|
|
54
|
-
if (
|
|
66
|
+
if (token == null || token === '') {
|
|
67
|
+
_reportError('setDevicePushTokenIOS(token: string)', 'Requires a valid device push token string.');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (_isiOS()) {
|
|
55
71
|
_NativeGrouplinkSdk.default.setDevicePushToken(token);
|
|
56
72
|
}
|
|
57
73
|
}
|
|
58
74
|
function startLocationIOS() {
|
|
59
|
-
if (
|
|
75
|
+
if (_isiOS()) {
|
|
60
76
|
_NativeGrouplinkSdk.default.startLocationIOS();
|
|
61
77
|
}
|
|
62
78
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return _reactNative.Platform.OS === 'ios';
|
|
68
|
-
}
|
|
69
|
-
function startGrouplink(withToken, debbugable) {
|
|
70
|
-
if (isiOS()) {
|
|
71
|
-
_NativeGrouplinkSdk.default.startIOS(withToken);
|
|
79
|
+
function startGrouplink(appLabel, debbugable) {
|
|
80
|
+
if (appLabel == null || appLabel === '') {
|
|
81
|
+
_reportError('startGrouplink(appLabel: string, debbugable?: boolean | null)', 'Requires a valid GroupLink token string.');
|
|
82
|
+
return;
|
|
72
83
|
}
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
const debug = debbugable ?? false;
|
|
85
|
+
if (_isiOS()) {
|
|
86
|
+
_NativeGrouplinkSdk.default.startIOS(appLabel);
|
|
87
|
+
} else if (_isAndroid()) {
|
|
88
|
+
_NativeGrouplinkSdk.default.startAndroid(appLabel, debug);
|
|
75
89
|
}
|
|
76
90
|
}
|
|
77
|
-
function startGrouplinkAndroid(
|
|
78
|
-
if (
|
|
79
|
-
|
|
91
|
+
function startGrouplinkAndroid(appLabel, debbugable) {
|
|
92
|
+
if (appLabel == null || appLabel === '') {
|
|
93
|
+
_reportError('startGrouplinkAndroid(appLabel: string, debbugable?: boolean | null)', 'Requires a valid GroupLink token string.');
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const debug = debbugable ?? false;
|
|
97
|
+
if (_isAndroid()) {
|
|
98
|
+
_NativeGrouplinkSdk.default.startAndroid(appLabel, debug);
|
|
80
99
|
}
|
|
81
100
|
}
|
|
82
|
-
function startGrouplinkIOS(
|
|
83
|
-
if (
|
|
84
|
-
|
|
101
|
+
function startGrouplinkIOS(appLabel) {
|
|
102
|
+
if (appLabel == null || appLabel === '') {
|
|
103
|
+
_reportError('startGrouplinkIOS(appLabel: string)', 'Requires a valid GroupLink token string.');
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (_isiOS()) {
|
|
107
|
+
_NativeGrouplinkSdk.default.startIOS(appLabel);
|
|
85
108
|
}
|
|
86
109
|
}
|
|
87
110
|
function checkBluetoothIOS() {
|
|
88
|
-
if (
|
|
111
|
+
if (_isiOS()) {
|
|
89
112
|
_NativeGrouplinkSdk.default.checkBluetoothIOS();
|
|
90
113
|
}
|
|
91
114
|
}
|
|
@@ -103,54 +126,115 @@ async function startLocationAndroid() {
|
|
|
103
126
|
// Permissions granted
|
|
104
127
|
}
|
|
105
128
|
}
|
|
106
|
-
function startLocation() {
|
|
107
|
-
if (
|
|
129
|
+
async function startLocation() {
|
|
130
|
+
if (_isiOS()) {
|
|
108
131
|
_NativeGrouplinkSdk.default.startLocationIOS();
|
|
132
|
+
} else if (_isAndroid()) {
|
|
133
|
+
await startLocationAndroid();
|
|
109
134
|
}
|
|
110
135
|
}
|
|
111
|
-
function startBluetooth() {
|
|
112
|
-
if (
|
|
136
|
+
async function startBluetooth() {
|
|
137
|
+
if (_isiOS()) {
|
|
113
138
|
_NativeGrouplinkSdk.default.startBluetoothIOS();
|
|
139
|
+
} else if (_isAndroid()) {
|
|
140
|
+
await startBluetoothAndroid();
|
|
114
141
|
}
|
|
115
142
|
}
|
|
116
143
|
function requestFullIntentPermissionAndroid() {
|
|
117
|
-
if (
|
|
144
|
+
if (_isAndroid()) {
|
|
118
145
|
_NativeGrouplinkSdk.default.requestFullIntentPermissionAndroid();
|
|
119
146
|
}
|
|
120
147
|
}
|
|
148
|
+
function setRemoteId(remoteId) {
|
|
149
|
+
if (remoteId == null || remoteId === '') {
|
|
150
|
+
_reportError('setRemoteId(remoteId: string)', 'Requires a valid remote id string.');
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (_isiOS()) {
|
|
154
|
+
_NativeGrouplinkSdk.default.setRemoteIdIOS(remoteId);
|
|
155
|
+
}
|
|
156
|
+
if (_isAndroid()) {
|
|
157
|
+
_NativeGrouplinkSdk.default.setRemoteId(remoteId);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
163
|
+
*/
|
|
121
164
|
function setNotificationNameAndroid(name) {
|
|
122
|
-
if (
|
|
165
|
+
if (name == null || name === '') {
|
|
166
|
+
_reportError('setNotificationNameAndroid(name: string)', 'Requires a valid notification name string.');
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (_isAndroid()) {
|
|
123
170
|
_NativeGrouplinkSdk.default.setNotificationNameAndroid(name);
|
|
124
171
|
}
|
|
125
172
|
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @deprecated No longer supported.
|
|
176
|
+
*/
|
|
126
177
|
async function getNotificationNameAndroid() {
|
|
127
|
-
if (
|
|
178
|
+
if (_isAndroid()) {
|
|
128
179
|
return _NativeGrouplinkSdk.default.getNotificationNameAndroid();
|
|
129
180
|
}
|
|
130
181
|
return null;
|
|
131
182
|
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
186
|
+
*/
|
|
132
187
|
function setNotificationNameIOS(name) {
|
|
133
|
-
if (
|
|
188
|
+
if (name == null || name === '') {
|
|
189
|
+
_reportError('setNotificationNameIOS(name: string)', 'Requires a valid notification name string.');
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (_isiOS()) {
|
|
134
193
|
_NativeGrouplinkSdk.default.setNotificationNameIOS(name);
|
|
135
194
|
}
|
|
136
195
|
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated No longer supported.
|
|
199
|
+
*/
|
|
137
200
|
async function getNotificationNameIOS() {
|
|
138
|
-
if (
|
|
201
|
+
if (_isiOS()) {
|
|
139
202
|
return _NativeGrouplinkSdk.default.getNotificationNameIOS();
|
|
140
203
|
}
|
|
141
204
|
return null;
|
|
142
205
|
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
209
|
+
*/
|
|
143
210
|
function setNotificationName(name) {
|
|
144
|
-
if (
|
|
145
|
-
|
|
211
|
+
if (name == null || name === '') {
|
|
212
|
+
_reportError('setNotificationName(name: string)', 'Requires a valid notification name string.');
|
|
213
|
+
return;
|
|
146
214
|
}
|
|
147
|
-
if (
|
|
215
|
+
if (_isAndroid()) {
|
|
216
|
+
_NativeGrouplinkSdk.default.setNotificationNameAndroid(name);
|
|
217
|
+
} else if (_isiOS()) {
|
|
148
218
|
_NativeGrouplinkSdk.default.setNotificationNameIOS(name);
|
|
149
219
|
}
|
|
150
220
|
}
|
|
151
221
|
function requestScheduleExactAlarmPermissionAndroid() {
|
|
152
|
-
if (
|
|
222
|
+
if (_isAndroid()) {
|
|
153
223
|
_NativeGrouplinkSdk.default.requestScheduleExactAlarm();
|
|
154
224
|
}
|
|
155
225
|
}
|
|
226
|
+
function _reportError(signature, message) {
|
|
227
|
+
const err = new Error(`[GroupLinkSDK] ${signature} → ${message}`);
|
|
228
|
+
if (err.stack) {
|
|
229
|
+
const lines = err.stack.split('\n');
|
|
230
|
+
err.stack = [lines[0], ...lines.slice(3)].join('\n');
|
|
231
|
+
}
|
|
232
|
+
console.error(err);
|
|
233
|
+
}
|
|
234
|
+
function _isAndroid() {
|
|
235
|
+
return _reactNative.Platform.OS === 'android';
|
|
236
|
+
}
|
|
237
|
+
function _isiOS() {
|
|
238
|
+
return _reactNative.Platform.OS === 'ios';
|
|
239
|
+
}
|
|
156
240
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_NativeGrouplinkSdk","_interopRequireDefault","e","__esModule","default","getUserId","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_NativeGrouplinkSdk","_interopRequireDefault","e","__esModule","default","getUserId","_isAndroid","userID","NativeGroupLinkSDK","getUserIdAndroid","Promise","resolve","reject","_isiOS","getUserID","setFirebaseToken","token","_reportError","startBluetoothIOS","setDevicePushTokenIOS","setDevicePushToken","startLocationIOS","startGrouplink","appLabel","debbugable","debug","startIOS","startAndroid","startGrouplinkAndroid","startGrouplinkIOS","checkBluetoothIOS","startBluetoothAndroid","Platform","OS","Version","bluetoothPermission","PermissionsAndroid","requestMultiple","PERMISSIONS","BLUETOOTH_SCAN","BLUETOOTH_ADVERTISE","BLUETOOTH_CONNECT","RESULTS","GRANTED","startLocationAndroid","locationPermission","ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION","startLocation","startBluetooth","requestFullIntentPermissionAndroid","setRemoteId","remoteId","setRemoteIdIOS","setNotificationNameAndroid","name","getNotificationNameAndroid","setNotificationNameIOS","getNotificationNameIOS","setNotificationName","requestScheduleExactAlarmPermissionAndroid","requestScheduleExactAlarm","signature","message","err","Error","stack","lines","split","slice","join","console","error"],"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,UAAU,CAAC,CAAC,EAAE;IAChB,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,2BA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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGrouplinkSdk.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeGrouplinkSdk.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAqClD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,gBAAgB,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,65 +1,87 @@
|
|
|
1
1
|
import { PermissionsAndroid, Platform } from 'react-native';
|
|
2
2
|
import NativeGroupLinkSDK from './NativeGrouplinkSdk';
|
|
3
3
|
export async function getUserId() {
|
|
4
|
-
if (
|
|
4
|
+
if (_isAndroid()) {
|
|
5
5
|
const userID = await NativeGroupLinkSDK.getUserIdAndroid();
|
|
6
6
|
if (userID !== 'User not registered yet.') {
|
|
7
7
|
return Promise.resolve(userID);
|
|
8
8
|
} else {
|
|
9
9
|
return Promise.reject('UserID not registered yet');
|
|
10
10
|
}
|
|
11
|
-
}
|
|
12
|
-
if (isiOS()) {
|
|
11
|
+
} else if (_isiOS()) {
|
|
13
12
|
return NativeGroupLinkSDK.getUserID();
|
|
14
13
|
}
|
|
15
14
|
return Promise.reject('Internal Error');
|
|
16
15
|
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated No longer supported.
|
|
19
|
+
*/
|
|
17
20
|
export function setFirebaseToken(token) {
|
|
18
|
-
if (
|
|
21
|
+
if (token == null || token === '') {
|
|
22
|
+
_reportError('setFirebaseToken(token: string)', 'Requires a valid Firebase (FCM) token string.');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (_isAndroid()) {
|
|
19
26
|
NativeGroupLinkSDK.setFirebaseToken(token);
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
export function startBluetoothIOS() {
|
|
23
|
-
if (
|
|
30
|
+
if (_isiOS()) {
|
|
24
31
|
NativeGroupLinkSDK.startBluetoothIOS();
|
|
25
32
|
}
|
|
26
33
|
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated No longer supported.
|
|
37
|
+
*/
|
|
27
38
|
export function setDevicePushTokenIOS(token) {
|
|
28
|
-
if (
|
|
39
|
+
if (token == null || token === '') {
|
|
40
|
+
_reportError('setDevicePushTokenIOS(token: string)', 'Requires a valid device push token string.');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (_isiOS()) {
|
|
29
44
|
NativeGroupLinkSDK.setDevicePushToken(token);
|
|
30
45
|
}
|
|
31
46
|
}
|
|
32
47
|
export function startLocationIOS() {
|
|
33
|
-
if (
|
|
48
|
+
if (_isiOS()) {
|
|
34
49
|
NativeGroupLinkSDK.startLocationIOS();
|
|
35
50
|
}
|
|
36
51
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return Platform.OS === 'ios';
|
|
42
|
-
}
|
|
43
|
-
export function startGrouplink(withToken, debbugable) {
|
|
44
|
-
if (isiOS()) {
|
|
45
|
-
NativeGroupLinkSDK.startIOS(withToken);
|
|
52
|
+
export function startGrouplink(appLabel, debbugable) {
|
|
53
|
+
if (appLabel == null || appLabel === '') {
|
|
54
|
+
_reportError('startGrouplink(appLabel: string, debbugable?: boolean | null)', 'Requires a valid GroupLink token string.');
|
|
55
|
+
return;
|
|
46
56
|
}
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
const debug = debbugable ?? false;
|
|
58
|
+
if (_isiOS()) {
|
|
59
|
+
NativeGroupLinkSDK.startIOS(appLabel);
|
|
60
|
+
} else if (_isAndroid()) {
|
|
61
|
+
NativeGroupLinkSDK.startAndroid(appLabel, debug);
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
|
-
export function startGrouplinkAndroid(
|
|
52
|
-
if (
|
|
53
|
-
|
|
64
|
+
export function startGrouplinkAndroid(appLabel, debbugable) {
|
|
65
|
+
if (appLabel == null || appLabel === '') {
|
|
66
|
+
_reportError('startGrouplinkAndroid(appLabel: string, debbugable?: boolean | null)', 'Requires a valid GroupLink token string.');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const debug = debbugable ?? false;
|
|
70
|
+
if (_isAndroid()) {
|
|
71
|
+
NativeGroupLinkSDK.startAndroid(appLabel, debug);
|
|
54
72
|
}
|
|
55
73
|
}
|
|
56
|
-
export function startGrouplinkIOS(
|
|
57
|
-
if (
|
|
58
|
-
|
|
74
|
+
export function startGrouplinkIOS(appLabel) {
|
|
75
|
+
if (appLabel == null || appLabel === '') {
|
|
76
|
+
_reportError('startGrouplinkIOS(appLabel: string)', 'Requires a valid GroupLink token string.');
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (_isiOS()) {
|
|
80
|
+
NativeGroupLinkSDK.startIOS(appLabel);
|
|
59
81
|
}
|
|
60
82
|
}
|
|
61
83
|
export function checkBluetoothIOS() {
|
|
62
|
-
if (
|
|
84
|
+
if (_isiOS()) {
|
|
63
85
|
NativeGroupLinkSDK.checkBluetoothIOS();
|
|
64
86
|
}
|
|
65
87
|
}
|
|
@@ -77,54 +99,115 @@ export async function startLocationAndroid() {
|
|
|
77
99
|
// Permissions granted
|
|
78
100
|
}
|
|
79
101
|
}
|
|
80
|
-
export function startLocation() {
|
|
81
|
-
if (
|
|
102
|
+
export async function startLocation() {
|
|
103
|
+
if (_isiOS()) {
|
|
82
104
|
NativeGroupLinkSDK.startLocationIOS();
|
|
105
|
+
} else if (_isAndroid()) {
|
|
106
|
+
await startLocationAndroid();
|
|
83
107
|
}
|
|
84
108
|
}
|
|
85
|
-
export function startBluetooth() {
|
|
86
|
-
if (
|
|
109
|
+
export async function startBluetooth() {
|
|
110
|
+
if (_isiOS()) {
|
|
87
111
|
NativeGroupLinkSDK.startBluetoothIOS();
|
|
112
|
+
} else if (_isAndroid()) {
|
|
113
|
+
await startBluetoothAndroid();
|
|
88
114
|
}
|
|
89
115
|
}
|
|
90
116
|
export function requestFullIntentPermissionAndroid() {
|
|
91
|
-
if (
|
|
117
|
+
if (_isAndroid()) {
|
|
92
118
|
NativeGroupLinkSDK.requestFullIntentPermissionAndroid();
|
|
93
119
|
}
|
|
94
120
|
}
|
|
121
|
+
export function setRemoteId(remoteId) {
|
|
122
|
+
if (remoteId == null || remoteId === '') {
|
|
123
|
+
_reportError('setRemoteId(remoteId: string)', 'Requires a valid remote id string.');
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (_isiOS()) {
|
|
127
|
+
NativeGroupLinkSDK.setRemoteIdIOS(remoteId);
|
|
128
|
+
}
|
|
129
|
+
if (_isAndroid()) {
|
|
130
|
+
NativeGroupLinkSDK.setRemoteId(remoteId);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
136
|
+
*/
|
|
95
137
|
export function setNotificationNameAndroid(name) {
|
|
96
|
-
if (
|
|
138
|
+
if (name == null || name === '') {
|
|
139
|
+
_reportError('setNotificationNameAndroid(name: string)', 'Requires a valid notification name string.');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (_isAndroid()) {
|
|
97
143
|
NativeGroupLinkSDK.setNotificationNameAndroid(name);
|
|
98
144
|
}
|
|
99
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated No longer supported.
|
|
149
|
+
*/
|
|
100
150
|
export async function getNotificationNameAndroid() {
|
|
101
|
-
if (
|
|
151
|
+
if (_isAndroid()) {
|
|
102
152
|
return NativeGroupLinkSDK.getNotificationNameAndroid();
|
|
103
153
|
}
|
|
104
154
|
return null;
|
|
105
155
|
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
159
|
+
*/
|
|
106
160
|
export function setNotificationNameIOS(name) {
|
|
107
|
-
if (
|
|
161
|
+
if (name == null || name === '') {
|
|
162
|
+
_reportError('setNotificationNameIOS(name: string)', 'Requires a valid notification name string.');
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (_isiOS()) {
|
|
108
166
|
NativeGroupLinkSDK.setNotificationNameIOS(name);
|
|
109
167
|
}
|
|
110
168
|
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @deprecated No longer supported.
|
|
172
|
+
*/
|
|
111
173
|
export async function getNotificationNameIOS() {
|
|
112
|
-
if (
|
|
174
|
+
if (_isiOS()) {
|
|
113
175
|
return NativeGroupLinkSDK.getNotificationNameIOS();
|
|
114
176
|
}
|
|
115
177
|
return null;
|
|
116
178
|
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
182
|
+
*/
|
|
117
183
|
export function setNotificationName(name) {
|
|
118
|
-
if (
|
|
119
|
-
|
|
184
|
+
if (name == null || name === '') {
|
|
185
|
+
_reportError('setNotificationName(name: string)', 'Requires a valid notification name string.');
|
|
186
|
+
return;
|
|
120
187
|
}
|
|
121
|
-
if (
|
|
188
|
+
if (_isAndroid()) {
|
|
189
|
+
NativeGroupLinkSDK.setNotificationNameAndroid(name);
|
|
190
|
+
} else if (_isiOS()) {
|
|
122
191
|
NativeGroupLinkSDK.setNotificationNameIOS(name);
|
|
123
192
|
}
|
|
124
193
|
}
|
|
125
194
|
export function requestScheduleExactAlarmPermissionAndroid() {
|
|
126
|
-
if (
|
|
195
|
+
if (_isAndroid()) {
|
|
127
196
|
NativeGroupLinkSDK.requestScheduleExactAlarm();
|
|
128
197
|
}
|
|
129
198
|
}
|
|
199
|
+
function _reportError(signature, message) {
|
|
200
|
+
const err = new Error(`[GroupLinkSDK] ${signature} → ${message}`);
|
|
201
|
+
if (err.stack) {
|
|
202
|
+
const lines = err.stack.split('\n');
|
|
203
|
+
err.stack = [lines[0], ...lines.slice(3)].join('\n');
|
|
204
|
+
}
|
|
205
|
+
console.error(err);
|
|
206
|
+
}
|
|
207
|
+
function _isAndroid() {
|
|
208
|
+
return Platform.OS === 'android';
|
|
209
|
+
}
|
|
210
|
+
function _isiOS() {
|
|
211
|
+
return Platform.OS === 'ios';
|
|
212
|
+
}
|
|
130
213
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PermissionsAndroid","Platform","NativeGroupLinkSDK","getUserId","
|
|
1
|
+
{"version":3,"names":["PermissionsAndroid","Platform","NativeGroupLinkSDK","getUserId","_isAndroid","userID","getUserIdAndroid","Promise","resolve","reject","_isiOS","getUserID","setFirebaseToken","token","_reportError","startBluetoothIOS","setDevicePushTokenIOS","setDevicePushToken","startLocationIOS","startGrouplink","appLabel","debbugable","debug","startIOS","startAndroid","startGrouplinkAndroid","startGrouplinkIOS","checkBluetoothIOS","startBluetoothAndroid","OS","Version","bluetoothPermission","requestMultiple","PERMISSIONS","BLUETOOTH_SCAN","BLUETOOTH_ADVERTISE","BLUETOOTH_CONNECT","RESULTS","GRANTED","startLocationAndroid","locationPermission","ACCESS_FINE_LOCATION","ACCESS_COARSE_LOCATION","startLocation","startBluetooth","requestFullIntentPermissionAndroid","setRemoteId","remoteId","setRemoteIdIOS","setNotificationNameAndroid","name","getNotificationNameAndroid","setNotificationNameIOS","getNotificationNameIOS","setNotificationName","requestScheduleExactAlarmPermissionAndroid","requestScheduleExactAlarm","signature","message","err","Error","stack","lines","split","slice","join","console","error"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,OAAOC,kBAAkB,MAAM,sBAAsB;AAErD,OAAO,eAAeC,SAASA,CAAA,EAA2B;EACxD,IAAIC,UAAU,CAAC,CAAC,EAAE;IAChB,MAAMC,MAAc,GAAG,MAAMH,kBAAkB,CAACI,gBAAg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GAAGA,KAAK,CAACE,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;EACtD;EAEAC,OAAO,CAACC,KAAK,CAACR,GAAG,CAAC;AACpB;AAEA,SAASvD,UAAUA,CAAA,EAAG;EACpB,OAAOH,QAAQ,CAAC4B,EAAE,KAAK,SAAS;AAClC;AAEA,SAASnB,MAAMA,CAAA,EAAG;EAChB,OAAOT,QAAQ,CAAC4B,EAAE,KAAK,KAAK;AAC9B","ignoreList":[]}
|
|
@@ -4,16 +4,30 @@ export interface Spec extends TurboModule {
|
|
|
4
4
|
startAndroid(token: string, debbugable: boolean): void;
|
|
5
5
|
setFirebaseToken(token: string): void;
|
|
6
6
|
requestFullIntentPermissionAndroid(): void;
|
|
7
|
+
setRemoteId(remoteId: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
10
|
+
*/
|
|
7
11
|
setNotificationNameAndroid(notificationName: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated No longer supported.
|
|
14
|
+
*/
|
|
8
15
|
getNotificationNameAndroid(): Promise<string>;
|
|
9
16
|
requestScheduleExactAlarm(): void;
|
|
10
17
|
getUserID(): Promise<string>;
|
|
11
18
|
setDevicePushToken(withPushToken: string): void;
|
|
12
19
|
startIOS(withToken: string): void;
|
|
20
|
+
setRemoteIdIOS(remoteId: string): void;
|
|
13
21
|
startBluetoothIOS(): void;
|
|
14
22
|
checkBluetoothIOS(): void;
|
|
15
23
|
startLocationIOS(): void;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
26
|
+
*/
|
|
16
27
|
setNotificationNameIOS(withNotificationName: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated No longer supported.
|
|
30
|
+
*/
|
|
17
31
|
getNotificationNameIOS(): Promise<string>;
|
|
18
32
|
}
|
|
19
33
|
declare const _default: Spec;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeGrouplinkSdk.d.ts","sourceRoot":"","sources":["../../src/NativeGrouplinkSdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IAEvC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IACvD,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,kCAAkC,IAAI,IAAI,CAAC;IAC3C,0BAA0B,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3D,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,yBAAyB,IAAI,IAAI,CAAC;IAGlC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,iBAAiB,IAAI,IAAI,CAAC;IAC1B,iBAAiB,IAAI,IAAI,CAAC;IAC1B,gBAAgB,IAAI,IAAI,CAAC;IACzB,sBAAsB,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3D,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;;AAED,wBAAwE"}
|
|
1
|
+
{"version":3,"file":"NativeGrouplinkSdk.d.ts","sourceRoot":"","sources":["../../src/NativeGrouplinkSdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IAEvC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IACvD,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,kCAAkC,IAAI,IAAI,CAAC;IAC3C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;MAEE;IACF,0BAA0B,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3D;;MAEE;IACF,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,yBAAyB,IAAI,IAAI,CAAC;IAGlC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,iBAAiB,IAAI,IAAI,CAAC;IAC1B,iBAAiB,IAAI,IAAI,CAAC;IAC1B,gBAAgB,IAAI,IAAI,CAAC;IACzB;;MAEE;IACF,sBAAsB,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3D;;MAEE;IACF,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;;AAED,wBAAwE"}
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
export declare function getUserId(): Promise<string | null>;
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated No longer supported.
|
|
4
|
+
*/
|
|
2
5
|
export declare function setFirebaseToken(token: string): void;
|
|
3
6
|
export declare function startBluetoothIOS(): void;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated No longer supported.
|
|
9
|
+
*/
|
|
4
10
|
export declare function setDevicePushTokenIOS(token: string): void;
|
|
5
11
|
export declare function startLocationIOS(): void;
|
|
6
|
-
export declare function startGrouplink(
|
|
7
|
-
export declare function startGrouplinkAndroid(
|
|
8
|
-
export declare function startGrouplinkIOS(
|
|
12
|
+
export declare function startGrouplink(appLabel: string, debbugable?: boolean | null): void;
|
|
13
|
+
export declare function startGrouplinkAndroid(appLabel: string, debbugable?: boolean | null): void;
|
|
14
|
+
export declare function startGrouplinkIOS(appLabel: string): void;
|
|
9
15
|
export declare function checkBluetoothIOS(): void;
|
|
10
16
|
export declare function startBluetoothAndroid(): Promise<void>;
|
|
11
17
|
export declare function startLocationAndroid(): Promise<void>;
|
|
12
|
-
export declare function startLocation(): void
|
|
13
|
-
export declare function startBluetooth(): void
|
|
18
|
+
export declare function startLocation(): Promise<void>;
|
|
19
|
+
export declare function startBluetooth(): Promise<void>;
|
|
14
20
|
export declare function requestFullIntentPermissionAndroid(): void;
|
|
21
|
+
export declare function setRemoteId(remoteId: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
24
|
+
*/
|
|
15
25
|
export declare function setNotificationNameAndroid(name: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated No longer supported.
|
|
28
|
+
*/
|
|
16
29
|
export declare function getNotificationNameAndroid(): Promise<string | null>;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
32
|
+
*/
|
|
17
33
|
export declare function setNotificationNameIOS(name: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated No longer supported.
|
|
36
|
+
*/
|
|
18
37
|
export declare function getNotificationNameIOS(): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
40
|
+
*/
|
|
19
41
|
export declare function setNotificationName(name: string): void;
|
|
20
42
|
export declare function requestScheduleExactAlarmPermissionAndroid(): void;
|
|
21
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAGA,wBAAsB,SAAS,IAAI,OAAO,CAAC,M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/C;AAED,wBAAgB,0CAA0C,SAIzD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grouplinknetwork/rn-grouplink-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Plugin for implementing the company's native sdk group link",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -114,14 +114,14 @@
|
|
|
114
114
|
"trailingComma": "es5",
|
|
115
115
|
"useTabs": false
|
|
116
116
|
},
|
|
117
|
-
|
|
117
|
+
"codegenConfig": {
|
|
118
118
|
"name": "GrouplinkSdkSpec",
|
|
119
119
|
"type": "modules",
|
|
120
120
|
"jsSrcsDir": "src",
|
|
121
121
|
"android": {
|
|
122
122
|
"javaPackageName": "com.grouplinksdk"
|
|
123
|
-
|
|
124
|
-
},
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
125
|
"react-native-builder-bob": {
|
|
126
126
|
"source": "src",
|
|
127
127
|
"output": "lib",
|
|
@@ -7,7 +7,14 @@ export interface Spec extends TurboModule {
|
|
|
7
7
|
startAndroid(token: string, debbugable: boolean): void;
|
|
8
8
|
setFirebaseToken(token: string): void;
|
|
9
9
|
requestFullIntentPermissionAndroid(): void;
|
|
10
|
+
setRemoteId(remoteId: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
13
|
+
*/
|
|
10
14
|
setNotificationNameAndroid(notificationName: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated No longer supported.
|
|
17
|
+
*/
|
|
11
18
|
getNotificationNameAndroid(): Promise<string>;
|
|
12
19
|
requestScheduleExactAlarm(): void;
|
|
13
20
|
|
|
@@ -15,10 +22,17 @@ export interface Spec extends TurboModule {
|
|
|
15
22
|
getUserID(): Promise<string>;
|
|
16
23
|
setDevicePushToken(withPushToken: string): void;
|
|
17
24
|
startIOS(withToken: string): void;
|
|
25
|
+
setRemoteIdIOS(remoteId: string): void;
|
|
18
26
|
startBluetoothIOS(): void;
|
|
19
27
|
checkBluetoothIOS(): void;
|
|
20
28
|
startLocationIOS(): void;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
31
|
+
*/
|
|
21
32
|
setNotificationNameIOS(withNotificationName: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated No longer supported.
|
|
35
|
+
*/
|
|
22
36
|
getNotificationNameIOS(): Promise<string>;
|
|
23
37
|
}
|
|
24
38
|
|
package/src/index.tsx
CHANGED
|
@@ -2,75 +2,121 @@ import { PermissionsAndroid, Platform } from 'react-native';
|
|
|
2
2
|
import NativeGroupLinkSDK from './NativeGrouplinkSdk';
|
|
3
3
|
|
|
4
4
|
export async function getUserId(): Promise<string | null> {
|
|
5
|
-
if (
|
|
5
|
+
if (_isAndroid()) {
|
|
6
6
|
const userID: string = await NativeGroupLinkSDK.getUserIdAndroid();
|
|
7
7
|
if (userID !== 'User not registered yet.') {
|
|
8
8
|
return Promise.resolve(userID);
|
|
9
9
|
} else {
|
|
10
10
|
return Promise.reject('UserID not registered yet');
|
|
11
11
|
}
|
|
12
|
-
}
|
|
13
|
-
if (isiOS()) {
|
|
12
|
+
} else if (_isiOS()) {
|
|
14
13
|
return NativeGroupLinkSDK.getUserID();
|
|
15
14
|
}
|
|
15
|
+
|
|
16
16
|
return Promise.reject('Internal Error');
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated No longer supported.
|
|
21
|
+
*/
|
|
19
22
|
export function setFirebaseToken(token: string) {
|
|
20
|
-
if (
|
|
23
|
+
if (token == null || token === '') {
|
|
24
|
+
_reportError(
|
|
25
|
+
'setFirebaseToken(token: string)',
|
|
26
|
+
'Requires a valid Firebase (FCM) token string.'
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (_isAndroid()) {
|
|
21
33
|
NativeGroupLinkSDK.setFirebaseToken(token);
|
|
22
34
|
}
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
export function startBluetoothIOS() {
|
|
26
|
-
if (
|
|
38
|
+
if (_isiOS()) {
|
|
27
39
|
NativeGroupLinkSDK.startBluetoothIOS();
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated No longer supported.
|
|
45
|
+
*/
|
|
31
46
|
export function setDevicePushTokenIOS(token: string) {
|
|
32
|
-
if (
|
|
47
|
+
if (token == null || token === '') {
|
|
48
|
+
_reportError(
|
|
49
|
+
'setDevicePushTokenIOS(token: string)',
|
|
50
|
+
'Requires a valid device push token string.'
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (_isiOS()) {
|
|
33
57
|
NativeGroupLinkSDK.setDevicePushToken(token);
|
|
34
58
|
}
|
|
35
59
|
}
|
|
36
60
|
|
|
37
61
|
export function startLocationIOS() {
|
|
38
|
-
if (
|
|
62
|
+
if (_isiOS()) {
|
|
39
63
|
NativeGroupLinkSDK.startLocationIOS();
|
|
40
64
|
}
|
|
41
65
|
}
|
|
42
66
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
67
|
+
export function startGrouplink(appLabel: string, debbugable?: boolean | null) {
|
|
68
|
+
if (appLabel == null || appLabel === '') {
|
|
69
|
+
_reportError(
|
|
70
|
+
'startGrouplink(appLabel: string, debbugable?: boolean | null)',
|
|
71
|
+
'Requires a valid GroupLink token string.'
|
|
72
|
+
);
|
|
46
73
|
|
|
47
|
-
|
|
48
|
-
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const debug = debbugable ?? false;
|
|
78
|
+
|
|
79
|
+
if (_isiOS()) {
|
|
80
|
+
NativeGroupLinkSDK.startIOS(appLabel);
|
|
81
|
+
} else if (_isAndroid()) {
|
|
82
|
+
NativeGroupLinkSDK.startAndroid(appLabel, debug);
|
|
83
|
+
}
|
|
49
84
|
}
|
|
50
85
|
|
|
51
|
-
export function
|
|
52
|
-
if (
|
|
53
|
-
|
|
86
|
+
export function startGrouplinkAndroid(appLabel: string, debbugable?: boolean | null) {
|
|
87
|
+
if (appLabel == null || appLabel === '') {
|
|
88
|
+
_reportError(
|
|
89
|
+
'startGrouplinkAndroid(appLabel: string, debbugable?: boolean | null)',
|
|
90
|
+
'Requires a valid GroupLink token string.'
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
return;
|
|
54
94
|
}
|
|
55
|
-
|
|
56
|
-
|
|
95
|
+
|
|
96
|
+
const debug = debbugable ?? false;
|
|
97
|
+
|
|
98
|
+
if (_isAndroid()) {
|
|
99
|
+
NativeGroupLinkSDK.startAndroid(appLabel, debug);
|
|
57
100
|
}
|
|
58
101
|
}
|
|
59
102
|
|
|
60
|
-
export function
|
|
61
|
-
if (
|
|
62
|
-
|
|
103
|
+
export function startGrouplinkIOS(appLabel: string) {
|
|
104
|
+
if (appLabel == null || appLabel === '') {
|
|
105
|
+
_reportError(
|
|
106
|
+
'startGrouplinkIOS(appLabel: string)',
|
|
107
|
+
'Requires a valid GroupLink token string.'
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
return;
|
|
63
111
|
}
|
|
64
|
-
}
|
|
65
112
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
NativeGroupLinkSDK.startIOS(withToken);
|
|
113
|
+
if (_isiOS()) {
|
|
114
|
+
NativeGroupLinkSDK.startIOS(appLabel);
|
|
69
115
|
}
|
|
70
116
|
}
|
|
71
117
|
|
|
72
118
|
export function checkBluetoothIOS() {
|
|
73
|
-
if (
|
|
119
|
+
if (_isiOS()) {
|
|
74
120
|
NativeGroupLinkSDK.checkBluetoothIOS();
|
|
75
121
|
}
|
|
76
122
|
}
|
|
@@ -111,61 +157,147 @@ export async function startLocationAndroid() {
|
|
|
111
157
|
}
|
|
112
158
|
}
|
|
113
159
|
|
|
114
|
-
export function startLocation() {
|
|
115
|
-
if (
|
|
160
|
+
export async function startLocation() {
|
|
161
|
+
if (_isiOS()) {
|
|
116
162
|
NativeGroupLinkSDK.startLocationIOS();
|
|
163
|
+
} else if (_isAndroid()) {
|
|
164
|
+
await startLocationAndroid();
|
|
117
165
|
}
|
|
118
166
|
}
|
|
119
167
|
|
|
120
|
-
export function startBluetooth() {
|
|
121
|
-
if (
|
|
168
|
+
export async function startBluetooth() {
|
|
169
|
+
if (_isiOS()) {
|
|
122
170
|
NativeGroupLinkSDK.startBluetoothIOS();
|
|
171
|
+
} else if (_isAndroid()) {
|
|
172
|
+
await startBluetoothAndroid();
|
|
123
173
|
}
|
|
124
174
|
}
|
|
125
175
|
|
|
126
176
|
export function requestFullIntentPermissionAndroid() {
|
|
127
|
-
if (
|
|
177
|
+
if (_isAndroid()) {
|
|
128
178
|
NativeGroupLinkSDK.requestFullIntentPermissionAndroid();
|
|
129
179
|
}
|
|
130
180
|
}
|
|
131
181
|
|
|
182
|
+
export function setRemoteId(remoteId: string) {
|
|
183
|
+
if (remoteId == null || remoteId === '') {
|
|
184
|
+
_reportError(
|
|
185
|
+
'setRemoteId(remoteId: string)',
|
|
186
|
+
'Requires a valid remote id string.'
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (_isiOS()) {
|
|
193
|
+
NativeGroupLinkSDK.setRemoteIdIOS(remoteId);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if(_isAndroid()){
|
|
197
|
+
NativeGroupLinkSDK.setRemoteId(remoteId);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
204
|
+
*/
|
|
132
205
|
export function setNotificationNameAndroid(name: string) {
|
|
133
|
-
if (
|
|
206
|
+
if (name == null || name === '') {
|
|
207
|
+
_reportError(
|
|
208
|
+
'setNotificationNameAndroid(name: string)',
|
|
209
|
+
'Requires a valid notification name string.'
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (_isAndroid()) {
|
|
134
216
|
NativeGroupLinkSDK.setNotificationNameAndroid(name);
|
|
135
217
|
}
|
|
136
218
|
}
|
|
137
219
|
|
|
220
|
+
/**
|
|
221
|
+
* @deprecated No longer supported.
|
|
222
|
+
*/
|
|
138
223
|
export async function getNotificationNameAndroid(): Promise<string | null> {
|
|
139
|
-
if (
|
|
224
|
+
if (_isAndroid()) {
|
|
140
225
|
return NativeGroupLinkSDK.getNotificationNameAndroid();
|
|
141
226
|
}
|
|
227
|
+
|
|
142
228
|
return null;
|
|
143
229
|
}
|
|
144
230
|
|
|
231
|
+
/**
|
|
232
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
233
|
+
*/
|
|
145
234
|
export function setNotificationNameIOS(name: string) {
|
|
146
|
-
if (
|
|
235
|
+
if (name == null || name === '') {
|
|
236
|
+
_reportError(
|
|
237
|
+
'setNotificationNameIOS(name: string)',
|
|
238
|
+
'Requires a valid notification name string.'
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (_isiOS()) {
|
|
147
245
|
NativeGroupLinkSDK.setNotificationNameIOS(name);
|
|
148
246
|
}
|
|
149
247
|
}
|
|
150
248
|
|
|
249
|
+
/**
|
|
250
|
+
* @deprecated No longer supported.
|
|
251
|
+
*/
|
|
151
252
|
export async function getNotificationNameIOS(): Promise<string | null> {
|
|
152
|
-
if (
|
|
253
|
+
if (_isiOS()) {
|
|
153
254
|
return NativeGroupLinkSDK.getNotificationNameIOS();
|
|
154
255
|
}
|
|
256
|
+
|
|
155
257
|
return null;
|
|
156
258
|
}
|
|
157
259
|
|
|
260
|
+
/**
|
|
261
|
+
* @deprecated The method should not be used. use setRemoteId() instead
|
|
262
|
+
*/
|
|
158
263
|
export function setNotificationName(name: string) {
|
|
159
|
-
if (
|
|
160
|
-
|
|
264
|
+
if (name == null || name === '') {
|
|
265
|
+
_reportError(
|
|
266
|
+
'setNotificationName(name: string)',
|
|
267
|
+
'Requires a valid notification name string.'
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
return;
|
|
161
271
|
}
|
|
162
|
-
|
|
272
|
+
|
|
273
|
+
if (_isAndroid()) {
|
|
274
|
+
NativeGroupLinkSDK.setNotificationNameAndroid(name);
|
|
275
|
+
} else if (_isiOS()) {
|
|
163
276
|
NativeGroupLinkSDK.setNotificationNameIOS(name);
|
|
164
277
|
}
|
|
165
278
|
}
|
|
166
279
|
|
|
167
280
|
export function requestScheduleExactAlarmPermissionAndroid() {
|
|
168
|
-
if (
|
|
281
|
+
if (_isAndroid()) {
|
|
169
282
|
NativeGroupLinkSDK.requestScheduleExactAlarm();
|
|
170
283
|
}
|
|
171
284
|
}
|
|
285
|
+
|
|
286
|
+
function _reportError(signature: string, message: string) {
|
|
287
|
+
const err = new Error(`[GroupLinkSDK] ${signature} → ${message}`);
|
|
288
|
+
|
|
289
|
+
if (err.stack) {
|
|
290
|
+
const lines = err.stack.split('\n');
|
|
291
|
+
err.stack = [lines[0], ...lines.slice(3)].join('\n');
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
console.error(err);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function _isAndroid() {
|
|
298
|
+
return Platform.OS === 'android';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function _isiOS() {
|
|
302
|
+
return Platform.OS === 'ios';
|
|
303
|
+
}
|