forked from upstream-mirrors/quik
Request SMS permission when sending message
This commit is contained in:
@@ -31,11 +31,9 @@ class PermissionManagerImpl @Inject constructor(private val context: Context) :
|
||||
return Telephony.Sms.getDefaultSmsPackage(context) == context.packageName
|
||||
}
|
||||
|
||||
override fun hasSmsAndContacts(): Boolean {
|
||||
return hasSms() && hasContacts()
|
||||
}
|
||||
override fun hasReadSms(): Boolean = ContextCompat.checkSelfPermission(context, Manifest.permission.READ_SMS) == PERMISSION_GRANTED
|
||||
|
||||
override fun hasSms(): Boolean = ContextCompat.checkSelfPermission(context, Manifest.permission.READ_SMS) == PERMISSION_GRANTED
|
||||
override fun hasSendSms(): Boolean = ContextCompat.checkSelfPermission(context, Manifest.permission.SEND_SMS) == PERMISSION_GRANTED
|
||||
|
||||
override fun hasContacts(): Boolean = ContextCompat.checkSelfPermission(context, Manifest.permission.READ_CONTACTS) == PERMISSION_GRANTED
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class CursorToConversationImpl @Inject constructor(
|
||||
}
|
||||
|
||||
override fun getConversationsCursor(lastSync: Long): Cursor? {
|
||||
return when (permissionManager.hasSms()) {
|
||||
return when (permissionManager.hasReadSms()) {
|
||||
true -> context.contentResolver.query(URI, PROJECTION,
|
||||
"date > $lastSync", null,
|
||||
"date desc")
|
||||
|
||||
@@ -141,7 +141,7 @@ class CursorToMessageImpl @Inject constructor(
|
||||
false -> this.projection
|
||||
}
|
||||
|
||||
return when (permissionManager.hasSms()) {
|
||||
return when (permissionManager.hasReadSms()) {
|
||||
true -> SqliteWrapper.query(context, uri, projection, sortOrder = "normalized_date desc")
|
||||
false -> null
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class CursorToRecipientImpl @Inject constructor(
|
||||
}
|
||||
|
||||
override fun getRecipientCursor(): Cursor? {
|
||||
return when (permissionManager.hasSms()) {
|
||||
return when (permissionManager.hasReadSms()) {
|
||||
true -> context.contentResolver.query(URI, null, null, null, null)
|
||||
false -> null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user