kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix crash when opening notification settings.
rodzic
260e572071
commit
1764b21214
|
@ -104,7 +104,7 @@ class NotificationsSettingsFragment : DSLSettingsFragment(R.string.preferences__
|
|||
summary = DSLSettingsText.from(R.string.preferences__change_sound_and_vibration),
|
||||
isEnabled = state.messageNotificationsState.notificationsEnabled,
|
||||
onClick = {
|
||||
NotificationChannels.getInstance().openChannelSettings(NotificationChannels.getInstance().messagesChannel, null)
|
||||
NotificationChannels.getInstance().openChannelSettings(requireActivity(), NotificationChannels.getInstance().messagesChannel, null)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
|
|
|
@ -91,7 +91,7 @@ class CustomNotificationsSettingsFragment : DSLSettingsFragment(R.string.CustomN
|
|||
title = DSLSettingsText.from(R.string.CustomNotificationsDialogFragment__customize),
|
||||
summary = DSLSettingsText.from(R.string.CustomNotificationsDialogFragment__change_sound_and_vibration),
|
||||
isEnabled = state.controlsEnabled,
|
||||
onClick = { NotificationChannels.getInstance().openChannelSettings(state.recipient!!.notificationChannel!!, ConversationUtil.getShortcutId(state.recipient)) }
|
||||
onClick = { NotificationChannels.getInstance().openChannelSettings(requireActivity(), state.recipient!!.notificationChannel!!, ConversationUtil.getShortcutId(state.recipient)) }
|
||||
)
|
||||
} else {
|
||||
clickPref(
|
||||
|
|
|
@ -184,7 +184,7 @@ public final class EnableCallNotificationSettingsDialog extends DialogFragment {
|
|||
}
|
||||
|
||||
private void showNotificationChannelSettings() {
|
||||
NotificationChannels.getInstance().openChannelSettings(NotificationChannels.CALLS, null);
|
||||
NotificationChannels.getInstance().openChannelSettings(requireActivity(), NotificationChannels.CALLS, null);
|
||||
}
|
||||
|
||||
private void showAppSettings() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.thoughtcrime.securesms.notifications;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationChannelGroup;
|
||||
|
@ -127,7 +128,7 @@ public class NotificationChannels {
|
|||
/**
|
||||
* Navigates the user to the system settings for the desired notification channel.
|
||||
*/
|
||||
public void openChannelSettings(@NonNull String channelId, @Nullable String conversationId) {
|
||||
public void openChannelSettings(@NonNull Activity activityContext, @NonNull String channelId, @Nullable String conversationId) {
|
||||
if (!supported()) {
|
||||
return;
|
||||
}
|
||||
|
@ -139,10 +140,10 @@ public class NotificationChannels {
|
|||
if (conversationId != null && Build.VERSION.SDK_INT >= CONVERSATION_SUPPORT_VERSION) {
|
||||
intent.putExtra(Settings.EXTRA_CONVERSATION_ID, conversationId);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
activityContext.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.w(TAG, "Channel settings activity not found", e);
|
||||
Toast.makeText(context, R.string.NotificationChannels__no_activity_available_to_open_notification_channel_settings, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(activityContext, R.string.NotificationChannels__no_activity_available_to_open_notification_channel_settings, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue