Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move images to new module + remove strings from app #92

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.gemwallet.android.MainActivity
import com.gemwallet.android.R
import com.gemwallet.android.images.R
import com.gemwallet.android.cases.device.GetPushEnabledCase
import com.gemwallet.android.cases.device.SetPushTokenCase
import com.gemwallet.android.cases.device.SyncDeviceInfoCase
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/com/gemwallet/android/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Bundle
import android.widget.Toast
import android.widget.Toast.makeText
Expand Down Expand Up @@ -37,7 +36,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.UriHandler
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
Expand All @@ -52,6 +50,7 @@ import com.gemwallet.android.data.repositoreis.config.UserConfig
import com.gemwallet.android.features.bridge.proposal.ProposalScene
import com.gemwallet.android.features.bridge.request.RequestScene
import com.gemwallet.android.interactors.CheckAccounts
import com.gemwallet.android.localize.R
import com.gemwallet.android.services.SyncService
import com.gemwallet.android.ui.WalletApp
import com.gemwallet.android.ui.components.designsystem.Spacer16
Expand Down Expand Up @@ -120,7 +119,7 @@ class MainActivity : SecureBaseFragmentActivity() {
modifier = Modifier
.size(100.dp)
.align(Alignment.Center),
painter = painterResource(id = R.drawable.ic_splash),
painter = painterResource(id = com.gemwallet.android.images.R.drawable.ic_splash),
contentDescription = "splash"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import com.gemwallet.android.R
import com.gemwallet.android.features.add_asset.models.AddAssetError
import com.gemwallet.android.features.add_asset.models.AddAssetUIState
import com.gemwallet.android.localize.R
import com.gemwallet.android.ui.components.AddressChainField
import com.gemwallet.android.ui.components.CellEntity
import com.gemwallet.android.ui.components.Table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.compose.foundation.text.input.TextFieldState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.ext.asset
import com.gemwallet.android.features.asset_select.components.SearchBar
import com.gemwallet.android.ui.components.image.getIconUrl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.gemwallet.android.features.amount.components

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.amount.models.AmountError

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.amount.components.amountErrorString
import com.gemwallet.android.features.amount.models.AmountError
import com.gemwallet.android.features.confirm.models.AmountScreenModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.amount.viewmodels.AmountViewModel
import com.gemwallet.android.features.stake.validators.views.ValidatorsScreen
import com.gemwallet.android.model.ConfirmParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.ui.components.Container
import com.gemwallet.android.ui.components.ListItem
import com.gemwallet.android.ui.components.image.IconWithBadge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.wallet.core.primitives.ChartPeriod

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package com.gemwallet.android.features.asset.chart.viewmodels
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.images.R as imagesR
import com.gemwallet.android.data.repositoreis.assets.AssetsRepository
import com.gemwallet.android.ext.toAssetId
import com.gemwallet.android.features.asset.chart.models.AssetMarketUIModel
Expand Down Expand Up @@ -68,10 +69,10 @@ class AssetChartViewModel @Inject constructor(

private fun List<AssetLink>.toModel() = mapNotNull {
return@mapNotNull when (it.name) {
"coingecko" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_coingecko, R.drawable.coingecko)
"twitter" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_x, R.drawable.twitter)
"telegram" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_telegram, R.drawable.telegram)
"github" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_github, R.drawable.github)
"coingecko" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_coingecko, imagesR.drawable.coingecko)
"twitter" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_x, imagesR.drawable.twitter)
"telegram" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_telegram, imagesR.drawable.telegram)
"github" -> AssetMarketUIModel.Link(it.name, it.url, R.string.social_github, imagesR.drawable.github)
else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.ext.asset
import com.gemwallet.android.ext.chain
import com.gemwallet.android.ext.networkAsset
import com.gemwallet.android.ext.type
import com.gemwallet.android.features.asset.details.models.AssetInfoUIModel
import com.gemwallet.android.features.asset.details.models.AssetInfoUIState
import com.gemwallet.android.features.asset.details.models.AssetStateError
import com.gemwallet.android.features.asset.details.viewmodels.AsseDetailsViewModel
import com.gemwallet.android.features.banners.views.BannersScene
import com.gemwallet.android.features.transactions.components.transactionsList
import com.gemwallet.android.localize.R
import com.gemwallet.android.ui.components.AmountListHead
import com.gemwallet.android.ui.components.AssetHeadActions
import com.gemwallet.android.ui.components.CellEntity
Expand All @@ -53,7 +52,6 @@ import com.gemwallet.android.ui.components.LoadingScene
import com.gemwallet.android.ui.components.SubheaderItem
import com.gemwallet.android.ui.components.Table
import com.gemwallet.android.ui.components.designsystem.padding32
import com.gemwallet.android.ui.components.designsystem.trailingIcon20
import com.gemwallet.android.ui.components.image.AsyncImage
import com.gemwallet.android.ui.components.image.getIconUrl
import com.gemwallet.android.ui.components.open
Expand Down Expand Up @@ -235,7 +233,9 @@ private fun Success(
balanceDetails(uiState, onStake)
if (transactions.isEmpty()) {
item {
Box(modifier = Modifier.fillMaxWidth().padding(vertical = padding32)) {
Box(modifier = Modifier
.fillMaxWidth()
.padding(vertical = padding32)) {
Text(
modifier = Modifier.align(Alignment.Center),
color = MaterialTheme.colorScheme.secondary,
Expand Down Expand Up @@ -278,7 +278,14 @@ private fun LazyListScope.networkInfo(
CellEntity(
label = stringResource(id = R.string.transfer_network),
data = uiState.networkTitle,
trailing = { AsyncImage(uiState.asset.networkAsset(), trailingIcon20) },
trailing = {
AsyncImage(
model = uiState.asset.chain().getIconUrl(),
contentDescription = "asset_icon",
placeholderText = uiState.asset.type.string,
modifier = Modifier.size(20.dp),
)
},
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.ext.toIdentifier
import com.gemwallet.android.features.asset_select.components.SearchBar
import com.gemwallet.android.features.asset_select.viewmodels.BaseAssetSelectViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.ext.asset
import com.gemwallet.android.ext.type
import com.gemwallet.android.features.asset_select.viewmodels.AssetSelectViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.gemwallet.android.features.asset_select.views
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.asset_select.viewmodels.BuySelectViewModel
import com.gemwallet.android.ui.components.getBalanceInfo
import com.wallet.core.primitives.AssetId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.hilt.navigation.compose.hiltViewModel
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.asset_select.viewmodels.AssetSelectViewModel
import com.wallet.core.primitives.AssetId

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.gemwallet.android.features.asset_select.views
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.asset_select.viewmodels.SendSelectViewModel
import com.gemwallet.android.ui.components.getBalanceInfo
import com.wallet.core.primitives.AssetId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.asset_select.viewmodels.SwapSelectViewModel
import com.gemwallet.android.features.swap.models.SwapPairSelect
import com.gemwallet.android.ui.components.getBalanceInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package com.gemwallet.android.features.assets.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.images.R as imagesR
import com.gemwallet.android.data.repositoreis.assets.AssetsRepository
import com.gemwallet.android.data.repositoreis.session.SessionRepository
import com.gemwallet.android.ext.getAccount
Expand All @@ -14,7 +15,6 @@ import com.gemwallet.android.model.AssetInfo
import com.gemwallet.android.model.Session
import com.gemwallet.android.model.SyncState
import com.gemwallet.android.model.format
import com.gemwallet.android.ui.components.image.getDrawableUri
import com.gemwallet.android.ui.models.AssetInfoUIModel
import com.gemwallet.android.ui.models.AssetItemUIModel
import com.wallet.core.primitives.AssetId
Expand Down Expand Up @@ -130,7 +130,7 @@ class AssetsViewModel @Inject constructor(
if (it.isNaN()) 0.0 else it
}
val icon = when (wallet.type) {
WalletType.multicoin -> R.drawable.multicoin_wallet
WalletType.multicoin -> imagesR.drawable.multicoin_wallet
else -> wallet.accounts.firstOrNull()?.chain?.getIconUrl()
}
return WalletInfoUIState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.images.R as imagesR
import com.gemwallet.android.ext.toIdentifier
import com.gemwallet.android.features.assets.model.WalletInfoUIState
import com.gemwallet.android.features.assets.viewmodel.AssetsViewModel
Expand Down Expand Up @@ -234,7 +235,7 @@ private fun AssetItem(
DropdownMenuItem(
text = { Text( text = stringResource(id = if (isPinned) R.string.common_unpin else R.string.common_pin)) },
trailingIcon = {
if (isPinned) Icon(painterResource(R.drawable.keep_off), "unpin")
if (isPinned) Icon(painterResource(imagesR.drawable.keep_off), "unpin")
else Icon(Icons.Default.PushPin, "pin")

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.images.R as imagesR
import com.gemwallet.android.ext.chain
import com.gemwallet.android.ext.toIdentifier
import com.gemwallet.android.features.banners.viewmodels.BannersViewModel
import com.gemwallet.android.model.Crypto
import com.gemwallet.android.model.format
import com.gemwallet.android.ui.components.image.getIconUrl
import com.gemwallet.android.ui.components.image.IconWithBadge
import com.gemwallet.android.ui.components.designsystem.Spacer16
Expand All @@ -44,8 +43,6 @@ import com.wallet.core.primitives.Asset
import com.wallet.core.primitives.Banner
import com.wallet.core.primitives.BannerEvent
import com.wallet.core.primitives.BannerState
import com.wallet.core.primitives.Chain
import uniffi.gemstone.Config

@Composable
fun BannersScene(
Expand Down Expand Up @@ -85,7 +82,7 @@ fun BannersScene(
title = title,
subtitle = description,
iconUrl = asset?.getIconUrl()
?: "android.resource://com.gemwallet.android/${R.drawable.brandmark}",
?: "android.resource://com.gemwallet.android/${imagesR.drawable.brandmark}",
state = banner.state,
) { viewModel.onCancel(banner) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.bridge.connection.viewmodels.ConnectionViewModel
import com.gemwallet.android.features.bridge.connections.views.ConnectionItem
import com.gemwallet.android.ui.components.CellEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.bridge.connections.viewmodels.ConnectionsViewModel
import com.gemwallet.android.features.bridge.model.ConnectionUI
import com.gemwallet.android.ui.components.ListItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.wallets.components.WalletItem
import com.gemwallet.android.ui.components.CellEntity
import com.gemwallet.android.ui.components.FatalStateScene
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.confirm.views.ConfirmScreen
import com.gemwallet.android.model.ConfirmParams
import com.gemwallet.android.model.DestinationAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.ext.asset
import com.gemwallet.android.ext.type
import com.gemwallet.android.features.buy.models.BuyError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.gemwallet.android.features.confirm.viewmodels
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.blockchain.clients.BroadcastClientProxy
import com.gemwallet.android.blockchain.clients.SignClientProxy
import com.gemwallet.android.blockchain.clients.SignerPreload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.features.confirm.models.ConfirmError
import com.gemwallet.android.features.confirm.models.ConfirmState
import com.gemwallet.android.features.confirm.viewmodels.ConfirmViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.gemwallet.android.R
import com.gemwallet.android.localize.R
import com.gemwallet.android.model.Fee
import com.gemwallet.android.model.GasFee
import com.gemwallet.android.model.TxSpeed
Expand Down
Loading
Loading