Don't show blocking dialog if not necessary

This commit is contained in:
moezbhatti
2019-08-23 01:30:50 +02:00
parent 1439e3f126
commit c5fa1ce0f5
11 changed files with 103 additions and 51 deletions
@@ -28,28 +28,21 @@ interface BlockingClient {
*/
fun isAvailable(): Boolean
/**
* Returns the level of access that the given blocking client provides to QKSMS
*/
fun getClientCapability(): BlockingClientCapability
/**
* Return a Single<Boolean> which emits whether or not the given [address] should be blocked
*/
fun isBlocked(address: String): Single<Boolean>
/**
* Returns true if the client is capable of blocking the address in the manager without any
* further user input
*/
fun canBlock(): Boolean = false
/**
* Blocks the numbers or opens the manager
*/
fun block(addresses: List<String>): Completable
/**
* Returns true if the client is capable of unblocking the address in the manager without any
* further user input
*/
fun canUnblock(): Boolean = false
/**
* Unblocks the numbers or opens the manager
*/
@@ -60,4 +53,4 @@ interface BlockingClient {
*/
fun openSettings()
}
}
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com>
*
* This file is part of QKSMS.
*
* QKSMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QKSMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.moez.QKSMS.blocking
enum class BlockingClientCapability {
BLOCK_WITHOUT_PERMISSION,
BLOCK_WITH_PERMISSION ,
CANT_BLOCK
}