Minor fixes + removed setting for legacy push format
This commit is contained in:
parent
a57d7d4578
commit
1831ad9677
6 changed files with 13 additions and 25 deletions
|
@ -78,7 +78,7 @@ class ChatMessageViewModel(
|
|||
if (state == ChatMessage.State.FileTransferDone && !message.isOutgoing) {
|
||||
Log.i("[Chat Message] File transfer done")
|
||||
// No need to refresh content lists on outgoing messages after file transfer is done
|
||||
// It will even cause the app to crash if updateContentsList is not call right after
|
||||
// It will even cause the app to crash if updateContentsList isn't called right after
|
||||
updateContentsList()
|
||||
|
||||
if (!message.isEphemeral && corePreferences.makePublicMediaFilesDownloaded) {
|
||||
|
|
|
@ -91,7 +91,8 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactViewModelI
|
|||
get() = chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
|
||||
|
||||
val peerSipUri: String
|
||||
get() = chatRoom.peerAddress.asStringUriOnly()
|
||||
get() = if (oneToOneChatRoom && !basicChatRoom) chatRoom.participants.first().address.asStringUriOnly()
|
||||
else chatRoom.peerAddress.asStringUriOnly()
|
||||
|
||||
val oneParticipantOneDevice: Boolean
|
||||
get() {
|
||||
|
|
|
@ -46,13 +46,6 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
|
|||
val pushNotifications = MutableLiveData<Boolean>()
|
||||
val pushNotificationsAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val legacyPushNotificationFormatListener = object : SettingListenerStub() {
|
||||
override fun onBoolValueChanged(newValue: Boolean) {
|
||||
prefs.useLegacyPushNotificationFormat = newValue
|
||||
}
|
||||
}
|
||||
val legacyPushNotificationFormat = MutableLiveData<Boolean>()
|
||||
|
||||
val randomPortsListener = object : SettingListenerStub() {
|
||||
override fun onBoolValueChanged(newValue: Boolean) {
|
||||
val port = if (newValue) -1 else 5060
|
||||
|
@ -78,7 +71,6 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
|
|||
allowIpv6.value = core.ipv6Enabled()
|
||||
pushNotifications.value = core.isPushNotificationEnabled
|
||||
pushNotificationsAvailable.value = core.isPushNotificationAvailable
|
||||
legacyPushNotificationFormat.value = prefs.useLegacyPushNotificationFormat
|
||||
randomPorts.value = getTransportPort() == -1
|
||||
sipPort.value = getTransportPort()
|
||||
}
|
||||
|
|
|
@ -254,12 +254,6 @@ class CorePreferences constructor(private val context: Context) {
|
|||
config.setInt("app", "version_check_url_last_timestamp", value)
|
||||
}
|
||||
|
||||
var useLegacyPushNotificationFormat: Boolean
|
||||
get() = config.getBool("net", "use_legacy_push_notification_params", false)
|
||||
set(value) {
|
||||
config.setBool("net", "use_legacy_push_notification_params", value)
|
||||
}
|
||||
|
||||
var defaultAccountAvatarPath: String?
|
||||
get() = config.getString("app", "default_avatar_path", null)
|
||||
set(value) {
|
||||
|
|
|
@ -167,6 +167,15 @@ class ShortcutsHelper(val context: Context) {
|
|||
}
|
||||
subject = contact?.fullName ?: LinphoneUtils.getDisplayName(chatRoom.peerAddress)
|
||||
icon = contact?.getPerson()?.icon ?: IconCompat.createWithResource(context, R.drawable.avatar)
|
||||
} else if (chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && chatRoom.participants.isNotEmpty()) {
|
||||
val address = chatRoom.participants.first().address
|
||||
val contact =
|
||||
coreContext.contactsManager.findContactByAddress(address)
|
||||
if (contact != null) {
|
||||
personsList.add(contact.getPerson())
|
||||
}
|
||||
subject = contact?.fullName ?: LinphoneUtils.getDisplayName(address)
|
||||
icon = contact?.getPerson()?.icon ?: IconCompat.createWithResource(context, R.drawable.avatar)
|
||||
} else {
|
||||
for (participant in chatRoom.participants) {
|
||||
val contact =
|
||||
|
@ -198,7 +207,7 @@ class ShortcutsHelper(val context: Context) {
|
|||
.setPersons(persons)
|
||||
.setCategories(categories)
|
||||
.setIntent(intent)
|
||||
.setLongLived(Version.sdkAboveOrEqual(30)) // TODO Use Android R API code
|
||||
.setLongLived(Version.sdkAboveOrEqual(Version.API30_ANDROID_11))
|
||||
.build().toShortcutInfo()
|
||||
} catch (e: Exception) {
|
||||
Log.e("[Shortcuts Helper] ShortcutInfo.Builder exception: $e")
|
||||
|
|
|
@ -87,14 +87,6 @@
|
|||
linphone:checked="@={viewModel.pushNotifications}"
|
||||
linphone:enabled="@{viewModel.pushNotificationsAvailable}"/>
|
||||
|
||||
<include
|
||||
layout="@layout/settings_widget_switch"
|
||||
linphone:title="@{@string/network_settings_legacy_push_notification_format_title}"
|
||||
linphone:subtitle="@{@string/network_settings_legacy_push_notification_format_summary}"
|
||||
linphone:listener="@{viewModel.legacyPushNotificationFormatListener}"
|
||||
linphone:checked="@={viewModel.legacyPushNotificationFormat}"
|
||||
linphone:enabled="@{viewModel.pushNotificationsAvailable}"/>
|
||||
|
||||
<include
|
||||
layout="@layout/settings_widget_switch"
|
||||
linphone:title="@{@string/network_settings_random_ports_title}"
|
||||
|
|
Loading…
Reference in a new issue