Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 6a3d0aa

Browse files
jainkuniyakunall17
authored andcommitted
update Dialog: Add preference to don't show again.
1 parent 9fba632 commit 6a3d0aa

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

app/src/main/java/com/zulip/android/ZulipApp.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,12 @@ public void setServerURL(String serverURL) {
411411
ed.apply();
412412
}
413413

414+
public void setDontShowAppDialog(boolean value) {
415+
Editor ed = this.settings.edit();
416+
ed.putBoolean(Constants.DONT_SHOW_APP_UPDATE_DIALOG, value);
417+
ed.apply();
418+
}
419+
414420
public void useDefaultServerURL() {
415421
setServerURL(DEFAULT_SERVER_URL);
416422
}

app/src/main/java/com/zulip/android/util/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class Constants {
1313
public final static boolean DEFAULT_EDITING_ALLOWED = true;
1414
public final static String SERVER_URL = "SERVER_URL";
1515
public static final String CANCEL = "CANCEL";
16+
public static final String DONT_SHOW_APP_UPDATE_DIALOG = "DONT_SHOW_APP_UPDATE_DIALOG";
1617
public static int MILLISECONDS_IN_A_MINUTE = 1000;
1718
public static String DATE_FORMAT = "dd/MM/yyyy";
1819
public static final int REQUEST_PICK_FILE = 3;

app/src/main/java/com/zulip/android/util/ShowAppUpdateDialog.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@
77
import android.support.v7.app.AlertDialog;
88

99
import com.zulip.android.R;
10+
import com.zulip.android.ZulipApp;
1011

1112

1213
public class ShowAppUpdateDialog {
1314

1415
public static void showDialog(final Context context) {
16+
// check whether don't show shown is opted
17+
if (ZulipApp.get().getSettings().getBoolean(Constants.DONT_SHOW_APP_UPDATE_DIALOG, false)) {
18+
return;
19+
}
20+
1521
AlertDialog.Builder builder = new AlertDialog.Builder(context);
1622

1723
builder.setPositiveButton(R.string.update, new DialogInterface.OnClickListener() {
24+
@Override
1825
public void onClick(DialogInterface dialog, int id) {
1926
// open new app page on play store
2027
Intent intent = new Intent(Intent.ACTION_VIEW,
@@ -23,15 +30,23 @@ public void onClick(DialogInterface dialog, int id) {
2330
}
2431
});
2532
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
33+
@Override
2634
public void onClick(DialogInterface dialog, int id) {
2735

2836
}
2937
});
38+
39+
builder.setNeutralButton(R.string.dont_show_again, new DialogInterface.OnClickListener() {
40+
@Override
41+
public void onClick(DialogInterface dialogInterface, int i) {
42+
ZulipApp.get().setDontShowAppDialog(true);
43+
}
44+
});
45+
3046
AlertDialog dialog = builder.create();
3147
dialog.setMessage("This project is deprecated in favor of React Native app, " +
3248
"which supports both iOS and Android. Click update to switch to the new app.");
3349

3450
dialog.show();
35-
3651
}
3752
}

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,5 @@
185185
<string name="placeholder_sender_name">Sender name</string>
186186
<string name="placeholder_social">Social</string>
187187
<string name="update">Update</string>
188+
<string name="dont_show_again">Don\'t show again</string>
188189
</resources>

0 commit comments

Comments
 (0)