From 256940fdde547693b6a628832c580473eaa6bbca Mon Sep 17 00:00:00 2001 From: Roei Edri Date: Sat, 12 Mar 2022 17:01:36 +0200 Subject: [PATCH] Fixed voicemail not working, fixes #358 --- .../call/CallNavigationsInteractorImpl.kt | 15 ++++++--------- chooloolib/src/main/res/values/styles.xml | 1 - chooloolib/src/main/res/values/themes.xml | 1 - 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/chooloolib/src/main/java/com/chooloo/www/chooloolib/interactor/call/CallNavigationsInteractorImpl.kt b/chooloolib/src/main/java/com/chooloo/www/chooloolib/interactor/call/CallNavigationsInteractorImpl.kt index 950637bfd..a5a483252 100644 --- a/chooloolib/src/main/java/com/chooloo/www/chooloolib/interactor/call/CallNavigationsInteractorImpl.kt +++ b/chooloolib/src/main/java/com/chooloo/www/chooloolib/interactor/call/CallNavigationsInteractorImpl.kt @@ -3,17 +3,16 @@ package com.chooloo.www.chooloolib.interactor.call import android.Manifest import android.content.Context import android.content.Intent +import android.content.Intent.FLAG_ACTIVITY_NEW_TASK import android.net.Uri import android.os.Bundle import android.provider.VoicemailContract +import android.telecom.PhoneAccount import android.telecom.TelecomManager import androidx.annotation.RequiresPermission import com.chooloo.www.chooloolib.R import com.chooloo.www.chooloolib.interactor.base.BaseInteractorImpl -import com.chooloo.www.chooloolib.interactor.dialog.DialogsInteractor import com.chooloo.www.chooloolib.interactor.permission.PermissionsInteractor -import com.chooloo.www.chooloolib.interactor.preferences.PreferencesInteractor -import com.chooloo.www.chooloolib.interactor.sim.SimsInteractor import com.chooloo.www.chooloolib.model.SimAccount import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.android.scopes.ActivityScoped @@ -21,24 +20,22 @@ import javax.inject.Inject @ActivityScoped class CallNavigationsInteractorImpl @Inject constructor( - private val sims: SimsInteractor, - private val dialogs: DialogsInteractor, private val telecomManager: TelecomManager, private val permissions: PermissionsInteractor, - private val preferences: PreferencesInteractor, @ApplicationContext private val context: Context ) : BaseInteractorImpl(), CallNavigationsInteractor { override fun callVoicemail() { permissions.runWithDefaultDialer(R.string.error_not_default_dialer_call) { val intent = Intent(Intent.ACTION_CALL) - intent.data = Uri.fromParts("voicemail", "", null) + .setData(Uri.fromParts(PhoneAccount.SCHEME_VOICEMAIL, "", null)) + .setFlags(FLAG_ACTIVITY_NEW_TASK) context.startActivity(intent) } } @RequiresPermission(allOf = [Manifest.permission.READ_PHONE_STATE, Manifest.permission.CALL_PHONE]) override fun call(number: String) { - telecomManager.placeCall(Uri.parse("tel:${Uri.encode(number)}"), Bundle()) + telecomManager.placeCall(Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null), Bundle()) } @RequiresPermission(Manifest.permission.CALL_PHONE) @@ -47,6 +44,6 @@ class CallNavigationsInteractorImpl @Inject constructor( simAccount?.phoneAccountHandle?.let { extras.putParcelable(VoicemailContract.EXTRA_PHONE_ACCOUNT_HANDLE, it) } - telecomManager.placeCall(Uri.parse("tel:${Uri.encode(number)}"), extras) + telecomManager.placeCall(Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null), extras) } } diff --git a/chooloolib/src/main/res/values/styles.xml b/chooloolib/src/main/res/values/styles.xml index 597f13498..dfb58413e 100644 --- a/chooloolib/src/main/res/values/styles.xml +++ b/chooloolib/src/main/res/values/styles.xml @@ -51,7 +51,6 @@ diff --git a/chooloolib/src/main/res/values/themes.xml b/chooloolib/src/main/res/values/themes.xml index 3719a9b4a..ccbae94bd 100644 --- a/chooloolib/src/main/res/values/themes.xml +++ b/chooloolib/src/main/res/values/themes.xml @@ -14,7 +14,6 @@ false @font/google_sans_regular - ?colorPrimarySurface @style/Chooloo.AlertDialog @style/Chooloo.BottomSheet