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

Commit 9fba632

Browse files
jainkuniyakunall17
authored andcommitted
update Dialog: Show app update to ZulipMobile dialog on start up.
Dialog button have play store link.
1 parent 20de923 commit 9fba632

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

app/src/main/java/com/zulip/android/activities/LoginActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import com.zulip.android.util.AnimationHelper;
4343
import com.zulip.android.util.CommonProgressDialog;
4444
import com.zulip.android.util.Constants;
45+
import com.zulip.android.util.ShowAppUpdateDialog;
4546

4647
import org.json.JSONException;
4748
import org.json.JSONObject;
@@ -82,6 +83,9 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener,
8283
protected void onCreate(Bundle savedInstanceState) {
8384
super.onCreate(savedInstanceState);
8485

86+
//show app update dialog
87+
ShowAppUpdateDialog.showDialog(LoginActivity.this);
88+
8589
setContentView(R.layout.login);
8690

8791
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

app/src/main/java/com/zulip/android/activities/ZulipActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
import com.zulip.android.util.ListDialog;
119119
import com.zulip.android.util.MutedTopics;
120120
import com.zulip.android.util.RemoveViewsOnScroll;
121+
import com.zulip.android.util.ShowAppUpdateDialog;
121122
import com.zulip.android.util.SwipeRemoveLinearLayout;
122123
import com.zulip.android.util.UrlHelper;
123124
import com.zulip.android.util.ZLog;
@@ -350,6 +351,9 @@ protected void onCreate(Bundle savedInstanceState) {
350351
return;
351352
}
352353

354+
// show app update dialog
355+
ShowAppUpdateDialog.showDialog(ZulipActivity.this);
356+
353357
if (mMutedTopics == null) {
354358
mMutedTopics = MutedTopics.get();
355359
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.zulip.android.util;
2+
3+
import android.content.Context;
4+
import android.content.DialogInterface;
5+
import android.content.Intent;
6+
import android.net.Uri;
7+
import android.support.v7.app.AlertDialog;
8+
9+
import com.zulip.android.R;
10+
11+
12+
public class ShowAppUpdateDialog {
13+
14+
public static void showDialog(final Context context) {
15+
AlertDialog.Builder builder = new AlertDialog.Builder(context);
16+
17+
builder.setPositiveButton(R.string.update, new DialogInterface.OnClickListener() {
18+
public void onClick(DialogInterface dialog, int id) {
19+
// open new app page on play store
20+
Intent intent = new Intent(Intent.ACTION_VIEW,
21+
Uri.parse("https://play.google.com/store/apps/details?id=com.zulipmobile&hl=en_IN"));
22+
context.startActivity(intent);
23+
}
24+
});
25+
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
26+
public void onClick(DialogInterface dialog, int id) {
27+
28+
}
29+
});
30+
AlertDialog dialog = builder.create();
31+
dialog.setMessage("This project is deprecated in favor of React Native app, " +
32+
"which supports both iOS and Android. Click update to switch to the new app.");
33+
34+
dialog.show();
35+
36+
}
37+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,5 @@
184184
<string name="placeholder_message_here">Message here</string>
185185
<string name="placeholder_sender_name">Sender name</string>
186186
<string name="placeholder_social">Social</string>
187+
<string name="update">Update</string>
187188
</resources>

0 commit comments

Comments
 (0)