mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-04-04 05:21:12 +02:00
make sure the app has Write Call Log permission at clearing call log
This commit is contained in:
parent
cc274b35e5
commit
eda7bac49a
@ -56,6 +56,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:5.32.19'
|
implementation 'com.simplemobiletools:commons:5.32.23'
|
||||||
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
|
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun clearCallHistory() {
|
private fun clearCallHistory() {
|
||||||
ConfirmationDialog(this, "", R.string.clear_history_confirmation) {
|
ConfirmationDialog(this, "", R.string.clear_history_confirmation) {
|
||||||
RecentsHelper(this).removeAllRecentCalls {
|
RecentsHelper(this).removeAllRecentCalls(this) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
recents_fragment?.refreshItems()
|
recents_fragment?.refreshItems()
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import android.provider.CallLog.Calls
|
|||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.models.SimpleContact
|
import com.simplemobiletools.commons.models.SimpleContact
|
||||||
import com.simplemobiletools.dialer.extensions.config
|
import com.simplemobiletools.dialer.activities.SimpleActivity
|
||||||
import com.simplemobiletools.dialer.extensions.getAvailableSIMCardLabels
|
import com.simplemobiletools.dialer.extensions.getAvailableSIMCardLabels
|
||||||
import com.simplemobiletools.dialer.models.RecentCall
|
import com.simplemobiletools.dialer.models.RecentCall
|
||||||
|
|
||||||
@ -121,11 +121,15 @@ class RecentsHelper(private val context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
fun removeAllRecentCalls(callback: () -> Unit) {
|
fun removeAllRecentCalls(activity: SimpleActivity, callback: () -> Unit) {
|
||||||
ensureBackgroundThread {
|
activity.handlePermission(PERMISSION_WRITE_CALL_LOG) {
|
||||||
val uri = Calls.CONTENT_URI
|
if (it) {
|
||||||
context.contentResolver.delete(uri, null, null)
|
ensureBackgroundThread {
|
||||||
callback()
|
val uri = Calls.CONTENT_URI
|
||||||
|
context.contentResolver.delete(uri, null, null)
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user