Skip to content

Commit

Permalink
Merge branch 'migrate-the-login-view-to-compose-droid-53'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Sep 27, 2023
2 parents 24acf70 + 1ede002 commit 0377ffd
Show file tree
Hide file tree
Showing 25 changed files with 887 additions and 1,408 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Line wrap the file at 100 chars. Th
- Migrate in app notifications to compose.
- Move out of time evaluation to connect view model.
- Migrate out of time view to compose.
- Migrate login view to compose.

#### Linux
- Don't block forwarding of traffic when the split tunnel mark (ct mark) is set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ fun ContentBlockersDisableModeCellSubtitle(modifier: Modifier) {
Text(
text = spanned.toAnnotatedString(boldFontWeight = FontWeight.ExtraBold),
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSecondary,
modifier = modifier
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -110,57 +111,73 @@ fun AccountScreen(

val scrollState = rememberScrollState()

Column(
verticalArrangement = Arrangement.Bottom,
horizontalAlignment = Alignment.Start,
modifier =
Modifier.background(MaterialTheme.colorScheme.background)
.fillMaxSize()
.drawVerticalScrollbar(scrollState)
.verticalScroll(scrollState)
.animateContentSize()
) {
Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.device_name),
modifier = Modifier.padding(start = Dimens.sideMargin, end = Dimens.sideMargin)
)
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
Column(
verticalArrangement = Arrangement.Bottom,
horizontalAlignment = Alignment.Start,
modifier =
Modifier.fillMaxSize()
.drawVerticalScrollbar(scrollState)
.verticalScroll(scrollState)
.animateContentSize()
) {
Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.device_name),
modifier = Modifier.padding(start = Dimens.sideMargin, end = Dimens.sideMargin)
)

InformationView(
content = uiState.deviceName.capitalizeFirstCharOfEachWord(),
whenMissing = MissingPolicy.SHOW_SPINNER
)
InformationView(
content = uiState.deviceName.capitalizeFirstCharOfEachWord(),
whenMissing = MissingPolicy.SHOW_SPINNER
)

Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.account_number),
modifier =
Modifier.padding(
start = Dimens.sideMargin,
end = Dimens.sideMargin,
top = Dimens.smallPadding
)
)
Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.account_number),
modifier =
Modifier.padding(
start = Dimens.sideMargin,
end = Dimens.sideMargin,
top = Dimens.smallPadding
)
)

CopyableObfuscationView(content = uiState.accountNumber)
CopyableObfuscationView(content = uiState.accountNumber)

Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.paid_until),
modifier = Modifier.padding(start = Dimens.sideMargin, end = Dimens.sideMargin)
)
Text(
style = MaterialTheme.typography.labelMedium,
text = stringResource(id = R.string.paid_until),
modifier = Modifier.padding(start = Dimens.sideMargin, end = Dimens.sideMargin)
)

InformationView(
content = uiState.accountExpiry?.toExpiryDateString() ?: "",
whenMissing = MissingPolicy.SHOW_SPINNER
)
InformationView(
content = uiState.accountExpiry?.toExpiryDateString() ?: "",
whenMissing = MissingPolicy.SHOW_SPINNER
)

Spacer(modifier = Modifier.weight(1f))
Spacer(modifier = Modifier.weight(1f))
if (IS_PLAY_BUILD.not()) {
ActionButton(
text = stringResource(id = R.string.manage_account),
onClick = onManageAccountClick,
modifier =
Modifier.padding(
start = Dimens.sideMargin,
end = Dimens.sideMargin,
bottom = Dimens.screenVerticalMargin
),
colors =
ButtonDefaults.buttonColors(
contentColor = MaterialTheme.colorScheme.onPrimary,
containerColor = MaterialTheme.colorScheme.surface
)
)
}

if (IS_PLAY_BUILD.not()) {
ActionButton(
text = stringResource(id = R.string.manage_account),
onClick = onManageAccountClick,
text = stringResource(id = R.string.redeem_voucher),
onClick = onRedeemVoucherClick,
modifier =
Modifier.padding(
start = Dimens.sideMargin,
Expand All @@ -173,39 +190,23 @@ fun AccountScreen(
containerColor = MaterialTheme.colorScheme.surface
)
)
}

ActionButton(
text = stringResource(id = R.string.redeem_voucher),
onClick = onRedeemVoucherClick,
modifier =
Modifier.padding(
start = Dimens.sideMargin,
end = Dimens.sideMargin,
bottom = Dimens.screenVerticalMargin
),
colors =
ButtonDefaults.buttonColors(
contentColor = MaterialTheme.colorScheme.onPrimary,
containerColor = MaterialTheme.colorScheme.surface
)
)

ActionButton(
text = stringResource(id = R.string.log_out),
onClick = onLogoutClick,
modifier =
Modifier.padding(
start = Dimens.sideMargin,
end = Dimens.sideMargin,
bottom = Dimens.screenVerticalMargin
),
colors =
ButtonDefaults.buttonColors(
contentColor = MaterialTheme.colorScheme.onPrimary,
containerColor = MaterialTheme.colorScheme.error
)
)
ActionButton(
text = stringResource(id = R.string.log_out),
onClick = onLogoutClick,
modifier =
Modifier.padding(
start = Dimens.sideMargin,
end = Dimens.sideMargin,
bottom = Dimens.screenVerticalMargin
),
colors =
ButtonDefaults.buttonColors(
contentColor = MaterialTheme.colorScheme.onPrimary,
containerColor = MaterialTheme.colorScheme.error
)
)
}
}
}
}
Loading

0 comments on commit 0377ffd

Please sign in to comment.