Skip to content

Commit

Permalink
Implement UI for Subscription page
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Dec 16, 2024
1 parent ae470e0 commit fc653c9
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@ private fun SettingSections(
}
)
},
{
HsSettingCell(
R.string.Settings_Subscription,
R.drawable.ic_star_24,
value = stringResource(R.string.SettingsSubscription_Active),
onClick = {
navController.slideFromRight(R.id.subscriptionFragment)

}
)
},
{
HsSettingCell(
R.string.Settings_BaseCurrency,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package io.horizontalsystems.bankwallet.modules.settings.subscription

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavController
import io.horizontalsystems.bankwallet.R
import io.horizontalsystems.bankwallet.core.BaseComposeFragment
import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme
import io.horizontalsystems.bankwallet.ui.compose.components.AppBar
import io.horizontalsystems.bankwallet.ui.compose.components.CellUniversalLawrenceSection
import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton
import io.horizontalsystems.bankwallet.ui.compose.components.InfoText
import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal
import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer
import io.horizontalsystems.bankwallet.ui.compose.components.body_leah
import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_jacob

class SubscriptionFragment : BaseComposeFragment() {

@Composable
override fun GetContent(navController: NavController) {
SubscriptionScreen(navController)
}

}

@Composable
fun SubscriptionScreen(navController: NavController) {
val viewModel = viewModel<SubscriptionViewModel>(factory = SubscriptionModule.Factory())

Column(
modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)
) {
AppBar(
title = stringResource(R.string.Settings_Subscription),
navigationIcon = {
HsBackButton(onClick = { navController.popBackStack() })
}
)
Column(
Modifier.verticalScroll(rememberScrollState())
) {
VSpacer(12.dp)
CellUniversalLawrenceSection {
RowUniversal(
modifier = Modifier.padding(horizontal = 16.dp),
onClick = {
//todo add action
}
) {
body_leah(
text = stringResource(R.string.SettingsSubscription_SubscriptionPlan),
maxLines = 1,
modifier = Modifier.weight(1f)
)
subhead1_jacob(
text = "PRO",
maxLines = 1,
modifier = Modifier.padding(horizontal = 8.dp)
)
Image(
modifier = Modifier.size(20.dp),
painter = painterResource(id = R.drawable.ic_arrow_right),
contentDescription = null,
)
}
}
InfoText(
text = stringResource(R.string.SettingsSubscription_SubscriptionInfo, "10.06.25"),
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.horizontalsystems.bankwallet.modules.settings.subscription

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import io.horizontalsystems.bankwallet.core.App
import io.horizontalsystems.bankwallet.core.ILocalStorage

class SubscriptionViewModel(
private val localStorage: ILocalStorage
) : ViewModel() {


}


object SubscriptionModule {
class Factory : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return SubscriptionViewModel(App.localStorage) as T
}
}
}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_star_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,2C12.395,2 12.753,2.232 12.913,2.593L15.432,8.24L21.603,8.881C21.997,8.922 22.329,9.191 22.451,9.567C22.573,9.944 22.462,10.356 22.167,10.62L17.555,14.75L18.849,20.791C18.932,21.177 18.779,21.576 18.46,21.808C18.141,22.041 17.714,22.064 17.372,21.866L12,18.771L6.628,21.866C6.286,22.064 5.859,22.041 5.54,21.808C5.221,21.576 5.068,21.177 5.151,20.791L6.445,14.75L1.833,10.62C1.538,10.356 1.427,9.944 1.549,9.567C1.671,9.191 2.003,8.922 2.397,8.881L8.568,8.24L11.087,2.593C11.248,2.232 11.605,2 12,2ZM12,5.455L10.16,9.582C10.014,9.909 9.705,10.132 9.35,10.169L4.849,10.637L8.212,13.647C8.479,13.887 8.598,14.251 8.522,14.602L7.578,19.011L11.501,16.75C11.81,16.572 12.19,16.572 12.499,16.75L16.423,19.011L15.478,14.602C15.403,14.251 15.521,13.887 15.788,13.647L19.151,10.637L14.65,10.169C14.295,10.132 13.986,9.909 13.84,9.582L12,5.455Z"
android:fillColor="#808085"
android:fillType="evenOdd"/>
</vector>
3 changes: 3 additions & 0 deletions app/src/main/res/navigation/main_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@
<fragment
android:id="@+id/languageSettingsFragment"
android:name="io.horizontalsystems.bankwallet.modules.settings.language.LanguageSettingsFragment" />
<fragment
android:id="@+id/subscriptionFragment"
android:name="io.horizontalsystems.bankwallet.modules.settings.subscription.SubscriptionFragment" />
<fragment
android:id="@+id/termsFragment"
android:name="io.horizontalsystems.bankwallet.modules.settings.terms.TermsFragment"/>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@
<string name="Settings_RateUs">Rate Us</string>
<string name="Settings_LaunchScreen">Launch Screen</string>
<string name="Settings_Appearance">Appearance</string>
<string name="Settings_Subscription">Subscription</string>
<string name="Settings_Contact_ViaTelegram">via Telegram</string>
<string name="Settings_Contact_ViaEmail">via E-mail</string>
<string name="Settings_AutoLock">Auto-Lock</string>
Expand Down Expand Up @@ -862,6 +863,11 @@
<string name="SettingsBanner_PremiumBannerHighlightedWord">Full Power</string>
<string name="SettingsBanner_PremiumBannerDescription">Unleash the Full Power of Unstoppable Wallet</string>

<!--Setting Subscription -->
<string name="SettingsSubscription_Active">Active</string>
<string name="SettingsSubscription_SubscriptionPlan">Subscription Plan</string>
<string name="SettingsSubscription_SubscriptionInfo">Next payment date: %s. You can manage your subscription in the Manage Subscription section.</string>

<!--Premium Screens-->
<string name="Premium_Title">Premium</string>
<string name="Premium_ChoosePlanForYou">Choose the plan</string>
Expand Down

0 comments on commit fc653c9

Please sign in to comment.