Skip to content

Commit a1bce29

Browse files
committed
Ran ./gradlew ktlintFormat to appease Github push action.
1 parent de2008f commit a1bce29

File tree

12 files changed

+98
-89
lines changed

12 files changed

+98
-89
lines changed

wrapper/src/debug/java/io/yubicolabs/wwwwallet/bridging/DebugMenuHandler.kt

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class DebugMenuHandler(
8181
val items = actions.keys.toTypedArray()
8282
val theme = io.yubicolabs.wwwwallet.R.style.Theme_Wwwallet_Dialog
8383

84-
AlertDialog.Builder(context, theme)
84+
AlertDialog
85+
.Builder(context, theme)
8586
.setTitle("Debug Menu (v${BuildConfig.VERSION_NAME})")
8687
.setItems(
8788
items,
@@ -93,16 +94,13 @@ class DebugMenuHandler(
9394
} else {
9495
jsExecutor("window.alert('Option $which (${items[which]}) is not implemented.')") {}
9596
}
96-
}
97-
.setPositiveButton(android.R.string.ok) { dialog, which ->
97+
}.setPositiveButton(android.R.string.ok) { dialog, which ->
9898
jsExecutor("console.log('OK')") {}
9999
dialog.dismiss()
100-
}
101-
.setNegativeButton(android.R.string.cancel) { dialog, which ->
100+
}.setNegativeButton(android.R.string.cancel) { dialog, which ->
102101
jsExecutor("console.log('Not OK')") {}
103102
dialog.dismiss()
104-
}
105-
.show()
103+
}.show()
106104
}
107105

108106
fun showLogs(
@@ -111,26 +109,26 @@ class DebugMenuHandler(
111109
) {
112110
val theme = io.yubicolabs.wwwwallet.R.style.Theme_Wwwallet_Dialog
113111

114-
AlertDialog.Builder(context, theme)
112+
AlertDialog
113+
.Builder(context, theme)
115114
.setTitle("Log")
116115
.setItems(
117-
logs.map { log ->
118-
log.replace(
119-
Regex("[0-9]+: (.*)"),
120-
"<tt>$1</tt>",
121-
).parseAsHtml()
122-
}
123-
.toTypedArray(),
116+
logs
117+
.map { log ->
118+
log
119+
.replace(
120+
Regex("[0-9]+: (.*)"),
121+
"<tt>$1</tt>",
122+
).parseAsHtml()
123+
}.toTypedArray(),
124124
) { dialog, which ->
125125
copyToClipboard(logs[which])
126126
dialog.dismiss()
127-
}
128-
.setPositiveButton(android.R.string.ok) { dialog, which ->
127+
}.setPositiveButton(android.R.string.ok) { dialog, which ->
129128
dialog.dismiss()
130129
}.setNeutralButton("📋") { dialog, which ->
131130
copyToClipboard(logs.joinToString("\n"))
132-
}
133-
.show()
131+
}.show()
134132
}
135133

136134
private fun openPasskeyProviderSettings() {
@@ -139,11 +137,12 @@ class DebugMenuHandler(
139137
val int = man.createSettingsPendingIntent()
140138
int.send()
141139
} else {
142-
Toast.makeText(
143-
context,
144-
"Not available on your OS version. You have ${Build.VERSION.SDK_INT} but it needs to be ${Build.VERSION_CODES.VANILLA_ICE_CREAM}.",
145-
Toast.LENGTH_LONG,
146-
).show()
140+
Toast
141+
.makeText(
142+
context,
143+
"Not available on your OS version. You have ${Build.VERSION.SDK_INT} but it needs to be ${Build.VERSION_CODES.VANILLA_ICE_CREAM}.",
144+
Toast.LENGTH_LONG,
145+
).show()
147146
}
148147
}
149148

wrapper/src/main/java/io/yubicolabs/wwwwallet/MainActivity.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,12 @@ private fun createWebViewFactory(
232232
webView.webChromeClient = webChromeClient
233233

234234
ServiceWorkerController
235-
.getInstance().apply {
235+
.getInstance()
236+
.apply {
236237
serviceWorkerWebSettings.allowContentAccess = true
237238
setServiceWorkerClient(
238239
object : ServiceWorkerClient() {
239-
override fun shouldInterceptRequest(request: WebResourceRequest?): WebResourceResponse? {
240-
return super.shouldInterceptRequest(request)
241-
}
240+
override fun shouldInterceptRequest(request: WebResourceRequest?): WebResourceResponse? = super.shouldInterceptRequest(request)
242241
},
243242
)
244243
}

wrapper/src/main/java/io/yubicolabs/wwwwallet/MainViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ class MainViewModel : ViewModel() {
4848

4949
object DeeplinkRequest : UpdateReason()
5050

51-
data class WebpageError(val errorMessage: String) : UpdateReason()
51+
data class WebpageError(
52+
val errorMessage: String,
53+
) : UpdateReason()
5254
}
5355

5456
private val _updateBaseUrl: MutableStateFlow<UpdateReason?> = MutableStateFlow(null)

wrapper/src/main/java/io/yubicolabs/wwwwallet/bluetooth/BleClientHandler.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,14 @@ class BleClientHandler(
317317
}
318318
}
319319

320-
fun status(): String {
321-
return state.let {
320+
fun status(): String =
321+
state.let {
322322
when (it) {
323323
is Scanning -> "Scanning: ${it.scanner}."
324324
is Connected -> "Connected."
325325
is Disconnected -> "Disconnected."
326326
}
327327
}
328-
}
329328

330329
fun createClient(
331330
serviceUuid: String,

wrapper/src/main/java/io/yubicolabs/wwwwallet/bluetooth/BleServerHandler.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,17 @@ class BleServerHandler(
117117

118118
val advertiser = adapter!!.bluetoothLeAdvertiser
119119
val settings =
120-
AdvertiseSettings.Builder()
120+
AdvertiseSettings
121+
.Builder()
121122
.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY)
122123
.setConnectable(true)
123124
.setTimeout(0)
124125
.setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM)
125126
.build()
126127

127128
val data =
128-
AdvertiseData.Builder()
129+
AdvertiseData
130+
.Builder()
129131
.setIncludeTxPowerLevel(false)
130132
.addServiceUuid(ParcelUuid(serviceUuid))
131133
.build()
@@ -151,15 +153,14 @@ class BleServerHandler(
151153
success()
152154
}
153155

154-
fun status(): String {
155-
return state.let {
156+
fun status(): String =
157+
state.let {
156158
when (it) {
157159
is Advertising -> "Advertising: ${it.server}"
158160
is Connected -> "Connected."
159161
is Disconnected -> "Disconnected."
160162
}
161163
}
162-
}
163164

164165
fun disconnect() {
165166
state.let {

wrapper/src/main/java/io/yubicolabs/wwwwallet/bluetooth/debug/PrintingBluetoothGattServerCallback.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import io.yubicolabs.wwwwallet.bluetooth.toHumanReadable
1313
import io.yubicolabs.wwwwallet.logging.YOLOLogger
1414
import io.yubicolabs.wwwwallet.tagForLog
1515

16-
open class PrintingBluetoothGattServerCallback() : BluetoothGattServerCallback() {
16+
open class PrintingBluetoothGattServerCallback : BluetoothGattServerCallback() {
1717
override fun onConnectionStateChange(
1818
device: BluetoothDevice?,
1919
status: Int,

wrapper/src/main/java/io/yubicolabs/wwwwallet/bridging/WalletJsBridge.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,12 @@ class WalletJsBridge(
352352
}
353353

354354
private fun JSONArray.toByteArray(): ByteArray =
355-
(0 until length()).mapNotNull { index ->
356-
val value = get(index)
357-
if (value is Int) {
358-
value.toByte()
359-
} else {
360-
null
361-
}
362-
}.toByteArray()
355+
(0 until length())
356+
.mapNotNull { index ->
357+
val value = get(index)
358+
if (value is Int) {
359+
value.toByte()
360+
} else {
361+
null
362+
}
363+
}.toByteArray()

wrapper/src/main/java/io/yubicolabs/wwwwallet/credentials/YubicoContainer.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,16 @@ class YubicoContainer(
383383
}
384384
}
385385

386-
AlertDialog.Builder(activity)
386+
AlertDialog
387+
.Builder(activity)
387388
.setTitle("Select one")
388389
.setItems(items, listener)
389390
.setNegativeButton(android.R.string.cancel) { dialog, which ->
390391
YOLOLogger.i(tagForLog, "No user selected.")
391392
dialog.dismiss()
392393

393394
failure()
394-
}
395-
.show()
395+
}.show()
396396
}
397397
}
398398

@@ -407,15 +407,15 @@ class YubicoContainer(
407407
}
408408

409409
val dialog =
410-
AlertDialog.Builder(activity)
410+
AlertDialog
411+
.Builder(activity)
411412
.setTitle("Pin Required")
412413
.setView(pinEdit)
413414
.setPositiveButton(android.R.string.ok) { dialog, which ->
414415
YOLOLogger.i(tagForLog, "PIN entered.")
415416
dialog.dismiss()
416417
callback(pinEdit.text.toString())
417-
}
418-
.setNegativeButton(android.R.string.cancel) { dialog, which ->
418+
}.setNegativeButton(android.R.string.cancel) { dialog, which ->
419419
YOLOLogger.i(tagForLog, "PIN entry cancelled.")
420420
dialog.dismiss()
421421
callback(null)

wrapper/src/main/java/io/yubicolabs/wwwwallet/credentials/provider/CredentialProviderService.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const val EXTRA_KEY_REQUEST_ID = "KEY_REQUEST_ID"
4545
const val EXTRA_KEY_CREDENTIAL_ID = "KEY_CREDENTIAL_ID"
4646

4747
@RequiresApi(api = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
48-
open class CredentialProviderService() : AndroidCredentialProviderService() {
48+
open class CredentialProviderService : AndroidCredentialProviderService() {
4949
companion object {
5050
private var runningNumberPendingIntentNumber: Int = 1
5151
}
@@ -175,16 +175,17 @@ open class CredentialProviderService() : AndroidCredentialProviderService() {
175175

176176
val icon = Icon.createWithResource(applicationContext, R.mipmap.ic_launcher)
177177

178-
return PublicKeyCredentialEntry.Builder(
179-
context = applicationContext,
180-
username = username,
181-
pendingIntent = pendingIntent,
182-
beginGetPublicKeyCredentialOption = option,
183-
).setIcon(
184-
icon,
185-
).setDisplayName(
186-
displayName,
187-
).build()
178+
return PublicKeyCredentialEntry
179+
.Builder(
180+
context = applicationContext,
181+
username = username,
182+
pendingIntent = pendingIntent,
183+
beginGetPublicKeyCredentialOption = option,
184+
).setIcon(
185+
icon,
186+
).setDisplayName(
187+
displayName,
188+
).build()
188189
}
189190

190191
private fun getAllResponsesToOptions(requestOptions: List<BeginGetPublicKeyCredentialOption>): MutableList<Any?> {

wrapper/src/main/java/io/yubicolabs/wwwwallet/credentials/provider/PasskeyProviderActivity.kt

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ class PasskeyProviderActivity : ComponentActivity() {
100100
GET_CLIENT_DEVICE_REQUEST_CODE -> getRequest()
101101

102102
else -> {
103-
Toast.makeText(
104-
applicationContext,
105-
"Found unexpected request.",
106-
Toast.LENGTH_SHORT,
107-
).show()
103+
Toast
104+
.makeText(
105+
applicationContext,
106+
"Found unexpected request.",
107+
Toast.LENGTH_SHORT,
108+
).show()
108109

109110
YOLOLogger.e(tagForLog, "Could not identify request. Ignored.")
110111
finish()
@@ -149,11 +150,12 @@ class PasskeyProviderActivity : ComponentActivity() {
149150
)
150151
setResult(RESULT_OK, result)
151152

152-
Toast.makeText(
153-
this,
154-
"Passkey for user '${credentialJson.getNested("response.userDisplayName")}' returned 🎉.",
155-
Toast.LENGTH_LONG,
156-
).show()
153+
Toast
154+
.makeText(
155+
this,
156+
"Passkey for user '${credentialJson.getNested("response.userDisplayName")}' returned 🎉.",
157+
Toast.LENGTH_LONG,
158+
).show()
157159

158160
finish()
159161
},
@@ -168,11 +170,12 @@ class PasskeyProviderActivity : ComponentActivity() {
168170
)
169171

170172
lifecycleScope.launch(Dispatchers.Main) {
171-
Toast.makeText(
172-
this@PasskeyProviderActivity,
173-
"Passkey getting failed: '${it.message}'.",
174-
Toast.LENGTH_LONG,
175-
).show()
173+
Toast
174+
.makeText(
175+
this@PasskeyProviderActivity,
176+
"Passkey getting failed: '${it.message}'.",
177+
Toast.LENGTH_LONG,
178+
).show()
176179

177180
setResult(RESULT_OK, result)
178181
finish()
@@ -222,11 +225,12 @@ class PasskeyProviderActivity : ComponentActivity() {
222225
)
223226

224227
lifecycleScope.launch(Dispatchers.Main) {
225-
Toast.makeText(
226-
this@PasskeyProviderActivity,
227-
"Passkey creation failed: '${it.message}'.",
228-
Toast.LENGTH_LONG,
229-
).show()
228+
Toast
229+
.makeText(
230+
this@PasskeyProviderActivity,
231+
"Passkey creation failed: '${it.message}'.",
232+
Toast.LENGTH_LONG,
233+
).show()
230234

231235
setResult(RESULT_OK, result)
232236
finish()

0 commit comments

Comments
 (0)