mirror of
https://github.com/bitwarden/android.git
synced 2025-01-07 08:47:36 +03:00
Add toast
This commit is contained in:
parent
d4d980b576
commit
30531a40d3
2 changed files with 15 additions and 3 deletions
|
@ -1,6 +1,8 @@
|
||||||
package com.x8bit.bitwarden.data.vault.manager
|
package com.x8bit.bitwarden.data.vault.manager
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import com.bitwarden.vault.AttachmentView
|
import com.bitwarden.vault.AttachmentView
|
||||||
import com.bitwarden.vault.Cipher
|
import com.bitwarden.vault.Cipher
|
||||||
|
@ -35,9 +37,6 @@ import com.x8bit.bitwarden.data.vault.repository.util.toNetworkAttachmentRequest
|
||||||
import com.x8bit.bitwarden.data.vault.repository.util.toOfflineCipher
|
import com.x8bit.bitwarden.data.vault.repository.util.toOfflineCipher
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.collect
|
|
||||||
import kotlinx.coroutines.flow.filter
|
|
||||||
import kotlinx.coroutines.flow.flatMapConcat
|
|
||||||
import kotlinx.coroutines.flow.flattenConcat
|
import kotlinx.coroutines.flow.flattenConcat
|
||||||
import kotlinx.coroutines.flow.flowOf
|
import kotlinx.coroutines.flow.flowOf
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
@ -51,6 +50,7 @@ import java.time.Clock
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions")
|
||||||
class CipherManagerImpl(
|
class CipherManagerImpl(
|
||||||
|
private val context: Context,
|
||||||
private val fileManager: FileManager,
|
private val fileManager: FileManager,
|
||||||
private val authDiskSource: AuthDiskSource,
|
private val authDiskSource: AuthDiskSource,
|
||||||
private val ciphersService: CiphersService,
|
private val ciphersService: CiphersService,
|
||||||
|
@ -81,6 +81,7 @@ class CipherManagerImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
val userId = activeUserId!!
|
val userId = activeUserId!!
|
||||||
|
val hasItems = it.isNotEmpty()
|
||||||
|
|
||||||
it.map { c ->
|
it.map { c ->
|
||||||
val cipher = c.toOfflineCipher().toCipher()
|
val cipher = c.toOfflineCipher().toCipher()
|
||||||
|
@ -119,7 +120,16 @@ class CipherManagerImpl(
|
||||||
onSuccess = { it },
|
onSuccess = { it },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasItems) {
|
||||||
|
externalScope.launch {
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
"Offline items uploaded",
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ object VaultManagerModule {
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
fun provideCipherManager(
|
fun provideCipherManager(
|
||||||
|
@ApplicationContext context: Context,
|
||||||
ciphersService: CiphersService,
|
ciphersService: CiphersService,
|
||||||
vaultDiskSource: VaultDiskSource,
|
vaultDiskSource: VaultDiskSource,
|
||||||
vaultSdkSource: VaultSdkSource,
|
vaultSdkSource: VaultSdkSource,
|
||||||
|
@ -49,6 +50,7 @@ object VaultManagerModule {
|
||||||
networkConnectionManager: NetworkConnectionManager,
|
networkConnectionManager: NetworkConnectionManager,
|
||||||
dispatcherManager: DispatcherManager
|
dispatcherManager: DispatcherManager
|
||||||
): CipherManager = CipherManagerImpl(
|
): CipherManager = CipherManagerImpl(
|
||||||
|
context = context,
|
||||||
fileManager = fileManager,
|
fileManager = fileManager,
|
||||||
authDiskSource = authDiskSource,
|
authDiskSource = authDiskSource,
|
||||||
ciphersService = ciphersService,
|
ciphersService = ciphersService,
|
||||||
|
|
Loading…
Reference in a new issue