Skip to content

Commit

Permalink
Drop quotes from CoinbaseWallet return values.. Apply Spotless linter…
Browse files Browse the repository at this point in the history
… to gradle.build (#15)
  • Loading branch information
ruixhuang authored Jan 19, 2024
1 parent f928699 commit 27b2628
Show file tree
Hide file tree
Showing 34 changed files with 327 additions and 273 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/SpotlessCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: SpotlessCheck

on:
pull_request:
paths:
- '**/*.kt'

jobs:
spotlessCheck:
runs-on: macos-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

- name: Lint Kotlin Files
run: |
./gradlew spotlessCheck
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.gradle
.idea
github.properties
build
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package exchange.dydx.carteraexample

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("exchange.dydx.carteraexample", appContext.packageName)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package exchange.dydx.carteraexample

import android.app.Application

class CarteraSampleApplication: Application() {
class CarteraSampleApplication : Application() {
override fun onCreate() {
super.onCreate()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import exchange.dydx.cartera.CarteraConfig


class MainActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -24,7 +23,7 @@ class MainActivity : ComponentActivity() {
CarteraConfig.shared = CarteraConfig(
walletProvidersConfig = WalletProvidersConfigUtil.getWalletProvidersConfig(),
application = applicationContext as Application,
launcher = launcher
launcher = launcher,
)
CarteraConfig.shared?.registerWallets(context = applicationContext)

Expand All @@ -44,5 +43,3 @@ fun MyApp(content: @Composable () -> Unit) {
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ object ModalTransitionDialog {
dismissOnBackPress: Boolean = true,
content: @Composable (ModalTransitionDialogHelper) -> Unit
) {

val onCloseSharedFlow: MutableSharedFlow<Unit> = remember { MutableSharedFlow() }
val coroutineScope: CoroutineScope = rememberCoroutineScope()
val animateContentBackTrigger = remember { mutableStateOf(false) }
val mutex = remember { Mutex(true) }

LaunchedEffect(key1 = Unit) {
launch {
//delay(DIALOG_BUILD_TIME)
// delay(DIALOG_BUILD_TIME)
animateContentBackTrigger.value = true
}
launch {
Expand All @@ -48,7 +47,7 @@ object ModalTransitionDialog {

Dialog(
onDismissRequest = { coroutineScope.launch { startDismissWithExitAnimation(animateContentBackTrigger, onDismissRequest) } },
properties = DialogProperties(usePlatformDefaultWidth = false, dismissOnBackPress = dismissOnBackPress, dismissOnClickOutside = false)
properties = DialogProperties(usePlatformDefaultWidth = false, dismissOnBackPress = dismissOnBackPress, dismissOnClickOutside = false),
) {
LaunchedEffect(key1 = Unit) {
if (mutex.isLocked) mutex.unlock()
Expand Down Expand Up @@ -96,14 +95,13 @@ object ModalTransitionDialog {
visible = visible,
enter = slideInVertically(
animationSpec = tween(ANIMATION_TIME.toInt()),
initialOffsetY = { fullHeight -> fullHeight }
initialOffsetY = { fullHeight -> fullHeight },
),
exit = slideOutVertically(
animationSpec = tween(ANIMATION_TIME.toInt()),
targetOffsetY = { fullHeight -> fullHeight }
targetOffsetY = { fullHeight -> fullHeight },
),
content = content
content = content,
)
}
}

68 changes: 29 additions & 39 deletions app/src/main/java/exchange/dydx/carteraExample/WalletList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ object WalletList {
walletListContent(
viewState = state.value,
coroutineScope = coroutineScope,
bottomSheetState = bottomSheetState
bottomSheetState = bottomSheetState,
)
}

Expand Down Expand Up @@ -143,14 +143,14 @@ object WalletList {
} else {
wallet.openPlayStore(context)
}
}
},
) {
Text(
walletName,
modifier = Modifier
.padding(16.dp)
.weight(1f, false),
textAlign = TextAlign.Start
textAlign = TextAlign.Start,
)

val subText: String =
Expand All @@ -163,7 +163,7 @@ object WalletList {
modifier = Modifier
.padding(14.dp)
.weight(1f, false),
textAlign = TextAlign.End
textAlign = TextAlign.End,
)
}
Divider()
Expand All @@ -182,22 +182,22 @@ object WalletList {
viewState.debugQRCodeAction?.let {
it(WalletList.QrCodeAction.V2, viewState.useTestnet)
}
}
},
) {
Text(
"Debug QR Code",
modifier = Modifier
.padding(16.dp)
.weight(1f, false),
textAlign = TextAlign.Start
textAlign = TextAlign.Start,
)

Text(
"WalletConnectV2",
modifier = Modifier
.padding(14.dp)
.weight(1f, false),
textAlign = TextAlign.End
textAlign = TextAlign.End,
)
}
Divider()
Expand All @@ -207,14 +207,14 @@ object WalletList {
Row(
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.fillMaxWidth()
.fillMaxWidth(),
) {
Text(
"Goerli Testnet:",
modifier = Modifier
.padding(16.dp)
.weight(1f, false),
textAlign = TextAlign.Start
textAlign = TextAlign.Start,
)

Switch(
Expand All @@ -223,8 +223,6 @@ object WalletList {
)
}
}


}
}

Expand All @@ -237,70 +235,64 @@ object WalletList {

Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth()
)
{
modifier = Modifier.fillMaxWidth(),
) {
Text("Select Wallet Action to Test:", style = MaterialTheme.typography.h5)
TextButton(
onClick = {
viewState.walletAction?.invoke(
WalletAction.Connect,
viewState.selectedWallet,
viewState.useTestnet
viewState.useTestnet,
)
},
modifier = buttonModifier
)
{
modifier = buttonModifier,
) {
Text("Connect", style = buttonTextStyle)
}
TextButton(
onClick = {
viewState.walletAction?.invoke(
WalletAction.SignMessage,
viewState.selectedWallet,
viewState.useTestnet
viewState.useTestnet,
)
},
modifier = buttonModifier
)
{
modifier = buttonModifier,
) {
Text("Sign Personal Message", style = buttonTextStyle)
}
TextButton(
onClick = {
viewState.walletAction?.invoke(
WalletAction.SignTypedData,
viewState.selectedWallet,
viewState.useTestnet
viewState.useTestnet,
)
},
modifier = buttonModifier
)
{
modifier = buttonModifier,
) {
Text("Sign TypedData", style = buttonTextStyle)
}
TextButton(
onClick = {
viewState.walletAction?.invoke(
WalletAction.SignTransaction,
viewState.selectedWallet,
viewState.useTestnet
viewState.useTestnet,
)
},
modifier = buttonModifier
)
{
modifier = buttonModifier,
) {
Text("Send Transaction", style = buttonTextStyle)
}
Spacer(modifier = Modifier.height(20.dp))
TextButton(
onClick = {
viewState.showBottomSheet = false
},
modifier = buttonModifier
)
{
},
modifier = buttonModifier,
) {
Text("Cancel", style = buttonTextStyle)
}
}
Expand All @@ -315,9 +307,8 @@ object WalletList {
Column(
modifier = Modifier
.fillMaxSize()
.background(Color.White)
.background(Color.White),
) {

Spacer(modifier = Modifier.size(32.dp))

uri?.let {
Expand All @@ -333,7 +324,7 @@ object WalletList {
modifier = Modifier
.padding(16.dp)
.fillMaxWidth()
.fillMaxHeight(0.6f)
.fillMaxHeight(0.6f),
)

Text(it, modifier = Modifier.padding(16.dp))
Expand All @@ -346,7 +337,7 @@ object WalletList {
.fillMaxWidth()
.align(Alignment.Center),
colors = ButtonDefaults.buttonColors(containerColor = colorResource(id = R.color.black)),
onClick = modalTransitionDialogHelper::triggerAnimatedClose
onClick = modalTransitionDialogHelper::triggerAnimatedClose,
) {
Text(text = "Close it", color = Color.White)
}
Expand All @@ -355,4 +346,3 @@ object WalletList {
}
}
}

Loading

0 comments on commit 27b2628

Please sign in to comment.