Skip to content

Commit 4c67e30

Browse files
committed
Add spotless fixes
1 parent a9b7040 commit 4c67e30

20 files changed

+175
-54
lines changed

Shrine/app/src/main/java/com/authentication/shrine/CredentialManagerUtils.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ import androidx.credentials.SignalUnknownCredentialRequest
3939
import androidx.credentials.exceptions.CreateCredentialException
4040
import androidx.credentials.exceptions.GetCredentialCancellationException
4141
import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialDomException
42-
import com.authentication.shrine.repository.SERVER_CLIENT_ID
43-
import com.google.android.libraries.identity.googleid.GetGoogleIdOption
4442
import androidx.datastore.core.DataStore
4543
import androidx.datastore.preferences.core.Preferences
4644
import com.authentication.shrine.repository.AuthRepository.Companion.RP_ID_KEY
4745
import com.authentication.shrine.repository.AuthRepository.Companion.USER_ID_KEY
4846
import com.authentication.shrine.repository.AuthRepository.Companion.read
47+
import com.authentication.shrine.repository.SERVER_CLIENT_ID
48+
import com.google.android.libraries.identity.googleid.GetGoogleIdOption
4949
import org.json.JSONObject
5050
import javax.inject.Inject
5151

@@ -117,7 +117,7 @@ class CredentialManagerUtils @Inject constructor(
117117
.setServerClientId(SERVER_CLIENT_ID)
118118
.setFilterByAuthorizedAccounts(false)
119119
.build(),
120-
)
120+
),
121121
)
122122
result = credentialManager.getCredential(context, credentialRequest)
123123
} catch (e: GetCredentialCancellationException) {

Shrine/app/src/main/java/com/authentication/shrine/api/AuthApiService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ interface AuthApiService {
165165
*/
166166
@POST("federation/options")
167167
suspend fun getFederationOptions(
168-
@Body urls: FederationOptionsRequest
168+
@Body urls: FederationOptionsRequest,
169169
): Response<GenericAuthResponse>
170170

171171
/**
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package com.authentication.shrine.model
217

318
/**
419
* Represents the request body for getting federation options from the server.
520
* @param urls a list of urls to send for federated requests.
621
*/
722
data class FederationOptionsRequest(
8-
val urls: List<String> = listOf("https://accounts.google.com")
9-
)
23+
val urls: List<String> = listOf("https://accounts.google.com"),
24+
)
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package com.authentication.shrine.model
217

318
/**
@@ -7,5 +22,5 @@ package com.authentication.shrine.model
722
*/
823
data class SignInWithGoogleRequest(
924
val token: String,
10-
val url: String = "https://accounts.google.com"
11-
)
25+
val url: String = "https://accounts.google.com",
26+
)

Shrine/app/src/main/java/com/authentication/shrine/repository/AuthRepository.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,15 +427,22 @@ class AuthRepository @Inject constructor(
427427
*/
428428
suspend fun signInWithFederatedTokenResponse(
429429
sessionId: String,
430+
<<<<<<< HEAD
430431
credentialResponse: GetCredentialResponse
431432
): AuthResult<Unit> {
432433
return try {
433434
val credential = credentialResponse.credential
435+
=======
436+
credentialResponse: GetCredentialResponse,
437+
): Boolean {
438+
val credential = credentialResponse.credential
439+
try {
440+
>>>>>>> b12d692 (Add spotless fixes)
434441
if (credential is CustomCredential) {
435442
val isSuccess = verifyIdToken(
436443
sessionId,
437444
GoogleIdTokenCredential
438-
.createFrom(credential.data).idToken
445+
.createFrom(credential.data).idToken,
439446
)
440447
if (isSuccess) {
441448
AuthResult.Success(Unit)
@@ -643,7 +650,7 @@ class AuthRepository @Inject constructor(
643650
suspend fun verifyIdToken(sessionId: String, token: String): Boolean {
644651
val apiResult = authApiService.verifyIdToken(
645652
cookie = sessionId.createCookieHeader(),
646-
requestParams = SignInWithGoogleRequest(token = token)
653+
requestParams = SignInWithGoogleRequest(token = token),
647654
)
648655

649656
if (apiResult.isSuccessful) {

Shrine/app/src/main/java/com/authentication/shrine/ui/AuthenticationScreen.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ fun AuthenticationScreen(
190190
isButtonEnabled = !uiState.isLoading,
191191
)
192192

193+
<<<<<<< HEAD
193194
// Sign in with Google image
194195
Image(
195196
painter = painterResource(id = R.drawable.siwg_button_light),
@@ -201,6 +202,19 @@ fun AuthenticationScreen(
201202
onClick = onSignInWithSignInWithGoogleRequest)
202203
)
203204
}
205+
=======
206+
// Sign in with Google image
207+
Image(
208+
painter = painterResource(id = R.drawable.siwg_button_light),
209+
contentDescription = stringResource(R.string.sign_in_with_google_button),
210+
modifier = Modifier
211+
.height(dimensionResource(R.dimen.siwg_button_height))
212+
.clickable(
213+
enabled = !uiState.isLoading,
214+
onClick = onSignInWithSignInWithGoogleRequest,
215+
),
216+
)
217+
>>>>>>> b12d692 (Add spotless fixes)
204218
}
205219

206220
if (uiState.isLoading) {
@@ -229,7 +243,7 @@ fun AuthenticationScreen(
229243
if (snackbarMessage != null) {
230244
LaunchedEffect(snackbarMessage) {
231245
snackbarHostState.showSnackbar(
232-
message = snackbarMessage
246+
message = snackbarMessage,
233247
)
234248
}
235249
}

Shrine/app/src/main/java/com/authentication/shrine/ui/PasskeyManagementScreen.kt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ import androidx.compose.material3.TextButton
4242
import androidx.compose.runtime.Composable
4343
import androidx.compose.runtime.LaunchedEffect
4444
import androidx.compose.runtime.collectAsState
45+
<<<<<<< HEAD
46+
=======
47+
import androidx.compose.runtime.getValue
48+
>>>>>>> b12d692 (Add spotless fixes)
4549
import androidx.compose.runtime.remember
4650
import androidx.compose.ui.Alignment
4751
import androidx.compose.ui.Modifier
@@ -108,7 +112,7 @@ fun PasskeyManagementScreen(
108112

109113
val onSignalBtnClicked = {
110114
val credentialIdsList = passkeysList
111-
.filter { it.isSelected }
115+
.filter { !it.isSelected }
112116
.map { it.id }
113117
if (credentialIdsList.isNotEmpty()) {
114118
viewModel.signalAccepted(credentialIdsList)
@@ -187,8 +191,8 @@ fun PasskeyManagementScreen(
187191

188192
ShrineButton(
189193
onClick = onSignal,
190-
buttonText = "Signal Accepted",
191-
modifier = Modifier.fillMaxWidth()
194+
buttonText = "Delete selected credentials",
195+
modifier = Modifier.fillMaxWidth(),
192196
)
193197
} else {
194198
ShrineButton(
@@ -252,7 +256,7 @@ fun PasskeysListColumn(
252256
credentialProviderName = item.name,
253257
passkeyCreationDate = item.registeredAt.toReadableDate(),
254258
isChecked = item.isSelected,
255-
modifier = Modifier.clickable { onItemClick(index) }
259+
modifier = Modifier.clickable { onItemClick(index) },
256260
)
257261

258262
if (index < passkeysList.lastIndex) {
@@ -304,7 +308,7 @@ fun PasskeysDetailsRow(
304308
Checkbox(
305309
checked = isChecked,
306310
onCheckedChange = {},
307-
modifier = Modifier.clickable(enabled = false, onClick = { })
311+
modifier = Modifier.clickable(enabled = false, onClick = { }),
308312
)
309313

310314
Image(
@@ -370,10 +374,18 @@ fun PasskeyManagementScreenPreview() {
370374
providerIcon = ""
371375
)
372376
),
377+
<<<<<<< HEAD
373378
aaguidData = mapOf(),
374379
onItemClick = { _ -> },
375380
onSignal = { },
376381
)
377382
}
383+
=======
384+
),
385+
aaguidData = mapOf(),
386+
{ _ -> },
387+
{},
388+
)
389+
>>>>>>> b12d692 (Add spotless fixes)
378390
}
379391
}

Shrine/app/src/main/java/com/authentication/shrine/ui/UpdateProfileScreen.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ fun UpdateProfileScreen(
6666
value = username,
6767
onValueChange = onUsernameChanged,
6868
hint = stringResource(R.string.username),
69-
modifier = Modifier.fillMaxWidth()
69+
modifier = Modifier.fillMaxWidth(),
7070
)
7171

7272
ShrineTextField(
7373
value = email,
7474
onValueChange = onEmailChanged,
7575
hint = stringResource(R.string.email_address),
76-
modifier = Modifier.fillMaxWidth()
76+
modifier = Modifier.fillMaxWidth(),
7777
)
7878

7979
ShrineButton(
@@ -92,7 +92,7 @@ fun TestPreview() {
9292
{},
9393
"",
9494
{},
95-
{_, _ -> },
95+
{ _, _ -> },
9696
)
9797
}
9898
}

Shrine/app/src/main/java/com/authentication/shrine/ui/common/ShrineTextField.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import androidx.compose.material3.Text
2828
import androidx.compose.runtime.Composable
2929
import androidx.compose.ui.Modifier
3030
import androidx.compose.ui.res.dimensionResource
31+
<<<<<<< HEAD
32+
=======
33+
import androidx.compose.ui.res.stringResource
34+
>>>>>>> b12d692 (Add spotless fixes)
3135
import androidx.compose.ui.tooling.preview.Preview
3236
import com.authentication.shrine.R
3337
import com.authentication.shrine.ui.theme.ShrineTheme

Shrine/app/src/main/java/com/authentication/shrine/ui/viewmodel/PasskeyManagementViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class PasskeyManagementViewModel @Inject constructor(
284284
} else {
285285
passkeyCredential
286286
}
287-
}
287+
},
288288
)
289289
}
290290
}

0 commit comments

Comments
 (0)