Fix some notifications stuff

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-02-18 13:28:39 +01:00
parent 51d8483267
commit 8c984973c0
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0
3 changed files with 8 additions and 9 deletions

View File

@ -24,6 +24,7 @@ import android.app.Notification
import android.app.PendingIntent
import android.content.Intent
import android.media.AudioAttributes
import android.media.AudioManager
import android.net.Uri
import android.os.Bundle
import android.util.Base64
@ -152,13 +153,14 @@ class MagicFirebaseMessagingService : FirebaseMessagingService(), KoinComponent
.setSmallIcon(R.drawable.ic_call_black_24dp)
.setSubText(userBaseUrl)
.setShowWhen(true)
.setWhen(decryptedPushMessage.timestamp)
.setWhen(timestamp)
.setContentTitle(EmojiCompat.get().process(decryptedPushMessage.subject.toString()))
.setAutoCancel(true)
.setOngoing(true)
//.setTimeoutAfter(45000L)
.setContentIntent(fullScreenPendingIntent)
.setFullScreenIntent(fullScreenPendingIntent, true)
.setSound(NotificationUtils.getCallSoundUri(applicationContext, appPreferences))
.setSound(NotificationUtils.getCallSoundUri(applicationContext, appPreferences), AudioManager.STREAM_RING)
if (vibrationEffect != null) {
notificationBuilder.setVibrate(vibrationEffect)
@ -168,7 +170,7 @@ class MagicFirebaseMessagingService : FirebaseMessagingService(), KoinComponent
notification.flags = notification.flags or Notification.FLAG_INSISTENT
isServiceInForeground = true
checkIfCallIsActive(signatureVerification, decryptedPushMessage)
startForeground(decryptedPushMessage.timestamp.toInt(), notification)
startForeground(timestamp.toInt(), notification)
}
else -> {
val messageData = Data.Builder()

View File

@ -50,6 +50,7 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission
android:name="android.permission.USE_CREDENTIALS"

View File

@ -116,12 +116,8 @@ object NotificationUtils {
channel.enableLights(enableLights)
channel.lightColor = R.color.colorPrimary
channel.setSound(sound, audioAttributes)
if (vibrationPattern != null) {
channel.enableVibration(true)
channel.vibrationPattern = vibrationPattern
} else {
channel.enableVibration(false)
}
channel.setBypassDnd(bypassDnd)
if (lockScreenVisibility != null) {
channel.lockscreenVisibility = lockScreenVisibility