Skip to content

Commit

Permalink
Merge pull request #291 from RoverPlatform/hotfix/missing-push-token-…
Browse files Browse the repository at this point in the history
…should-be-fetched-rather-than-reset

v2.1.8: missing push token should be fetched rather than reset
  • Loading branch information
orospakr authored Nov 1, 2018
2 parents b284924 + 91a179b commit f8f8428
Show file tree
Hide file tree
Showing 94 changed files with 425 additions and 64 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ block.
```groovy
dependencies {
// ...
implementation "io.rover:core:2.1.7"
implementation "io.rover:notifications:2.1.7"
implementation "io.rover:experiences:2.1.7"
implementation "io.rover:location:2.1.7"
implementation "io.rover:debug:2.1.7"
implementation "io.rover:core:2.1.8"
implementation "io.rover:notifications:2.1.8"
implementation "io.rover:experiences:2.1.8"
implementation "io.rover:location:2.1.8"
implementation "io.rover:debug:2.1.8"
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildscript {
// all of the modules of the SDK will use this version number.
ext.rover_sdk_version = '2.1.7'
ext.rover_sdk_version = '2.1.8'
ext.rover_sdk_version_code = 3

ext.kotlin_version = '1.2.51'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package io.rover.core.events.contextproviders

import android.os.Handler
import io.rover.core.data.domain.DeviceContext
import io.rover.core.events.ContextProvider
import io.rover.core.events.PushTokenTransmissionChannel
import io.rover.core.logging.log
import io.rover.core.platform.LocalStorage
import io.rover.core.platform.whenNotNull
import java.util.Date
import java.util.concurrent.Executors

/**
* Captures and adds the Firebase push token to [DeviceContext]. As a [PushTokenTransmissionChannel], it
* expects to be informed of any changes to the push token.
*/
class FirebasePushTokenContextProvider(
localStorage: LocalStorage,
private val resetPushToken: () -> Unit
localStorage: LocalStorage
) : ContextProvider, PushTokenTransmissionChannel {
override fun captureContext(deviceContext: DeviceContext): DeviceContext {
return deviceContext.copy(pushToken = token.whenNotNull {
Expand All @@ -33,12 +30,14 @@ class FirebasePushTokenContextProvider(
this.timestamp = null
timestampAsNeeded()
val elapsed = (Date().time - launchTime.time) / 1000
log.v("Push token set after $elapsed seconds.")
log.v("A new push token set after $elapsed seconds: $token")
} else {
log.v("Push token update received, token not changed.")
}
}

private val launchTime = Date()
private val keyValueStorage = localStorage.getKeyValueStorageFor(Companion.STORAGE_CONTEXT_IDENTIFIER)
private val keyValueStorage = localStorage.getKeyValueStorageFor(STORAGE_CONTEXT_IDENTIFIER)

private var token: String?
get() = keyValueStorage[TOKEN_KEY]
Expand All @@ -62,27 +61,15 @@ class FirebasePushTokenContextProvider(

init {
if (token == null) {
log.e("No push token is set yet.")
Handler().postDelayed({
if (token == null) {
// token still null? then attempt a reset. This case can happen if the FCM token
// was already set and received before the Rover SDK 2.x was integrated, meaning
// that FCM believes that the app knows what the push token is, but at least the
// Rover SDK itself does not.

log.w("Push token is still not set. Perhaps token was received before Rover SDK was integrated. Forcing reset.")
Executors.newSingleThreadExecutor().execute {
resetPushToken()
}
}
}, TOKEN_RESET_TIMEOUT)
log.i("No push token is set yet.")
} else {
log.i("Push token already set: $token")
}
}

companion object {
private const val STORAGE_CONTEXT_IDENTIFIER = "io.rover.rover.fcm-push-context-provider"
private const val TOKEN_KEY = "push-token"
private const val TIMESTAMP_KEY = "timestamp"
private const val TOKEN_RESET_TIMEOUT = 4 * 1000L
}
}
Binary file added maven/io/rover/core/2.1.8/core-2.1.8-javadoc.jar
Binary file not shown.
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8-javadoc.jar.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
73cace8902ba59c2e3d48d4b4cebef40
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8-javadoc.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
75631be8dc798a613fa5dffd1947215b8c9349e0
Binary file added maven/io/rover/core/2.1.8/core-2.1.8-sources.jar
Binary file not shown.
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8-sources.jar.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
553f3267ec5ddb3b37e8eff73dd97873
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8-sources.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c7431312c70ce6120ce1818a0d24f4841d47cae9
Binary file added maven/io/rover/core/2.1.8/core-2.1.8.aar
Binary file not shown.
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8.aar.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a6cf9262991713424feb8ce55e269f2e
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8.aar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e618f2ce8499b76d45fe0c5779795eace023851e
64 changes: 64 additions & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>io.rover</groupId>
<artifactId>core</artifactId>
<version>2.1.8</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-android-extensions-runtime</artifactId>
<version>1.2.51</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>transition</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>customtabs</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>1.2.51</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>android.arch.lifecycle</groupId>
<artifactId>extensions</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>android.arch.work</groupId>
<artifactId>work-runtime-ktx</artifactId>
<version>1.0.0-alpha10</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8.pom.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dac0eb3c6678ce823e3276f589d9d3db
1 change: 1 addition & 0 deletions maven/io/rover/core/2.1.8/core-2.1.8.pom.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
423101c9510648a02be1d6cd251b5afe359cfeef
5 changes: 3 additions & 2 deletions maven/io/rover/core/maven-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>io.rover</groupId>
<artifactId>core</artifactId>
<versioning>
<release>2.1.7</release>
<release>2.1.8</release>
<versions>
<version>2.0.0-beta.1-SNAPSHOT</version>
<version>2.0.0-beta.2-SNAPSHOT</version>
Expand All @@ -17,7 +17,8 @@
<version>2.1.5</version>
<version>2.1.6</version>
<version>2.1.7</version>
<version>2.1.8</version>
</versions>
<lastUpdated>20181025143939</lastUpdated>
<lastUpdated>20181101154534</lastUpdated>
</versioning>
</metadata>
2 changes: 1 addition & 1 deletion maven/io/rover/core/maven-metadata.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5ca10a92e8a62de3867c4376f473a58d
6af4a6e79a0cdff84effcbb97dd4c111
2 changes: 1 addition & 1 deletion maven/io/rover/core/maven-metadata.xml.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
071eafbc909436b98ced964d9b7b80121e169b54
cda046321de4f05968c84cdc5ecbd6d828752e3f
Binary file added maven/io/rover/debug/2.1.8/debug-2.1.8-javadoc.jar
Binary file not shown.
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8-javadoc.jar.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f34339cc9fcdf949b6d92f721344aec6
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8-javadoc.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f902e5f41d31a1df5f264900d9297257a93c50b6
Binary file not shown.
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8-sources.jar.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eaa6c3f0ad709d99df5c1f6a95132fc9
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8-sources.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bf2803aac3f652b2bed5559ff38cfdf7a5806ebc
Binary file added maven/io/rover/debug/2.1.8/debug-2.1.8.aar
Binary file not shown.
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8.aar.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ed023df3d4334365b06af590b3da6df
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8.aar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d195067a30b47daaa0a0170c4c616b51cfc6de23
39 changes: 39 additions & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>io.rover</groupId>
<artifactId>debug</artifactId>
<version>2.1.8</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>preference-v7</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>1.2.51</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.rover</groupId>
<artifactId>core</artifactId>
<version>2.1.8</version>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8.pom.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d7af8263b1c18ea5a78a0db626ad0ce5
1 change: 1 addition & 0 deletions maven/io/rover/debug/2.1.8/debug-2.1.8.pom.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dc11da081b1e7857b6f8de5aeccc25ad8cf2e803
5 changes: 3 additions & 2 deletions maven/io/rover/debug/maven-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>io.rover</groupId>
<artifactId>debug</artifactId>
<versioning>
<release>2.1.7</release>
<release>2.1.8</release>
<versions>
<version>2.0.0-beta.1-SNAPSHOT</version>
<version>2.0.0-beta.2-SNAPSHOT</version>
Expand All @@ -17,7 +17,8 @@
<version>2.1.5</version>
<version>2.1.6</version>
<version>2.1.7</version>
<version>2.1.8</version>
</versions>
<lastUpdated>20181025144018</lastUpdated>
<lastUpdated>20181101154606</lastUpdated>
</versioning>
</metadata>
2 changes: 1 addition & 1 deletion maven/io/rover/debug/maven-metadata.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
60d0b8ed596b1bbc6e0d01bd89353e93
f2d94a9b20579a0ee9c0550810eb254a
2 changes: 1 addition & 1 deletion maven/io/rover/debug/maven-metadata.xml.sha1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5990e951d6b7bdf8349005d86a11148fbed58330
7d6d2547577209beac806fb4b5fcc9f39380d840
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dd3ce99b4e02454af037050932b1576e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
936428d17d59b92df07a0d62922895de1c9c30b3
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a7b094c31c1d11b6f5158b20857b2cae
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
97dfbf3ded37852ceca40224603736c629455aa2
Binary file not shown.
1 change: 1 addition & 0 deletions maven/io/rover/experiences/2.1.8/experiences-2.1.8.aar.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd691cfeaa99ce02bbb03bc44d067ca7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8c8e3ca980ba1e28ecfdc1e88b66f300940fea7c
69 changes: 69 additions & 0 deletions maven/io/rover/experiences/2.1.8/experiences-2.1.8.pom
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>io.rover</groupId>
<artifactId>experiences</artifactId>
<version>2.1.8</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-android-extensions-runtime</artifactId>
<version>1.2.51</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>1.2.51</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>transition</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>recyclerview-v7</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>design</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-vector-drawable</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>customtabs</artifactId>
<version>27.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.rover</groupId>
<artifactId>core</artifactId>
<version>2.1.8</version>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions maven/io/rover/experiences/2.1.8/experiences-2.1.8.pom.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6ccf0548aef98e41650a11f12cbdc9da
Loading

0 comments on commit f8f8428

Please sign in to comment.