File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed
src/main/java/com/raven/ravenandroidsdk Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ android {
17
17
buildToolsVersion ' 30.0.3'
18
18
19
19
defaultConfig {
20
- minSdkVersion 21
20
+ minSdkVersion 16
21
21
targetSdkVersion 30
22
22
versionCode 1
23
- versionName " 1.0.5 "
23
+ versionName " 1.0.6 "
24
24
25
25
testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
26
26
consumerProguardFiles ' consumer-rules.pro'
@@ -67,7 +67,7 @@ afterEvaluate {
67
67
// You can then customize attributes of the publication as shown below.
68
68
groupId = ' com.raven'
69
69
artifactId = ' raven-android-sdk'
70
- version = ' 1.0.5 '
70
+ version = ' 1.0.6 '
71
71
}
72
72
}
73
73
}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.raven.ravenandroidsdk
3
3
internal const val PREF_APP_ID = " PREF_RAVEN_APP_ID"
4
4
internal const val PREF_USER_ID = " PREF_RAVEN_USER_ID"
5
5
internal const val PREF_USER_DEVICE_ID = " PREF_USER_DEVICE_ID"
6
+ internal const val PREF_USER_FCM_TOKEN = " PREF_USER_FCM_TOKEN"
6
7
internal const val PREF_SECRET_KEY = " PREF_SECRET_KEY"
7
8
internal const val PREF_RAVEN_USER = " PREF_RAVEN_USER"
8
9
Original file line number Diff line number Diff line change @@ -148,7 +148,12 @@ object RavenSdk {
148
148
return
149
149
}
150
150
151
- // check if cached token is same as the argument
151
+ // check if token already sent to server
152
+ if (Prefs .getString(PREF_USER_FCM_TOKEN , null ) == token) {
153
+ return
154
+ }
155
+
156
+ // check if token already present with server
152
157
val currentUser = getCurrentUser()
153
158
var isUpdate = false
154
159
for (item in currentUser?.devices ? : arrayListOf ()) {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package com.raven.ravenandroidsdk.api.controllers
2
2
3
3
import com.raven.ravenandroidsdk.PLATFORM
4
4
import com.raven.ravenandroidsdk.PREF_USER_DEVICE_ID
5
+ import com.raven.ravenandroidsdk.PREF_USER_FCM_TOKEN
5
6
import com.raven.ravenandroidsdk.RavenSdk
6
7
import com.raven.ravenandroidsdk.api.ApiEndpoints
7
8
import com.raven.ravenandroidsdk.models.Device
@@ -55,6 +56,7 @@ internal class UpdateTokenController : Callback<Device?> {
55
56
setCurrentUser(currentUser)
56
57
57
58
Prefs .putString(PREF_USER_DEVICE_ID , device?.deviceSid)
59
+ Prefs .putString(PREF_USER_FCM_TOKEN , device?.fcmToken)
58
60
59
61
callback?.onSuccess()
60
62
} else {
You can’t perform that action at this time.
0 commit comments