Reword incoming call extra & cleanup

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-02-20 15:13:55 +01:00
parent bd1d5d0dbc
commit 1adf9e6cff
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0
6 changed files with 8 additions and 11 deletions

View File

@ -50,7 +50,7 @@ import com.nextcloud.talk.utils.NotificationUtils.cancelAllNotificationsForAccou
import com.nextcloud.talk.utils.NotificationUtils.cancelExistingNotificationWithId
import com.nextcloud.talk.utils.PushUtils
import com.nextcloud.talk.utils.bundle.BundleKeys
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_FROM_NOTIFICATION_START_CALL
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_OPEN_INCOMING_CALL
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY
import com.nextcloud.talk.utils.preferences.AppPreferences
import kotlinx.serialization.json.Json
@ -125,10 +125,10 @@ class MagicFirebaseMessagingService : FirebaseMessagingService(), KoinComponent
}
type == "call" -> {
val fullScreenIntent = Intent(applicationContext, MagicCallActivity::class.java)
fullScreenIntent.action = KEY_OPEN_INCOMING_CALL
val bundle = Bundle()
bundle.putString(BundleKeys.KEY_ROOM_ID, decryptedPushMessage.id)
bundle.putParcelable(KEY_USER_ENTITY, signatureVerification.userEntity)
bundle.putBoolean(KEY_FROM_NOTIFICATION_START_CALL, true)
fullScreenIntent.putExtras(bundle)
fullScreenIntent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK

View File

@ -64,7 +64,7 @@ class MagicCallActivity : BaseActivity() {
router!!.setPopsLastView(false)
if (!router!!.hasRootController()) {
if (intent.getBooleanExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL, false)) {
if (intent.getBooleanExtra(BundleKeys.KEY_OPEN_INCOMING_CALL, false)) {
router!!.setRoot(
RouterTransaction.with(CallNotificationController(intent.extras!!))
.pushChangeHandler(HorizontalChangeHandler())

View File

@ -154,8 +154,8 @@ class MainActivity : BaseActivity(), ActionBarProvider {
}
}
}
} else if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
router!!.pushController(
} else if (intent.action == BundleKeys.KEY_OPEN_INCOMING_CALL) {
router?.pushController(
RouterTransaction.with(CallNotificationController(intent.extras!!))
.pushChangeHandler(HorizontalChangeHandler())
.popChangeHandler(HorizontalChangeHandler())

View File

@ -195,8 +195,8 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
credentials = ApiUtils.getCredentials(conversationUser?.username, conversationUser?.token)
}
if (args.containsKey(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
this.startCallFromNotification = args.getBoolean(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)
if (args.containsKey(BundleKeys.KEY_OPEN_INCOMING_CALL)) {
this.startCallFromNotification = args.getBoolean(BundleKeys.KEY_OPEN_INCOMING_CALL)
}
this.voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)

View File

@ -203,7 +203,6 @@ class MessageNotificationWorker(
val pendingIntent: PendingIntent? = PendingIntent.getActivity(applicationContext,
0, intent, 0)
val userBaseUrl = Uri.parse(signatureVerification.userEntity!!.baseUrl).toString()
val soundUri = NotificationUtils.getMessageSoundUri(applicationContext, appPreferences)
val audioAttributesBuilder: AudioAttributes.Builder =

View File

@ -43,8 +43,6 @@ object BundleKeys {
val KEY_EXISTING_PARTICIPANTS = "KEY_EXISTING_PARTICIPANTS"
val KEY_CALL_URL = "KEY_CALL_URL"
val KEY_MODIFIED_BASE_URL = "KEY_MODIFIED_BASE_URL"
val KEY_NOTIFICATION_SUBJECT = "KEY_NOTIFICATION_SUBJECT"
val KEY_NOTIFICATION_SIGNATURE = "KEY_NOTIFICATION_SIGNATURE"
val KEY_INTERNAL_USER_ID = "KEY_INTERNAL_USER_ID"
val KEY_CONVERSATION_TYPE = "KEY_CONVERSATION_TYPE"
val KEY_INVITED_PARTICIPANTS = "KEY_INVITED_PARTICIPANTS"
@ -53,7 +51,7 @@ object BundleKeys {
val KEY_CALL_VOICE_ONLY = "KEY_CALL_VOICE_ONLY"
val KEY_ACTIVE_CONVERSATION = "KEY_ACTIVE_CONVERSATION"
val KEY_SERVER_CAPABILITIES = "KEY_SERVER_CAPABILITIES"
val KEY_FROM_NOTIFICATION_START_CALL = "KEY_FROM_NOTIFICATION_START_CALL"
val KEY_OPEN_INCOMING_CALL = "KEY_OPEN_INCOMING_CALL"
val KEY_ROOM_ID = "KEY_ROOM_ID"
val KEY_ARE_CALL_SOUNDS = "KEY_ARE_CALL_SOUNDS"
val KEY_BROWSER_TYPE = "KEY_BROWSER_TYPE"