mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
wrap with try-catch
This commit is contained in:
@@ -423,8 +423,14 @@ public abstract class BaseConversationListFragment extends Fragment implements A
|
||||
.setIcon(IconCompat.createWithAdaptiveBitmap(avatar))
|
||||
.setIntent(intent)
|
||||
.build();
|
||||
boolean success =
|
||||
ShortcutManagerCompat.requestPinShortcut(activity, shortcutInfoCompat, null);
|
||||
|
||||
boolean success;
|
||||
try {
|
||||
success = ShortcutManagerCompat.requestPinShortcut(activity, shortcutInfoCompat, null);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "ErrAddToHomescreen: requestPinShortcut() failed", e);
|
||||
success = false;
|
||||
}
|
||||
Util.runOnMain(
|
||||
() -> {
|
||||
if (!success) {
|
||||
|
||||
@@ -547,7 +547,14 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
|
||||
Toast.makeText(context, R.string.one_moment, Toast.LENGTH_SHORT).show();
|
||||
Util.runOnAnyBackgroundThread(
|
||||
() -> {
|
||||
if (!ShortcutManagerCompat.requestPinShortcut(context, shortcutInfoCompat, null)) {
|
||||
boolean success;
|
||||
try {
|
||||
sucess = ShortcutManagerCompat.requestPinShortcut(context, shortcutInfoCompat, null);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "ErrAddToHomescreen: requestPinShortcut() failed", e);
|
||||
success = false;
|
||||
}
|
||||
if (!success) {
|
||||
Util.runOnMain(
|
||||
() ->
|
||||
Toast.makeText(
|
||||
|
||||
Reference in New Issue
Block a user