Add toast

This commit is contained in:
Hinton 2024-10-24 15:41:44 -07:00
parent d4d980b576
commit 30531a40d3
No known key found for this signature in database
GPG key ID: 5F7295599C5D965C
2 changed files with 15 additions and 3 deletions

View file

@ -1,6 +1,8 @@
package com.x8bit.bitwarden.data.vault.manager
import android.content.Context
import android.net.Uri
import android.widget.Toast
import androidx.core.net.toUri
import com.bitwarden.vault.AttachmentView
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 kotlinx.coroutines.CoroutineScope
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.flowOf
import kotlinx.coroutines.flow.map
@ -51,6 +50,7 @@ import java.time.Clock
@OptIn(ExperimentalCoroutinesApi::class)
@Suppress("TooManyFunctions")
class CipherManagerImpl(
private val context: Context,
private val fileManager: FileManager,
private val authDiskSource: AuthDiskSource,
private val ciphersService: CiphersService,
@ -81,6 +81,7 @@ class CipherManagerImpl(
}
val userId = activeUserId!!
val hasItems = it.isNotEmpty()
it.map { c ->
val cipher = c.toOfflineCipher().toCipher()
@ -119,7 +120,16 @@ class CipherManagerImpl(
onSuccess = { it },
)
}
}
if (hasItems) {
externalScope.launch {
Toast.makeText(
context,
"Offline items uploaded",
Toast.LENGTH_SHORT
).show()
}
}
}
}

View file

@ -40,6 +40,7 @@ object VaultManagerModule {
@Provides
@Singleton
fun provideCipherManager(
@ApplicationContext context: Context,
ciphersService: CiphersService,
vaultDiskSource: VaultDiskSource,
vaultSdkSource: VaultSdkSource,
@ -49,6 +50,7 @@ object VaultManagerModule {
networkConnectionManager: NetworkConnectionManager,
dispatcherManager: DispatcherManager
): CipherManager = CipherManagerImpl(
context = context,
fileManager = fileManager,
authDiskSource = authDiskSource,
ciphersService = ciphersService,