Added setting to automatically mark as read a chat room when dismissing the notification
This commit is contained in:
parent
d25b153019
commit
1e992434c4
6 changed files with 49 additions and 12 deletions
|
@ -17,21 +17,26 @@ This version is a full rewrite of the app in kotlin, using modern Android compon
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Using linphone SDK 5.0 API to better handle audio route (see linphone-sdk changelog)
|
- Using linphone SDK 5.0 API to better handle audio route (see linphone-sdk changelog)
|
||||||
- More settings are available
|
|
||||||
- Display video in recordings if available
|
- Display video in recordings if available
|
||||||
- "Swipe left to delete" action available on calls history, contacts & chat rooms list
|
- "Swipe left to delete" action available on calls history, contacts & chat rooms list
|
||||||
- Improved preview when sharing video files through the chat
|
- Improved preview when sharing video files through the chat
|
||||||
- Android 11 people & conversation compliant
|
- Android 11 people & conversation compliant
|
||||||
|
- New animations between fragments and for unread chat messages / missed calls counters (can be disabled)
|
||||||
|
- Option to mark messages as read when dismissing the notification
|
||||||
|
- More settings are available
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Dropped Android 5 compatibility, Android 6 or higher (API 23) is now required to install the app
|
- Dropped Android 5 compatibility, Android 6 or higher (API 23) is now required to install the app
|
||||||
- Call history view groups call from the same SIP URI (like linphone-iphone)
|
- Call history view groups call from the same SIP URI (like linphone-iphone)
|
||||||
- Improved how Android native contacts are used
|
- Improved how Android native contacts are used
|
||||||
- Removed "back-to-call" button from dialer & chat views, use notification or overlay (see call settings)
|
|
||||||
- Switched to material design for text input fields & switches
|
- Switched to material design for text input fields & switches
|
||||||
- Launcher shortcuts can be to either contacts or chat rooms
|
- Launcher shortcuts can be to either contacts or chat rooms
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Removed "back-to-call" button from dialer & chat views, use notification or overlay (see call settings)
|
||||||
|
|
||||||
### [4.4.0] - 2021-03-29
|
### [4.4.0] - 2021-03-29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -26,6 +26,13 @@ import org.linphone.activities.main.settings.SettingListenerStub
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
|
|
||||||
class ChatSettingsViewModel : GenericSettingsViewModel() {
|
class ChatSettingsViewModel : GenericSettingsViewModel() {
|
||||||
|
val markAsReadNotifDismissalListener = object : SettingListenerStub() {
|
||||||
|
override fun onBoolValueChanged(newValue: Boolean) {
|
||||||
|
prefs.markAsReadUponChatMessageNotificationDismissal = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val markAsReadNotifDismissal = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val fileSharingUrlListener = object : SettingListenerStub() {
|
val fileSharingUrlListener = object : SettingListenerStub() {
|
||||||
override fun onTextValueChanged(newValue: String) {
|
override fun onTextValueChanged(newValue: String) {
|
||||||
core.logCollectionUploadServerUrl = newValue
|
core.logCollectionUploadServerUrl = newValue
|
||||||
|
@ -112,6 +119,7 @@ class ChatSettingsViewModel : GenericSettingsViewModel() {
|
||||||
val goToAndroidNotificationSettingsEvent = MutableLiveData<Event<Boolean>>()
|
val goToAndroidNotificationSettingsEvent = MutableLiveData<Event<Boolean>>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
markAsReadNotifDismissal.value = prefs.markAsReadUponChatMessageNotificationDismissal
|
||||||
downloadedMediaPublic.value = prefs.makePublicMediaFilesDownloaded
|
downloadedMediaPublic.value = prefs.makePublicMediaFilesDownloaded
|
||||||
hideNotificationContent.value = prefs.hideChatMessageContentInNotification
|
hideNotificationContent.value = prefs.hideChatMessageContentInNotification
|
||||||
initAutoDownloadList()
|
initAutoDownloadList()
|
||||||
|
|
|
@ -100,6 +100,12 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
|
|
||||||
/* Chat */
|
/* Chat */
|
||||||
|
|
||||||
|
var markAsReadUponChatMessageNotificationDismissal: Boolean
|
||||||
|
get() = config.getBool("app", "mark_as_read_notif_dismissal", false)
|
||||||
|
set(value) {
|
||||||
|
config.setBool("app", "mark_as_read_notif_dismissal", value)
|
||||||
|
}
|
||||||
|
|
||||||
var makePublicMediaFilesDownloaded: Boolean
|
var makePublicMediaFilesDownloaded: Boolean
|
||||||
// Keep old name for backward compatibility
|
// Keep old name for backward compatibility
|
||||||
get() = config.getBool("app", "make_downloaded_images_public_in_gallery", true)
|
get() = config.getBool("app", "make_downloaded_images_public_in_gallery", true)
|
||||||
|
|
|
@ -662,7 +662,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
}
|
}
|
||||||
style.isGroupConversation = notifiable.isGroup
|
style.isGroupConversation = notifiable.isGroup
|
||||||
|
|
||||||
return NotificationCompat.Builder(context, context.getString(R.string.notification_channel_chat_id))
|
val notificationBuilder = NotificationCompat.Builder(context, context.getString(R.string.notification_channel_chat_id))
|
||||||
.setSmallIcon(R.drawable.topbar_chat_notification)
|
.setSmallIcon(R.drawable.topbar_chat_notification)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setContentIntent(pendingIntent)
|
.setContentIntent(pendingIntent)
|
||||||
|
@ -678,7 +678,12 @@ class NotificationsManager(private val context: Context) {
|
||||||
.addAction(getReplyMessageAction(notifiable))
|
.addAction(getReplyMessageAction(notifiable))
|
||||||
.addAction(getMarkMessageAsReadAction(notifiable))
|
.addAction(getMarkMessageAsReadAction(notifiable))
|
||||||
.setShortcutId(shortcutId)
|
.setShortcutId(shortcutId)
|
||||||
.build()
|
if (corePreferences.markAsReadUponChatMessageNotificationDismissal) {
|
||||||
|
Log.i("[Notifications Manager] Chat room will be marked as read when notification will be dismissed")
|
||||||
|
notificationBuilder
|
||||||
|
.setDeleteIntent(getMarkMessageAsReadPendingIntent(notifiable))
|
||||||
|
}
|
||||||
|
return notificationBuilder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notifications actions */
|
/* Notifications actions */
|
||||||
|
@ -743,18 +748,22 @@ class NotificationsManager(private val context: Context) {
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMarkMessageAsReadAction(notifiable: Notifiable): NotificationCompat.Action {
|
private fun getMarkMessageAsReadPendingIntent(notifiable: Notifiable): PendingIntent {
|
||||||
val markAsReadIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
val markAsReadIntent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||||
markAsReadIntent.action = INTENT_MARK_AS_READ_ACTION
|
markAsReadIntent.action = INTENT_MARK_AS_READ_ACTION
|
||||||
markAsReadIntent.putExtra(INTENT_NOTIF_ID, notifiable.notificationId)
|
markAsReadIntent.putExtra(INTENT_NOTIF_ID, notifiable.notificationId)
|
||||||
markAsReadIntent.putExtra(INTENT_LOCAL_IDENTITY, notifiable.localIdentity)
|
markAsReadIntent.putExtra(INTENT_LOCAL_IDENTITY, notifiable.localIdentity)
|
||||||
|
|
||||||
val markAsReadPendingIntent = PendingIntent.getBroadcast(
|
return PendingIntent.getBroadcast(
|
||||||
context,
|
context,
|
||||||
notifiable.notificationId,
|
notifiable.notificationId,
|
||||||
markAsReadIntent,
|
markAsReadIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT
|
PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getMarkMessageAsReadAction(notifiable: Notifiable): NotificationCompat.Action {
|
||||||
|
val markAsReadPendingIntent = getMarkMessageAsReadPendingIntent(notifiable)
|
||||||
return NotificationCompat.Action.Builder(
|
return NotificationCompat.Action.Builder(
|
||||||
R.drawable.chat_send_over,
|
R.drawable.chat_send_over,
|
||||||
context.getString(R.string.received_chat_notification_mark_as_read_label),
|
context.getString(R.string.received_chat_notification_mark_as_read_label),
|
||||||
|
|
|
@ -66,12 +66,11 @@
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_text"
|
layout="@layout/settings_widget_switch"
|
||||||
linphone:title="@{@string/chat_settings_file_sharing_url_title}"
|
linphone:title="@{@string/chat_settings_mark_as_read_notif_dismissal_title}"
|
||||||
linphone:subtitle="@{@string/chat_settings_file_sharing_url_summary}"
|
linphone:subtitle="@{@string/chat_settings_mark_as_read_notif_dismissal_summary}"
|
||||||
linphone:listener="@{viewModel.fileSharingUrlListener}"
|
linphone:listener="@{viewModel.markAsReadNotifDismissalListener}"
|
||||||
linphone:defaultValue="@{viewModel.fileSharingUrl}"
|
linphone:checked="@={viewModel.markAsReadNotifDismissal}"/>
|
||||||
linphone:inputType="@{InputType.TYPE_TEXT_VARIATION_URI}"/>
|
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_list"
|
layout="@layout/settings_widget_list"
|
||||||
|
@ -127,6 +126,14 @@
|
||||||
linphone:listener="@{viewModel.hideRoomsRemovedProxiesListener}"
|
linphone:listener="@{viewModel.hideRoomsRemovedProxiesListener}"
|
||||||
linphone:checked="@={viewModel.hideRoomsRemovedProxies}"/>
|
linphone:checked="@={viewModel.hideRoomsRemovedProxies}"/>
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/settings_widget_text"
|
||||||
|
linphone:title="@{@string/chat_settings_file_sharing_url_title}"
|
||||||
|
linphone:subtitle="@{@string/chat_settings_file_sharing_url_summary}"
|
||||||
|
linphone:listener="@{viewModel.fileSharingUrlListener}"
|
||||||
|
linphone:defaultValue="@{viewModel.fileSharingUrl}"
|
||||||
|
linphone:inputType="@{InputType.TYPE_TEXT_VARIATION_URI}"/>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_basic"
|
layout="@layout/settings_widget_basic"
|
||||||
linphone:listener="@{viewModel.goToAndroidNotificationSettingsListener}"
|
linphone:listener="@{viewModel.goToAndroidNotificationSettingsListener}"
|
||||||
|
|
|
@ -402,6 +402,8 @@
|
||||||
<string name="call_settings_go_to_android_notification_settings">Android notification settings</string>
|
<string name="call_settings_go_to_android_notification_settings">Android notification settings</string>
|
||||||
|
|
||||||
<!-- Chat settings -->
|
<!-- Chat settings -->
|
||||||
|
<string name="chat_settings_mark_as_read_notif_dismissal_title">Mark as read upon notification dismissal</string>
|
||||||
|
<string name="chat_settings_mark_as_read_notif_dismissal_summary"></string>
|
||||||
<string name="chat_settings_file_sharing_url_title">Sharing server URL</string>
|
<string name="chat_settings_file_sharing_url_title">Sharing server URL</string>
|
||||||
<string name="chat_settings_file_sharing_url_summary">Do not edit unless you know what you are doing!</string>
|
<string name="chat_settings_file_sharing_url_summary">Do not edit unless you know what you are doing!</string>
|
||||||
<string name="chat_settings_auto_download_title">Auto download incoming files policy</string>
|
<string name="chat_settings_auto_download_title">Auto download incoming files policy</string>
|
||||||
|
|
Loading…
Reference in a new issue