mirror of
https://github.com/mollyim/monero-wallet-sdk.git
synced 2025-01-26 23:06:58 -05:00
lib: make some AIDL parameters not nullable
This commit is contained in:
parent
f406edcf8c
commit
c09e3a7894
@ -56,15 +56,12 @@ class RemoteNodeClient private constructor(
|
||||
|
||||
override fun requestAsync(
|
||||
requestId: Int,
|
||||
method: String?,
|
||||
path: String?,
|
||||
method: String,
|
||||
path: String,
|
||||
header: String?,
|
||||
body: ByteArray?,
|
||||
callback: IHttpRequestCallback?,
|
||||
) {
|
||||
requireNotNull(path)
|
||||
requireNotNull(method)
|
||||
|
||||
logger.d("HTTP: $method $path, header_len=${header?.length}, body_size=${body?.size}")
|
||||
|
||||
val requestJob = requestsScope.launch {
|
||||
|
@ -14,8 +14,7 @@ internal class StorageAdapter(var dataStore: WalletDataStore?) : IStorageAdapter
|
||||
|
||||
private val mutex = Mutex()
|
||||
|
||||
override fun writeAsync(pfd: ParcelFileDescriptor?): Boolean {
|
||||
requireNotNull(pfd)
|
||||
override fun writeAsync(pfd: ParcelFileDescriptor): Boolean {
|
||||
val localDataStore = dataStore
|
||||
return if (localDataStore != null) {
|
||||
val inputStream = ParcelFileDescriptor.AutoCloseInputStream(pfd)
|
||||
@ -33,8 +32,7 @@ internal class StorageAdapter(var dataStore: WalletDataStore?) : IStorageAdapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun readAsync(pfd: ParcelFileDescriptor?) {
|
||||
requireNotNull(pfd)
|
||||
override fun readAsync(pfd: ParcelFileDescriptor) {
|
||||
val outputStream = ParcelFileDescriptor.AutoCloseOutputStream(pfd)
|
||||
ioStorageScope.launch {
|
||||
val localDataStore =
|
||||
|
@ -178,16 +178,14 @@ class WalletNative private constructor(
|
||||
/**
|
||||
* Also replays the last known balance whenever a new listener registers.
|
||||
*/
|
||||
override fun addBalanceListener(listener: IBalanceListener?) {
|
||||
requireNotNull(listener)
|
||||
override fun addBalanceListener(listener: IBalanceListener) {
|
||||
balanceListenersLock.withLock {
|
||||
balanceListeners.add(listener)
|
||||
listener.onBalanceChanged(txHistorySnapshot(), currentBlockchainTime)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeBalanceListener(listener: IBalanceListener?) {
|
||||
requireNotNull(listener)
|
||||
override fun removeBalanceListener(listener: IBalanceListener) {
|
||||
balanceListenersLock.withLock {
|
||||
balanceListeners.remove(listener)
|
||||
}
|
||||
|
@ -130,9 +130,7 @@ class WalletProvider private constructor(
|
||||
}
|
||||
|
||||
object WalletServiceListener : IWalletServiceListener.Stub() {
|
||||
override fun onLogMessage(priority: Int, tag: String?, msg: String?, cause: String?) {
|
||||
requireNotNull(tag)
|
||||
requireNotNull(msg)
|
||||
override fun onLogMessage(priority: Int, tag: String, msg: String, cause: String?) {
|
||||
if (Logger.adapter.isLoggable(priority, tag)) {
|
||||
val tr = if (cause != null) Throwable(cause) else null
|
||||
Logger.adapter.print(priority, tag, msg, tr)
|
||||
|
@ -41,8 +41,8 @@ internal class WalletServiceImpl(
|
||||
}
|
||||
|
||||
override fun createWallet(
|
||||
config: WalletConfig?,
|
||||
storage: IStorageAdapter?,
|
||||
config: WalletConfig,
|
||||
storage: IStorageAdapter,
|
||||
client: IRemoteNodeClient?,
|
||||
callback: IWalletServiceCallbacks?,
|
||||
) {
|
||||
@ -56,11 +56,11 @@ internal class WalletServiceImpl(
|
||||
}
|
||||
|
||||
override fun restoreWallet(
|
||||
config: WalletConfig?,
|
||||
storage: IStorageAdapter?,
|
||||
config: WalletConfig,
|
||||
storage: IStorageAdapter,
|
||||
client: IRemoteNodeClient?,
|
||||
callback: IWalletServiceCallbacks?,
|
||||
secretSpendKey: SecretKey?,
|
||||
secretSpendKey: SecretKey,
|
||||
restorePoint: Long,
|
||||
) {
|
||||
serviceScope.launch {
|
||||
@ -72,13 +72,11 @@ internal class WalletServiceImpl(
|
||||
}
|
||||
|
||||
override fun openWallet(
|
||||
config: WalletConfig?,
|
||||
storage: IStorageAdapter?,
|
||||
config: WalletConfig,
|
||||
storage: IStorageAdapter,
|
||||
client: IRemoteNodeClient?,
|
||||
callback: IWalletServiceCallbacks?,
|
||||
) {
|
||||
requireNotNull(config)
|
||||
requireNotNull(storage)
|
||||
serviceScope.launch {
|
||||
val wallet = WalletNative.fullNode(
|
||||
networkId = config.networkId,
|
||||
@ -91,15 +89,12 @@ internal class WalletServiceImpl(
|
||||
}
|
||||
|
||||
private suspend fun createOrRestoreWallet(
|
||||
config: WalletConfig?,
|
||||
storage: IStorageAdapter?,
|
||||
config: WalletConfig,
|
||||
storage: IStorageAdapter,
|
||||
client: IRemoteNodeClient?,
|
||||
secretSpendKey: SecretKey?,
|
||||
secretSpendKey: SecretKey,
|
||||
restorePoint: Long? = null,
|
||||
): IWallet {
|
||||
requireNotNull(config)
|
||||
requireNotNull(storage)
|
||||
requireNotNull(secretSpendKey)
|
||||
return WalletNative.fullNode(
|
||||
networkId = config.networkId,
|
||||
storageAdapter = storage,
|
||||
|
Loading…
x
Reference in New Issue
Block a user