Merge remote-tracking branch 'AquaWolf/feature/conversations' into sc
Change-Id: Idbbe13f56d988900ade365c3d582bd03799d245c Conflicts: vector/src/main/java/im/vector/app/features/notifications/NotificationUtils.kt
This commit is contained in:
commit
3b2f09e80d
|
@ -336,7 +336,7 @@ dependencies {
|
||||||
implementation "androidx.fragment:fragment-ktx:$fragment_version"
|
implementation "androidx.fragment:fragment-ktx:$fragment_version"
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
implementation "androidx.sharetarget:sharetarget:1.1.0"
|
implementation "androidx.sharetarget:sharetarget:1.1.0"
|
||||||
implementation 'androidx.core:core-ktx:1.3.2'
|
implementation 'androidx.core:core-ktx:1.5.0-rc01'
|
||||||
implementation "androidx.media:media:1.3.1"
|
implementation "androidx.media:media:1.3.1"
|
||||||
|
|
||||||
implementation "org.threeten:threetenbp:1.4.0:no-tzdb"
|
implementation "org.threeten:threetenbp:1.4.0:no-tzdb"
|
||||||
|
|
|
@ -17,16 +17,21 @@ package im.vector.app.features.notifications
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.HandlerThread
|
import android.os.HandlerThread
|
||||||
import androidx.annotation.WorkerThread
|
import androidx.annotation.WorkerThread
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.app.Person
|
import androidx.core.app.Person
|
||||||
|
import androidx.core.content.pm.ShortcutInfoCompat
|
||||||
|
import androidx.core.content.pm.ShortcutManagerCompat
|
||||||
|
import androidx.core.graphics.drawable.IconCompat
|
||||||
import im.vector.app.ActiveSessionDataSource
|
import im.vector.app.ActiveSessionDataSource
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.core.utils.FirstThrottler
|
import im.vector.app.core.utils.FirstThrottler
|
||||||
|
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import me.gujun.android.span.span
|
import me.gujun.android.span.span
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
@ -319,6 +324,19 @@ class NotificationDrawerManager @Inject constructor(private val context: Context
|
||||||
.setKey(event.senderId)
|
.setKey(event.senderId)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
val openRoomIntent = RoomDetailActivity.shortcutIntent(context, roomId)
|
||||||
|
|
||||||
|
val shortcut = ShortcutInfoCompat.Builder(context, roomId)
|
||||||
|
.setLongLived(true)
|
||||||
|
.setIntent(openRoomIntent)
|
||||||
|
.setShortLabel(roomName)
|
||||||
|
.setIcon(largeBitmap?.let { IconCompat.createWithAdaptiveBitmap(it) } ?: iconLoader.getUserIcon(event.senderAvatarPath))
|
||||||
|
.build()
|
||||||
|
|
||||||
|
ShortcutManagerCompat.pushDynamicShortcut(context, shortcut)
|
||||||
|
}
|
||||||
|
|
||||||
if (event.outGoingMessage && event.outGoingMessageFailed) {
|
if (event.outGoingMessage && event.outGoingMessageFailed) {
|
||||||
style.addMessage(stringProvider.getString(R.string.notification_inline_reply_failed), event.timestamp, senderPerson)
|
style.addMessage(stringProvider.getString(R.string.notification_inline_reply_failed), event.timestamp, senderPerson)
|
||||||
roomEventGroupInfo.hasSmartReplyError = true
|
roomEventGroupInfo.hasSmartReplyError = true
|
||||||
|
|
|
@ -41,7 +41,6 @@ import androidx.core.app.NotificationManagerCompat
|
||||||
import androidx.core.app.RemoteInput
|
import androidx.core.app.RemoteInput
|
||||||
import androidx.core.app.TaskStackBuilder
|
import androidx.core.app.TaskStackBuilder
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.getSystemService
|
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.core.graphics.drawable.IconCompat
|
import androidx.core.graphics.drawable.IconCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
@ -500,6 +499,8 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
// that can be displayed in not disturb mode if white listed (the later will need compat28.x)
|
// that can be displayed in not disturb mode if white listed (the later will need compat28.x)
|
||||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||||
|
|
||||||
|
.setShortcutId(roomInfo.roomId)
|
||||||
|
|
||||||
// Title for API < 16 devices.
|
// Title for API < 16 devices.
|
||||||
.setContentTitle(roomInfo.roomDisplayName)
|
.setContentTitle(roomInfo.roomDisplayName)
|
||||||
// Content for API < 16 devices.
|
// Content for API < 16 devices.
|
||||||
|
@ -865,7 +866,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
// We cannot use NotificationManagerCompat here.
|
// We cannot use NotificationManagerCompat here.
|
||||||
val setting = context.getSystemService<NotificationManager>()!!.currentInterruptionFilter
|
val setting = context.getSystemService(NotificationManager::class.java)!!.currentInterruptionFilter
|
||||||
|
|
||||||
return setting == NotificationManager.INTERRUPTION_FILTER_NONE
|
return setting == NotificationManager.INTERRUPTION_FILTER_NONE
|
||||||
|| setting == NotificationManager.INTERRUPTION_FILTER_ALARMS
|
|| setting == NotificationManager.INTERRUPTION_FILTER_ALARMS
|
||||||
|
|
Loading…
Reference in New Issue