Skip to content

Commit 167ba1e

Browse files
authored
feat(forgottenPasswordURL): add the redirection page (#60)
1 parent b6d1965 commit 167ba1e

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

.github/workflows/sonar_android.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4747
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
4848
run: |
49-
echo ${{ secrets.GOOGLE_SERVICE_FILE }} | base64 -d > app/google-services.json
49+
echo "${{ secrets.GOOGLE_SERVICE_FILE }}" | base64 -d > app/google-services.json
5050
mkdir -p app/config
51-
echo ${{ secrets.UAT_CONFIG_FILE }} | base64 -d > app/config/uat.properties
51+
echo "${{ secrets.UAT_CONFIG_FILE }}" | base64 -d > app/config/uat.properties
5252
./gradlew assembleDebug jacocoTestReport sonar

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ dependencies {
186186
implementation 'androidx.compose.material:material-icons-extended:1.7.8'
187187
implementation "androidx.compose.animation:animation-core:1.10.0"
188188
implementation 'androidx.fragment:fragment-ktx:1.8.9'
189+
implementation("androidx.browser:browser:1.8.0")
189190

190191
// Test
191192
implementation 'androidx.lifecycle:lifecycle-runtime-compose:2.10.0'

app/src/main/java/com/xpeho/xpeapp/ui/page/LoginPage.kt

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.xpeho.xpeapp.ui.page
22

3+
import android.net.Uri
4+
import androidx.browser.customtabs.CustomTabColorSchemeParams
5+
import androidx.browser.customtabs.CustomTabsIntent
6+
import androidx.compose.foundation.clickable
37
import androidx.compose.foundation.layout.Arrangement
48
import androidx.compose.foundation.layout.Column
59
import androidx.compose.foundation.layout.Spacer
@@ -17,11 +21,15 @@ import androidx.compose.ui.Alignment
1721
import androidx.compose.ui.Modifier
1822
import androidx.compose.ui.focus.FocusRequester
1923
import androidx.compose.ui.graphics.Color
24+
import androidx.compose.ui.graphics.toArgb
25+
import androidx.compose.ui.platform.LocalContext
2026
import androidx.compose.ui.platform.LocalFocusManager
2127
import androidx.compose.ui.res.painterResource
2228
import androidx.compose.ui.res.stringResource
29+
import androidx.compose.ui.text.font.FontWeight
2330
import androidx.compose.ui.text.input.ImeAction
2431
import androidx.compose.ui.text.style.TextAlign
32+
import androidx.compose.ui.text.style.TextDecoration
2533
import androidx.compose.ui.tooling.preview.Preview
2634
import androidx.compose.ui.unit.dp
2735
import androidx.compose.ui.unit.sp
@@ -37,6 +45,8 @@ import com.xpeho.xpeapp.ui.viewModel.viewModelFactory
3745
import com.xpeho.xpeho_ui_android.ClickyButton
3846
import com.xpeho.xpeho_ui_android.InputText
3947
import com.xpeho.xpeho_ui_android.foundations.Colors as XpehoColors
48+
import androidx.core.net.toUri
49+
import com.xpeho.xpeapp.BuildConfig
4050

4151
/**
4252
* Login page
@@ -75,15 +85,6 @@ fun LoginPage(onLoginSuccess: () -> Unit) {
7585
@Composable
7686
private fun LoginPageContent(
7787
wordpressViewModel: WordpressViewModel,
78-
) {
79-
LoginPageContentColumn(
80-
wordpressViewModel,
81-
)
82-
}
83-
84-
@Composable
85-
private fun LoginPageContentColumn(
86-
wordpressViewModel: WordpressViewModel,
8788
) {
8889
Column(
8990
modifier = Modifier
@@ -101,9 +102,42 @@ private fun LoginPageContentColumn(
101102
LoginPageButton(
102103
wordpressViewModel,
103104
)
105+
Spacer(modifier = Modifier.height(26.dp))
106+
ForgotPasswordText()
104107
}
105108
}
106109

110+
@Composable
111+
private fun ForgotPasswordText() {
112+
val context = LocalContext.current
113+
val focusManager = LocalFocusManager.current
114+
115+
Text(
116+
text = "Mot de passe oublié ?",
117+
color = XpehoColors.CONTENT_COLOR,
118+
fontSize = 16.sp,
119+
fontWeight = FontWeight.Bold,
120+
modifier = Modifier
121+
.clickable {
122+
focusManager.clearFocus()
123+
124+
val defaultColors = CustomTabColorSchemeParams.Builder()
125+
.setToolbarColor(XpehoColors.XPEHO_COLOR.toArgb())
126+
.build()
127+
128+
val customTabsIntent = CustomTabsIntent.Builder()
129+
.setDefaultColorSchemeParams(defaultColors)
130+
.setShowTitle(true)
131+
.setShareState(CustomTabsIntent.SHARE_STATE_OFF)
132+
.setUrlBarHidingEnabled(true)
133+
.build()
134+
135+
customTabsIntent.launchUrl(context, BuildConfig.PASSWORD_RESET_URL.toUri())
136+
}
137+
.padding(8.dp)
138+
)
139+
}
140+
107141
@Composable
108142
private fun LoginPageIcon() {
109143
Icon(
@@ -207,4 +241,4 @@ fun ErrorTextMessage(message: String) {
207241
@Composable
208242
fun ErrorTextMessagePreview() {
209243
ErrorTextMessage(message = "Veuillez entrer votre email")
210-
}
244+
}

0 commit comments

Comments
 (0)