Skip to content

Commit de5ed49

Browse files
committed
fix: convert retry interval from seconds to milliseconds in RetryPolicy configuration
1 parent 8ae3889 commit de5ed49

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 2.2.0-alpha.2
2+
3+
### Updates
4+
* Changed `onJWTError` to `onJwtError`
5+
* Changed `IterableRetryBackoff` enum keys to be lowercase for consistency
6+
across application
7+
8+
### Fixes
9+
* Fixed Android `retryInterval` not being respected - Android native SDK expects milliseconds while iOS expects seconds, added conversion in Android bridge layer
10+
111
## 2.2.0-alpha.1
212

313
### Updates
@@ -6,7 +16,6 @@
616
### Fixes
717
* [SDK-151] Fixed "cannot read property authtoken of undefined" error
818

9-
1019
## 2.2.0-alpha.0
1120

1221
### Updates

android/src/main/java/com/iterable/reactnative/Serialization.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,17 @@ static IterableConfig.Builder getConfigFromReadableMap(ReadableMap iterableConte
222222
JSONObject retryPolicyJson = iterableContextJSON.getJSONObject("retryPolicy");
223223
int maxRetry = retryPolicyJson.getInt("maxRetry");
224224
long retryInterval = retryPolicyJson.getLong("retryInterval");
225+
226+
// TODO [SDK-197]: Create consistency between Android and iOS
227+
// instead of converting here
228+
// Convert from seconds to milliseconds for Android native SDK
229+
long retryIntervalMs = retryInterval * 1000;
225230
String retryBackoff = retryPolicyJson.getString("retryBackoff");
226231
RetryPolicy.Type retryPolicyType = RetryPolicy.Type.LINEAR;
227232
if (retryBackoff.equals("EXPONENTIAL")) {
228233
retryPolicyType = RetryPolicy.Type.EXPONENTIAL;
229234
}
230-
configBuilder.setAuthRetryPolicy(new RetryPolicy(maxRetry, retryInterval, retryPolicyType));
235+
configBuilder.setAuthRetryPolicy(new RetryPolicy(maxRetry, retryIntervalMs, retryPolicyType));
231236
}
232237

233238
return configBuilder;

0 commit comments

Comments
 (0)