@grouplinknetwork/rn-grouplink-sdk 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +7 -29
  3. package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/7.1/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/7.1/fileChanges/last-build.bin +0 -0
  6. package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/7.1/gc.properties +0 -0
  8. package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
  9. package/android/.gradle/7.4.2/checksums/md5-checksums.bin +0 -0
  10. package/android/.gradle/7.4.2/checksums/sha1-checksums.bin +0 -0
  11. package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  12. package/android/.gradle/7.4.2/executionHistory/executionHistory.lock +0 -0
  13. package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  16. package/android/.gradle/checksums/checksums.lock +0 -0
  17. package/android/.idea/gradle.xml +13 -0
  18. package/android/.idea/misc.xml +9 -0
  19. package/android/.idea/modules/android.iml +18 -0
  20. package/android/.idea/modules.xml +8 -0
  21. package/android/.idea/vcs.xml +6 -0
  22. package/android/build.gradle +149 -149
  23. package/android/gradle.properties +5 -5
  24. package/android/local.properties +8 -0
  25. package/android/src/main/AndroidManifest.xml +24 -24
  26. package/android/src/main/java/com/grouplinksdk/GrouplinkSdkModule.java +133 -120
  27. package/android/src/main/java/com/grouplinksdk/GrouplinkSdkPackage.java +28 -28
  28. package/grouplink-sdk.podspec +36 -36
  29. package/ios/GrouplinkSdk-Bridging-Header.h +1 -1
  30. package/ios/GrouplinkSdk.m +16 -16
  31. package/ios/GrouplinkSdk.swift +30 -30
  32. package/ios/GrouplinkSdk.xcodeproj/project.pbxproj +283 -283
  33. package/lib/commonjs/index.js +13 -0
  34. package/lib/commonjs/index.js.map +1 -1
  35. package/lib/module/index.js +11 -0
  36. package/lib/module/index.js.map +1 -1
  37. package/lib/typescript/index.d.ts +6 -5
  38. package/package.json +131 -130
  39. package/src/index.tsx +86 -72
  40. package/android/libs/lib-grouplink-debug_v3_14_1.aar +0 -0
  41. package/android/libs/lib-grouplink-release_v3_14_1.aar +0 -0
@@ -1,120 +1,133 @@
1
- package com.grouplinksdk;
2
-
3
- import androidx.annotation.NonNull;
4
- import android.content.Context;
5
- import android.content.pm.ApplicationInfo;
6
- import android.os.Bundle;
7
- import android.util.Log;
8
-
9
- import com.facebook.react.bridge.Callback;
10
- import com.facebook.react.bridge.LifecycleEventListener;
11
- import com.facebook.react.bridge.Promise;
12
- import com.facebook.react.bridge.ReactApplicationContext;
13
- import com.facebook.react.bridge.ReactContext;
14
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
15
- import com.facebook.react.bridge.ReactMethod;
16
- import com.facebook.react.bridge.ReadableArray;
17
- import com.facebook.react.bridge.ReadableMap;
18
- import com.facebook.react.modules.core.DeviceEventManagerModule;
19
- import com.facebook.react.module.annotations.ReactModule;
20
- import android.os.Handler;
21
- import android.os.Looper;
22
-
23
- import com.grouplinknetwork.GroupLink;
24
-
25
- @ReactModule(name = GrouplinkSdkModule.NAME)
26
- public class GrouplinkSdkModule extends ReactContextBaseJavaModule implements LifecycleEventListener{
27
- public static final String NAME = "RNGroupLinkSDK";
28
- private ReactApplicationContext mReactApplicationContext;
29
- private ReactContext mReactContext;
30
- private boolean glInitDone = false;
31
- private String token = "";
32
- private boolean debbugable = false;
33
-
34
- public GrouplinkSdkModule(ReactApplicationContext reactContext) {
35
- super(reactContext);
36
- mReactApplicationContext = reactContext;
37
- mReactContext = reactContext;
38
- mReactContext.addLifecycleEventListener(this);
39
- }
40
-
41
- @Override
42
- @NonNull
43
- public String getName() {
44
- return NAME;
45
- }
46
-
47
-
48
- // Example method
49
- // See https://reactnative.dev/docs/native-modules-android
50
- @ReactMethod
51
- public void multiply(double a, double b, Promise promise) {
52
- promise.resolve(a * b);
53
- }
54
-
55
- @ReactMethod
56
- public void registerAndroid(Context context, String token, boolean debuggable) {
57
- Handler handler = new Handler(Looper.getMainLooper());
58
- handler.post(new Runnable() {
59
- public void run(){
60
- GroupLink.register(context, token, debuggable);
61
- }
62
- });
63
- }
64
-
65
- @ReactMethod
66
- public void startAndroid(String token, boolean debbugable) {
67
- this.token = token;
68
- this.debbugable = debbugable;
69
- initGrouplink();
70
- }
71
-
72
- @ReactMethod
73
- public void setFirebaseToken(String token){
74
- Context context = mReactApplicationContext.getApplicationContext();
75
- if(token.equalsIgnoreCase("")){
76
- Log.e("GL_K01", "not initing");
77
- return;
78
- }
79
- if (context == null) {
80
- // in some cases, especially when react-native-navigation is installed,
81
- // the activity can be null, so we can initialize with the context instead
82
- context = mReactApplicationContext.getApplicationContext();
83
- }
84
- try{
85
- GroupLink.setFirebaseToken(context, token);
86
- }catch(Exception e){
87
- e.printStackTrace();
88
- }
89
- }
90
-
91
- private void initGrouplink() {
92
- Context context = mReactApplicationContext.getApplicationContext();
93
- if(token.equalsIgnoreCase("")){
94
- Log.e("GL_K01", "not initing");
95
- return;
96
- }
97
- if (context == null) {
98
- // in some cases, especially when react-native-navigation is installed,
99
- // the activity can be null, so we can initialize with the context instead
100
- context = mReactApplicationContext.getApplicationContext();
101
- }
102
- Log.d("AndroidGL", "init android with: " + token);
103
- registerAndroid(context, token, debbugable);
104
- }
105
-
106
- @Override
107
- public void onHostDestroy() {
108
-
109
- }
110
-
111
- @Override
112
- public void onHostPause() {
113
-
114
- }
115
-
116
- @Override
117
- public void onHostResume() {
118
- }
119
-
120
- }
1
+ package com.grouplinksdk;
2
+
3
+ import androidx.annotation.NonNull;
4
+ import android.content.Context;
5
+ import android.content.pm.ApplicationInfo;
6
+ import android.os.Bundle;
7
+ import android.util.Log;
8
+
9
+ import com.facebook.react.bridge.Callback;
10
+ import com.facebook.react.bridge.LifecycleEventListener;
11
+ import com.facebook.react.bridge.Promise;
12
+ import com.facebook.react.bridge.ReactApplicationContext;
13
+ import com.facebook.react.bridge.ReactContext;
14
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
15
+ import com.facebook.react.bridge.ReactMethod;
16
+ import com.facebook.react.bridge.ReadableArray;
17
+ import com.facebook.react.bridge.ReadableMap;
18
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
19
+ import com.facebook.react.module.annotations.ReactModule;
20
+ import android.os.Handler;
21
+ import android.os.Looper;
22
+ import com.grouplinknetwork.GrouplinkUserIdListener;
23
+
24
+ import com.grouplinknetwork.GroupLink;
25
+
26
+ @ReactModule(name = GrouplinkSdkModule.NAME)
27
+ public class GrouplinkSdkModule extends ReactContextBaseJavaModule implements LifecycleEventListener{
28
+ public static final String NAME = "RNGroupLinkSDK";
29
+ private ReactApplicationContext mReactApplicationContext;
30
+ private ReactContext mReactContext;
31
+ private boolean glInitDone = false;
32
+ private String token = "";
33
+ private boolean debbugable = false;
34
+
35
+ public GrouplinkSdkModule(ReactApplicationContext reactContext) {
36
+ super(reactContext);
37
+ mReactApplicationContext = reactContext;
38
+ mReactContext = reactContext;
39
+ mReactContext.addLifecycleEventListener(this);
40
+ }
41
+
42
+ @Override
43
+ @NonNull
44
+ public String getName() {
45
+ return NAME;
46
+ }
47
+
48
+ @ReactMethod
49
+ public void getUserIdAndroid(Callback callback){
50
+ Context context = mReactApplicationContext.getApplicationContext();
51
+ String userId = "undefined usrId";
52
+ try{
53
+ userId = GroupLink.getUserId(context);
54
+ callback.invoke(""+userId);
55
+ }catch(Exception e){
56
+ e.printStackTrace();
57
+ callback.invoke("not registered");
58
+ }
59
+ }
60
+
61
+ // Example method
62
+ // See https://reactnative.dev/docs/native-modules-android
63
+ @ReactMethod
64
+ public void multiply(double a, double b, Promise promise) {
65
+ promise.resolve(a * b);
66
+ }
67
+
68
+ @ReactMethod
69
+ public void registerAndroid(Context context, String token, boolean debuggable) {
70
+ Handler handler = new Handler(Looper.getMainLooper());
71
+ handler.post(new Runnable() {
72
+ public void run(){
73
+ GroupLink.register(context, token, debuggable);
74
+ }
75
+ });
76
+ }
77
+
78
+ @ReactMethod
79
+ public void startAndroid(String token, boolean debbugable) {
80
+ this.token = token;
81
+ this.debbugable = debbugable;
82
+ initGrouplink();
83
+ }
84
+
85
+ @ReactMethod
86
+ public void setFirebaseToken(String token){
87
+ Context context = mReactApplicationContext.getApplicationContext();
88
+ if(token.equalsIgnoreCase("")){
89
+ Log.e("GL_K01", "not initing");
90
+ return;
91
+ }
92
+ if (context == null) {
93
+ // in some cases, especially when react-native-navigation is installed,
94
+ // the activity can be null, so we can initialize with the context instead
95
+ context = mReactApplicationContext.getApplicationContext();
96
+ }
97
+ try{
98
+ GroupLink.setFirebaseToken(context, token);
99
+ }catch(Exception e){
100
+ e.printStackTrace();
101
+ }
102
+ }
103
+
104
+ private void initGrouplink() {
105
+ Context context = mReactApplicationContext.getApplicationContext();
106
+ if(token.equalsIgnoreCase("")){
107
+ Log.e("GL_K01", "not initing");
108
+ return;
109
+ }
110
+ if (context == null) {
111
+ // in some cases, especially when react-native-navigation is installed,
112
+ // the activity can be null, so we can initialize with the context instead
113
+ context = mReactApplicationContext.getApplicationContext();
114
+ }
115
+ Log.d("AndroidGL", "init android with: " + token);
116
+ registerAndroid(context, token, debbugable);
117
+ }
118
+
119
+ @Override
120
+ public void onHostDestroy() {
121
+
122
+ }
123
+
124
+ @Override
125
+ public void onHostPause() {
126
+
127
+ }
128
+
129
+ @Override
130
+ public void onHostResume() {
131
+ }
132
+
133
+ }
@@ -1,28 +1,28 @@
1
- package com.grouplinksdk;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.ReactPackage;
6
- import com.facebook.react.bridge.NativeModule;
7
- import com.facebook.react.bridge.ReactApplicationContext;
8
- import com.facebook.react.uimanager.ViewManager;
9
-
10
- import java.util.ArrayList;
11
- import java.util.Collections;
12
- import java.util.List;
13
-
14
- public class GrouplinkSdkPackage implements ReactPackage {
15
- @NonNull
16
- @Override
17
- public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
- List<NativeModule> modules = new ArrayList<>();
19
- modules.add(new GrouplinkSdkModule(reactContext));
20
- return modules;
21
- }
22
-
23
- @NonNull
24
- @Override
25
- public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
- return Collections.emptyList();
27
- }
28
- }
1
+ package com.grouplinksdk;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class GrouplinkSdkPackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ modules.add(new GrouplinkSdkModule(reactContext));
20
+ return modules;
21
+ }
22
+
23
+ @NonNull
24
+ @Override
25
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
+ return Collections.emptyList();
27
+ }
28
+ }
@@ -1,36 +1,36 @@
1
- require "json"
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
- folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
-
6
- Pod::Spec.new do |s|
7
- s.name = "grouplink-sdk"
8
- s.version = package["version"]
9
- s.summary = package["description"]
10
- s.homepage = package["homepage"]
11
- s.license = package["license"]
12
- s.authors = package["author"]
13
-
14
- s.platforms = { :ios => "10.0" }
15
- s.source = { :git => "https://github.com/amazingvitor/grouplink-sdk.git", :tag => "#{s.version}" }
16
-
17
- s.source_files = "ios/**/*.{h,m,mm,swift}"
18
-
19
- s.dependency "React-Core"
20
- s.dependency "GroupLinkSDK"
21
-
22
- # Don't install the dependencies when we run `pod install` in the old architecture.
23
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25
- s.pod_target_xcconfig = {
26
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
28
- }
29
-
30
- s.dependency "React-Codegen"
31
- s.dependency "RCT-Folly"
32
- s.dependency "RCTRequired"
33
- s.dependency "RCTTypeSafety"
34
- s.dependency "ReactCommon/turbomodule/core"
35
- end
36
- end
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "grouplink-sdk"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => "10.0" }
15
+ s.source = { :git => "https://github.com/amazingvitor/grouplink-sdk.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
18
+
19
+ s.dependency "React-Core"
20
+ s.dependency "GroupLinkSDK"
21
+
22
+ # Don't install the dependencies when we run `pod install` in the old architecture.
23
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25
+ s.pod_target_xcconfig = {
26
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
28
+ }
29
+
30
+ s.dependency "React-Codegen"
31
+ s.dependency "RCT-Folly"
32
+ s.dependency "RCTRequired"
33
+ s.dependency "RCTTypeSafety"
34
+ s.dependency "ReactCommon/turbomodule/core"
35
+ end
36
+ end
@@ -1,2 +1,2 @@
1
- #import <React/RCTBridgeModule.h>
1
+ #import <React/RCTBridgeModule.h>
2
2
  #import <React/RCTViewManager.h>
@@ -1,16 +1,16 @@
1
- #import <React/RCTBridgeModule.h>
2
-
3
- @interface RCT_EXTERN_MODULE(RNGroupLinkSDK, NSObject)
4
-
5
- RCT_EXTERN_METHOD(startIOS:(NSString)withToken)
6
- RCT_EXTERN_METHOD(startBluetoothIOS)
7
- RCT_EXTERN_METHOD(checkBluetoothIOS)
8
- RCT_EXTERN_METHOD(startLocationIOS)
9
- RCT_EXTERN_METHOD(setDevicePushToken:(NSString)withPushToken)
10
-
11
- + (BOOL)requiresMainQueueSetup
12
- {
13
- return YES;
14
- }
15
-
16
- @end
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(RNGroupLinkSDK, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(startIOS:(NSString)withToken)
6
+ RCT_EXTERN_METHOD(startBluetoothIOS)
7
+ RCT_EXTERN_METHOD(checkBluetoothIOS)
8
+ RCT_EXTERN_METHOD(startLocationIOS)
9
+ RCT_EXTERN_METHOD(setDevicePushToken:(NSString)withPushToken)
10
+
11
+ + (BOOL)requiresMainQueueSetup
12
+ {
13
+ return YES;
14
+ }
15
+
16
+ @end
@@ -1,30 +1,30 @@
1
- import Foundation
2
- import GroupLink
3
-
4
- @objc(RNGroupLinkSDK)
5
- class RNGroupLinkSDK: NSObject {
6
- @objc(startIOS:)
7
- func startIOS(withToken: String) -> Void {
8
- GroupLinkSDK.start(token: withToken)
9
- }
10
-
11
- @objc(setDevicePushToken:)
12
- func setDevicePushToken(withPushToken: String) -> Void {
13
- GroupLinkSDK.sendNotificationToken(withPushToken)
14
- }
15
-
16
- @objc(startBluetoothIOS)
17
- func startBluetoothIOS() -> Void {
18
- GroupLinkSDK.startBluetooth()
19
- }
20
-
21
- @objc(startLocationIOS)
22
- func startLocationIOS() -> Void {
23
- GroupLinkSDK.startLocation()
24
- }
25
-
26
- @objc(checkBluetoothIOS)
27
- func checkBluetoothIOS() -> Void {
28
- GroupLinkSDK.checkBluetooth()
29
- }
30
- }
1
+ import Foundation
2
+ import GroupLink
3
+
4
+ @objc(RNGroupLinkSDK)
5
+ class RNGroupLinkSDK: NSObject {
6
+ @objc(startIOS:)
7
+ func startIOS(withToken: String) -> Void {
8
+ GroupLinkSDK.start(token: withToken)
9
+ }
10
+
11
+ @objc(setDevicePushToken:)
12
+ func setDevicePushToken(withPushToken: String) -> Void {
13
+ GroupLinkSDK.sendNotificationToken(withPushToken)
14
+ }
15
+
16
+ @objc(startBluetoothIOS)
17
+ func startBluetoothIOS() -> Void {
18
+ GroupLinkSDK.startBluetooth()
19
+ }
20
+
21
+ @objc(startLocationIOS)
22
+ func startLocationIOS() -> Void {
23
+ GroupLinkSDK.startLocation()
24
+ }
25
+
26
+ @objc(checkBluetoothIOS)
27
+ func checkBluetoothIOS() -> Void {
28
+ GroupLinkSDK.checkBluetooth()
29
+ }
30
+ }