Skip to content

Commit

Permalink
Release 9.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rlepinski committed Aug 29, 2019
1 parent 95030d8 commit afa8024
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ Android ChangeLog

[Migration Guides](https://github.com/urbanairship/android-library/tree/master/documentation/migration)

Version 9.7.2 - August 30, 2019
===============================
Fixes an issue where push message could result in duplicate push notifications. Applications that are
running 9.4.0 - 9.7.1 should update.

Changes
-------
- Fixes issue with double processing messages on older devices.


Version 9.7.1 - March 14, 2019
==============================

Expand Down
2 changes: 1 addition & 1 deletion airship.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Airship Version - major.minor.patch
version = 9.7.1
version = 9.7.2

# Airship Version Qualifier beta, release, etc...
#versionQualifier = beta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ static final class QuietTime {


private final Object tagLock = new Object();
private final Object uniqueIdLock = new Object();


/**
Expand Down Expand Up @@ -1186,32 +1187,34 @@ boolean isUniqueCanonicalId(@Nullable String canonicalId) {
return true;
}

JsonList jsonList = null;
try {
jsonList = JsonValue.parseString(preferenceDataStore.getString(LAST_CANONICAL_IDS_KEY, null)).getList();
} catch (JsonException e) {
Logger.debug("PushJobHandler - Unable to parse canonical Ids.", e);
}
synchronized (uniqueIdLock) {
JsonList jsonList = null;
try {
jsonList = JsonValue.parseString(preferenceDataStore.getString(LAST_CANONICAL_IDS_KEY, null)).getList();
} catch (JsonException e) {
Logger.debug("PushJobHandler - Unable to parse canonical Ids.", e);
}

List<JsonValue> canonicalIds = jsonList == null ? new ArrayList<JsonValue>() : jsonList.getList();
List<JsonValue> canonicalIds = jsonList == null ? new ArrayList<JsonValue>() : jsonList.getList();

// Wrap the canonicalId
JsonValue id = JsonValue.wrap(canonicalId);
// Wrap the canonicalId
JsonValue id = JsonValue.wrap(canonicalId);

// Check if the list contains the canonicalId
if (canonicalIds.contains(id)) {
return false;
}
// Check if the list contains the canonicalId
if (canonicalIds.contains(id)) {
return false;
}

// Add it
canonicalIds.add(id);
if (canonicalIds.size() > MAX_CANONICAL_IDS) {
canonicalIds = canonicalIds.subList(canonicalIds.size() - MAX_CANONICAL_IDS, canonicalIds.size());
}
// Add it
canonicalIds.add(id);
if (canonicalIds.size() > MAX_CANONICAL_IDS) {
canonicalIds = canonicalIds.subList(canonicalIds.size() - MAX_CANONICAL_IDS, canonicalIds.size());
}

// Store the new list
preferenceDataStore.put(LAST_CANONICAL_IDS_KEY, JsonValue.wrapOpt(canonicalIds).toString());
// Store the new list
preferenceDataStore.put(LAST_CANONICAL_IDS_KEY, JsonValue.wrapOpt(canonicalIds).toString());

return true;
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ public void run() {
handler.post(new Runnable() {
@Override
public void run() {
// Process the push
pushRunnable.run();

pushes--;
if (pushes <= 0) {
stopSelf(lastStartId);
Expand Down

0 comments on commit afa8024

Please sign in to comment.