mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-28 18:01:05 +00:00
Catch some activity not found exceptions for expired builds
This commit is contained in:
parent
de812d3f0f
commit
c5a9f27c31
@ -1248,6 +1248,7 @@
|
|||||||
<string name="SearchToolbar_search">Search</string>
|
<string name="SearchToolbar_search">Search</string>
|
||||||
<string name="UnauthorizedReminder_device_no_longer_registered">Device no longer registered</string>
|
<string name="UnauthorizedReminder_device_no_longer_registered">Device no longer registered</string>
|
||||||
<string name="UnauthorizedReminder_this_is_likely_because_you_registered_your_phone_number_with_Signal_on_a_different_device">This is likely because you registered your phone number with Signal on a different device. Tap to re-register.</string>
|
<string name="UnauthorizedReminder_this_is_likely_because_you_registered_your_phone_number_with_Signal_on_a_different_device">This is likely because you registered your phone number with Signal on a different device. Tap to re-register.</string>
|
||||||
|
<string name="OutdatedBuildReminder_no_web_browser_installed">No web browser installed!</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- EOF -->
|
<!-- EOF -->
|
||||||
|
@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.components.reminder;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
@ -18,7 +20,12 @@ public class ExpiredBuildReminder extends Reminder {
|
|||||||
try {
|
try {
|
||||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
|
||||||
} catch (android.content.ActivityNotFoundException anfe) {
|
} catch (android.content.ActivityNotFoundException anfe) {
|
||||||
|
try {
|
||||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName())));
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName())));
|
||||||
|
} catch (android.content.ActivityNotFoundException anfe2) {
|
||||||
|
Log.w(TAG, anfe2);
|
||||||
|
Toast.makeText(context, R.string.OutdatedBuildReminder_no_web_browser_installed, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,32 @@
|
|||||||
package org.thoughtcrime.securesms.components.reminder;
|
package org.thoughtcrime.securesms.components.reminder;
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
public class OutdatedBuildReminder extends Reminder {
|
public class OutdatedBuildReminder extends Reminder {
|
||||||
|
|
||||||
|
private static final String TAG = OutdatedBuildReminder.class.getSimpleName();
|
||||||
|
|
||||||
public OutdatedBuildReminder(final Context context) {
|
public OutdatedBuildReminder(final Context context) {
|
||||||
super(context.getString(R.string.reminder_header_outdated_build),
|
super(context.getString(R.string.reminder_header_outdated_build),
|
||||||
getPluralsText(context));
|
getPluralsText(context));
|
||||||
setOkListener(new View.OnClickListener() {
|
setOkListener(v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
try {
|
try {
|
||||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
|
||||||
} catch (android.content.ActivityNotFoundException anfe) {
|
} catch (ActivityNotFoundException anfe) {
|
||||||
|
try {
|
||||||
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName())));
|
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName())));
|
||||||
|
} catch (ActivityNotFoundException anfe2) {
|
||||||
|
Log.w(TAG, anfe2);
|
||||||
|
Toast.makeText(context, R.string.OutdatedBuildReminder_no_web_browser_installed, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user