Skip to content

Commit

Permalink
Fixed the incorrect handling of version numbers (double means we can …
Browse files Browse the repository at this point in the history
…only have x.x where as the version scheme is x.x.x. Also fixed the notification launch bug introduced in 1.2
  • Loading branch information
Github committed May 7, 2017
1 parent 7e05edf commit f3b64cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 19
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
versionName "1.2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
22 changes: 18 additions & 4 deletions app/src/main/java/eu/aero2x/andromedab/ContactSelect.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ public void onResponse(String response) {
JSONObject versionObject = new JSONObject(response);
//Log the server version
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.VALUE, "" + versionObject.getDouble("version"));
bundle.putString(FirebaseAnalytics.Param.VALUE, versionObject.getString("version"));
mFirebaseAnalytics.logEvent("server_version", bundle);

Version serverVersion = new Version("" + versionObject.getDouble("version"));
Version serverVersion = new Version(versionObject.getString("version"));


//Check if our server version is below the app's required
Expand Down Expand Up @@ -416,6 +416,20 @@ protected void handleConversationBundle(String response) {
conversationDataSource.add(i,conversation); //store our conversation
}

//Note to future self:: don't remove this sort here. If you do, you break the contact search
Collections.sort(conversationDataSource, new Comparator<JSONObject>() {
@Override
public int compare(JSONObject t0, JSONObject t1) {
try {
return Integer.compare(t1.getJSONObject("lastMessage").getInt("date"),t0.getJSONObject("lastMessage").getInt("date"));
}catch (JSONException e) {
e.printStackTrace();
FirebaseCrash.log("Compare failed");
FirebaseCrash.report(e);
return -1;
}
}
});

for (int i = 0; i != conversationCount; i++) {
//Grab our conversation ahead of time
Expand Down Expand Up @@ -529,14 +543,14 @@ public int getUnreadCount() {
});
}

Collections.sort(conversationList, new Comparator<IDialog>() {
/* Collections.sort(conversationList, new Comparator<IDialog>() {
@Override
public int compare(IDialog t0, IDialog t1) {
return t1.getLastMessage().getCreatedAt().compareTo(t0.getLastMessage().getCreatedAt());
}
});
});*/
dialogsListAdapter.setItems(conversationList);
Log.d("Contacts","Notification: " + incomingNotificationContact);
//Now that we're done, check if we waited to launch a conversation
Expand Down

0 comments on commit f3b64cc

Please sign in to comment.