Merge pull request #471 from Naveen3Singh/caller_id_perm

Request Caller ID app role on android 10 and above
This commit is contained in:
Tibor Kaputa 2022-11-01 14:29:56 +01:00 committed by GitHub
commit dea04eb83f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -62,7 +62,7 @@ android {
}
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:5d3439cd6b'
implementation 'com.github.SimpleMobileTools:Simple-Commons:449f554c76'
implementation 'com.github.tibbi:IndicatorFastScroll:4524cd0b61'
implementation 'me.grantland:autofittextview:0.2.1'
}

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.dialer.activities
import android.annotation.SuppressLint
import android.app.Activity
import android.app.SearchManager
import android.content.Context
import android.content.Intent
@ -16,6 +17,7 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.widget.SearchView
import androidx.core.view.MenuItemCompat
import androidx.viewpager.widget.ViewPager
@ -83,6 +85,10 @@ class MainActivity : SimpleActivity() {
launchSetDefaultDialerIntent()
}
if (isQPlus() && config.blockUnknownNumbers) {
setDefaultCallerIdApp()
}
setupTabs()
SimpleContact.sorting = config.sorting
}
@ -123,9 +129,12 @@ class MainActivity : SimpleActivity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
super.onActivityResult(requestCode, resultCode, resultData)
// we dont really care about the result, the app can work without being the default Dialer too
// we don't really care about the result, the app can work without being the default Dialer too
if (requestCode == REQUEST_CODE_SET_DEFAULT_DIALER) {
checkContactPermissions()
} else if (requestCode == REQUEST_CODE_SET_DEFAULT_CALLER_ID && resultCode != Activity.RESULT_OK) {
toast(R.string.must_make_default_caller_id_app, length = Toast.LENGTH_LONG)
baseConfig.blockUnknownNumbers = false
}
}