Merge branch 'main' into adb/integrated-videocalls

This commit is contained in:
adb
2025-09-03 14:21:53 +02:00
committed by GitHub
6 changed files with 42 additions and 8 deletions
@@ -109,7 +109,7 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
if (chatId != 0) {
DcChat dcChat = dcContext.getChat(chatId);
menu.findItem(R.id.menu_clone).setVisible(chatIsMultiUser && !chatIsMailingList);
menu.findItem(R.id.menu_clone).setVisible(chatIsMultiUser && !chatIsInBroadcast && !chatIsMailingList);
if (chatIsDeviceTalk) {
menu.findItem(R.id.edit_name).setVisible(false);
menu.findItem(R.id.show_encr_info).setVisible(false);
@@ -278,6 +278,7 @@ public class ProfileAdapter extends RecyclerView.Adapter
itemDataStatusText = "";
isOutBroadcast = dcChat != null && dcChat.isOutBroadcast();
boolean isMailingList = dcChat != null && dcChat.isMailingList();
boolean isInBroadcast = dcChat != null && dcChat.isInBroadcast();
boolean isSelfTalk = dcChat != null && dcChat.isSelfTalk();
boolean isDeviceTalk = dcChat != null && dcChat.isDeviceTalk();
memberCount = memberList!=null ? memberList.length : 0;
@@ -309,7 +310,7 @@ public class ProfileAdapter extends RecyclerView.Adapter
itemData.add(new ItemData(ITEM_LAST_SEEN, lastSeenTxt, 0));
}
if (memberList!=null && !isMailingList) {
if (memberList!=null && !isInBroadcast && !isMailingList) {
itemData.add(new ItemData(ITEM_DIVIDER, null, 0));
if (dcChat != null) {
if (dcChat.canSend() && dcChat.isEncrypted()) {
@@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.connect.KeepAliveService;
import org.thoughtcrime.securesms.notifications.FcmReceiveService;
import org.thoughtcrime.securesms.util.Prefs;
public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragment implements Preference.OnPreferenceChangeListener {
@@ -99,6 +100,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
notificationsEnabled.setOnPreferenceChangeListener((preference, newValue) -> {
boolean enabled = (Boolean) newValue;
dcContext.setMuted(!enabled);
notificationsEnabled.setSummary(getSummary(getContext(), false));
return true;
});
}
@@ -126,6 +128,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
// update ignoreBattery in onResume() to reflects changes done in the system settings
ignoreBattery.setChecked(isIgnoringBatteryOptimizations());
notificationsEnabled.setChecked(!dcContext.isMuted());
notificationsEnabled.setSummary(getSummary(getContext(), false));
mentionNotifEnabled.setChecked(dcContext.isMentionsEnabled());
// set without altering "unset" state of the preference
@@ -160,6 +163,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
} else {
context.stopService(new Intent(context, KeepAliveService.class));
}
notificationsEnabled.setSummary(getSummary(context, false));
return true;
}
@@ -239,11 +243,21 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
}
public static CharSequence getSummary(Context context) {
return getSummary(context, true);
}
public static CharSequence getSummary(Context context, boolean detailed) {
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || notificationManager.areNotificationsEnabled()) {
return context.getString(DcHelper.getContext(context).isMuted() ? R.string.off : R.string.on);
if (DcHelper.getContext(context).isMuted()) {
return detailed? context.getString(R.string.off) : "";
}
if (FcmReceiveService.getToken() == null && !Prefs.reliableService(context)) {
return "⚠️ " + context.getString(R.string.unreliable_bg_notifications);
}
return detailed? context.getString(R.string.on) : "";
} else {
return context.getString(R.string.disabled_in_system_settings);
return "⚠️ " + context.getString(R.string.disabled_in_system_settings);
}
}
}
@@ -228,7 +228,7 @@ public class Prefs {
}
// if the key was unset, then calculate default value
return isPushEnabled(context) || !DcHelper.getAccounts(context).isAllChatmail();
return !isPushEnabled(context) || !DcHelper.getAccounts(context).isAllChatmail();
}
// vibrate