Catch some activity not found exceptions for expired builds

fork-5.53.8
Moxie Marlinspike 2017-11-16 12:31:42 -08:00
rodzic de812d3f0f
commit c5a9f27c31
3 zmienionych plików z 21 dodań i 6 usunięć

Wyświetl plik

@ -1248,6 +1248,7 @@
<string name="SearchToolbar_search">Search</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="OutdatedBuildReminder_no_web_browser_installed">No web browser installed!</string>
<!-- EOF -->

Wyświetl plik

@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.components.reminder;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.Util;
@ -18,7 +20,12 @@ public class ExpiredBuildReminder extends Reminder {
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
} catch (android.content.ActivityNotFoundException anfe) {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + context.getPackageName())));
try {
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();
}
}
});
}

Wyświetl plik

@ -1,25 +1,32 @@
package org.thoughtcrime.securesms.components.reminder;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.Util;
public class OutdatedBuildReminder extends Reminder {
private static final String TAG = OutdatedBuildReminder.class.getSimpleName();
public OutdatedBuildReminder(final Context context) {
super(context.getString(R.string.reminder_header_outdated_build),
getPluralsText(context));
setOkListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setOkListener(v -> {
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
} catch (ActivityNotFoundException anfe) {
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
} catch (android.content.ActivityNotFoundException anfe) {
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();
}
}
});