diff --git a/wallet_app/app/src/main/java/com/example/walletapp/datastore/DataStoreModule.kt b/wallet_app/app/src/main/java/com/example/walletapp/datastore/WalletStoreModule.kt similarity index 96% rename from wallet_app/app/src/main/java/com/example/walletapp/datastore/DataStoreModule.kt rename to wallet_app/app/src/main/java/com/example/walletapp/datastore/WalletStoreModule.kt index 8bc3b34..5f4ae6a 100644 --- a/wallet_app/app/src/main/java/com/example/walletapp/datastore/DataStoreModule.kt +++ b/wallet_app/app/src/main/java/com/example/walletapp/datastore/WalletStoreModule.kt @@ -10,7 +10,7 @@ import androidx.datastore.preferences.preferencesDataStore import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map -class DataStoreModule(private val context: Context) { +class WalletStoreModule(private val context: Context) { companion object { private val Context.dataStore: DataStore by preferencesDataStore("wallet_prefs") private val HAS_ACCOUNT = booleanPreferencesKey("has_account") diff --git a/wallet_app/app/src/main/java/com/example/walletapp/ui/WalletApp.kt b/wallet_app/app/src/main/java/com/example/walletapp/ui/WalletApp.kt index 3350ed2..3326f7b 100644 --- a/wallet_app/app/src/main/java/com/example/walletapp/ui/WalletApp.kt +++ b/wallet_app/app/src/main/java/com/example/walletapp/ui/WalletApp.kt @@ -8,8 +8,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController -import com.example.walletapp.BuildConfig -import com.example.walletapp.datastore.DataStoreModule +import com.example.walletapp.datastore.WalletStoreModule import com.example.walletapp.ui.account.AddTokenScreen import com.example.walletapp.ui.account.TokenViewModel import com.example.walletapp.ui.account.WalletScreen @@ -55,7 +54,7 @@ object Receive fun WalletApp(tokenViewModel: TokenViewModel) { val walletViewModel: WalletViewModel = viewModel() val context = LocalContext.current - val dataStore = DataStoreModule(context) + val dataStore = WalletStoreModule(context) val hasAccountState = dataStore.hasAccount.collectAsState(initial = null) hasAccountState.value?.let { hasAccount -> WalletappTheme { diff --git a/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/FinalizeAccountCreationScreen.kt b/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/FinalizeAccountCreationScreen.kt index f2caf3f..cfb86b6 100644 --- a/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/FinalizeAccountCreationScreen.kt +++ b/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/FinalizeAccountCreationScreen.kt @@ -29,10 +29,9 @@ import androidx.compose.ui.unit.sp import android.content.ClipboardManager import android.content.ClipData import android.widget.Toast -import androidx.compose.ui.graphics.painter.Painter import androidx.core.graphics.toColorInt import com.example.walletapp.R -import com.example.walletapp.datastore.DataStoreModule +import com.example.walletapp.datastore.WalletStoreModule import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -94,7 +93,7 @@ fun FinalizeAccountCreationScreen( fun AccountInfoView(onContinue: () -> Unit) { val context = LocalContext.current as Activity val clipboardManager = LocalContext.current.getSystemService(ClipboardManager::class.java) - val dataStore = DataStoreModule(context) + val dataStore = WalletStoreModule(context) var checked by remember { mutableStateOf(true) } val accountName = "Starknet" val privateKey = "q78ggh277ibckewjtnM" diff --git a/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/ImportAccountScreen.kt b/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/ImportAccountScreen.kt index ea9b69e..175f437 100644 --- a/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/ImportAccountScreen.kt +++ b/wallet_app/app/src/main/java/com/example/walletapp/ui/onboarding/ImportAccountScreen.kt @@ -1,10 +1,7 @@ package com.example.walletapp.ui.onboarding import android.app.Activity -import android.content.Intent -import androidx.compose.foundation.Image import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -13,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Button @@ -24,16 +20,12 @@ import androidx.compose.material3.OutlinedTextField import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TextFieldDefaults -import androidx.compose.material3.TopAppBar import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.IconButton -import androidx.compose.material3.ModalBottomSheet -import androidx.compose.material3.SheetState import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.ArrowForward -import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -44,15 +36,13 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.core.graphics.toColorInt -import com.example.walletapp.R -import com.example.walletapp.datastore.DataStoreModule +import com.example.walletapp.datastore.WalletStoreModule import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -149,7 +139,7 @@ fun PrivateKeyView(modifier: Modifier = Modifier, onNext: () -> Unit) { var openBottomSheet by remember { mutableStateOf(false) } val sheetState = rememberModalBottomSheetState() val context = (LocalContext.current as Activity) - val dataStore = DataStoreModule(context) + val dataStore = WalletStoreModule(context) Column( modifier = modifier @@ -239,7 +229,7 @@ fun CreateNameView(modifier: Modifier = Modifier, onFinishAccountImport: () -> U val borderColor = Color("#1B1B76".toColorInt()) var accountName by remember { mutableStateOf("") } val context = (LocalContext.current as Activity) - val dataStore = DataStoreModule(context) + val dataStore = WalletStoreModule(context) Column( modifier = modifier