lemnisk-react-native 0.1.10 → 0.1.12

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.
@@ -56,7 +56,7 @@ repositories {
56
56
  dependencies {
57
57
  //noinspection GradleDynamicVersion
58
58
  implementation "com.facebook.react:react-native:+" // From node_modules
59
- implementation 'co.lemnisk.app.android:AndroidSDK:1.1.40'
59
+ implementation 'co.lemnisk.app.android:AndroidSDK:1.1.44'
60
60
  implementation 'org.apache.commons:commons-text:1.9'
61
61
  //implementation(name:'AndroidSDK-release', ext:'aar')
62
62
  implementation group: 'joda-time', name: 'joda-time', version: '2.10.10'
@@ -16,9 +16,13 @@ import com.google.firebase.messaging.FirebaseMessaging;
16
16
  import javax.annotation.Nullable;
17
17
  import org.json.JSONObject;
18
18
  import java.util.Iterator;
19
+ import com.facebook.react.bridge.ReadableMapKeySetIterator;
19
20
 
20
21
  import co.lemnisk.app.android.AttributeBuilder;
21
22
  import co.lemnisk.app.android.LemniskHelper;
23
+ import co.lemnisk.app.android.Utils;
24
+ import co.lemnisk.app.android.LemConstants;
25
+ import android.text.TextUtils;
22
26
 
23
27
  @ReactModule(name = LemniskSdkModule.NAME)
24
28
  public class LemniskSdkModule extends ReactContextBaseJavaModule {
@@ -35,8 +39,12 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
35
39
  @Override
36
40
  public void onSuccess(@NonNull String s) {
37
41
  Log.d("Firebase Token","onSuccess ========> : "+s);
38
- helper.setGCMToken(s);
42
+ String previousToken = Utils.getInstance(reactContext).getStringFromSharedPrefs(LemConstants.PREFS_GCM_TOKEN);
39
43
  helper.init();
44
+ if(!TextUtils.isEmpty(previousToken) && !s.equalsIgnoreCase(previousToken)){
45
+ Utils.getInstance(reactContext).setStringInSharedPrefs(LemConstants.PREFS_GCM_TOKEN, "");
46
+ helper.setGCMToken(s);
47
+ }
40
48
  }
41
49
  });
42
50
  }
@@ -60,6 +68,13 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
60
68
  builder.addAttribute(key, nativeMap.get(key).toString());
61
69
  }
62
70
  }
71
+ else{
72
+ Iterator<String> keys = attr.keys();
73
+ while (keys.hasNext()) {
74
+ String key = keys.next();
75
+ builder.addAttribute(key, attr.get(key).toString());
76
+ }
77
+ }
63
78
  return builder.build();
64
79
  }
65
80
  catch (Exception e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemnisk-react-native",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "plugin to setup the lemnisk sdk on both android and ios platform",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",