Skip to content

Commit 3c0b3c4

Browse files
committed
chore: make code runtime happy again
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 4bc702a commit 3c0b3c4

File tree

8 files changed

+38
-14
lines changed

8 files changed

+38
-14
lines changed

app/src/main/java/com/getcode/view/main/account/withdraw/AccountWithdrawAddressViewModel.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package com.getcode.view.main.account.withdraw
33
import android.annotation.SuppressLint
44
import android.content.ClipboardManager
55
import androidx.compose.foundation.ExperimentalFoundationApi
6-
import androidx.compose.foundation.text2.input.TextFieldState
7-
import androidx.compose.foundation.text2.input.setTextAndPlaceCursorAtEnd
8-
import androidx.compose.foundation.text2.input.textAsFlow
6+
import androidx.compose.foundation.text.input.TextFieldState
7+
import androidx.compose.foundation.text.input.setTextAndPlaceCursorAtEnd
8+
import androidx.compose.runtime.snapshotFlow
99
import androidx.lifecycle.viewModelScope
1010
import com.getcode.navigation.core.CodeNavigator
1111
import com.getcode.navigation.screens.WithdrawalArgs
@@ -44,7 +44,6 @@ data class AccountWithdrawAddressUiModel(
4444
)
4545

4646
@HiltViewModel
47-
@OptIn(ExperimentalFoundationApi::class)
4847
class AccountWithdrawAddressViewModel @Inject constructor(
4948
private val client: Client,
5049
private val clipboard: ClipboardManager,
@@ -55,7 +54,7 @@ class AccountWithdrawAddressViewModel @Inject constructor(
5554

5655
init {
5756
uiFlow.map { it.addressText }
58-
.flatMapLatest { it.textAsFlow() }
57+
.flatMapLatest { snapshotFlow { it.text } }
5958
.map { it.toString() }
6059
.debounce(300.milliseconds)
6160
.onEach { updated -> setAddress(updated) }

libs/encryption/keys/src/main/kotlin/com/getcode/solana/keys/Key.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ open class Key32(bytes: List<Byte>) : KeyType(bytes) {
6868
return result
6969
}
7070
}
71+
7172
open class Key64(bytes: List<Byte>) : KeyType(bytes) {
7273

7374
constructor(base58: String): this (Base58.decode(base58).toList())

libs/models/src/main/kotlin/com/getcode/model/Fiat.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ data class Fiat(
2121
}
2222
}
2323

24+
@Serializable
2425
sealed interface GenericAmount {
2526

2627
val currencyCode: CurrencyCode
28+
29+
@Serializable
2730
data class Exact(val amount: KinAmount): GenericAmount {
2831
override val currencyCode: CurrencyCode = amount.rate.currency
2932
}
33+
34+
@Serializable
3035
data class Partial(val fiat: Fiat): GenericAmount {
3136
override val currencyCode: CurrencyCode = fiat.currency
3237
}
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
package com.getcode.model.chat
22

33
import com.getcode.model.ID
4+
import kotlinx.serialization.Serializable
5+
import kotlinx.serialization.Transient
46

57
/**
68
* An ID that can be referenced to the source of the exchange of Kin
79
*/
10+
@Serializable
811
sealed interface Reference {
12+
@Serializable
913
data object NoneSet: Reference
14+
@Serializable
1015
data class IntentId(val id: ID): Reference
11-
data class Signature(val signature: com.getcode.solana.keys.Signature): Reference
16+
@Serializable
17+
data class Signature(val bytes: List<Byte>): Reference {
18+
@Transient
19+
val signature = com.getcode.solana.keys.Signature(bytes)
20+
}
1221

1322
companion object
1423
}

libs/models/src/main/kotlin/com/getcode/model/chat/Verb.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,67 @@
11
package com.getcode.model.chat
22

3-
import com.codeinc.gen.chat.v1.ChatService as ChatServiceV1
4-
import com.codeinc.gen.chat.v2.ChatService
3+
import kotlinx.serialization.Serializable
54

5+
@Serializable
66
sealed interface Verb {
77
val increasesBalance: Boolean
88

9+
@Serializable
910
data object Unknown : Verb {
1011
override val increasesBalance: Boolean = false
1112
}
1213

14+
@Serializable
1315
data object Gave : Verb {
1416
override val increasesBalance: Boolean = false
1517
}
1618

19+
@Serializable
1720
data object Received : Verb {
1821
override val increasesBalance: Boolean = true
1922
}
2023

24+
@Serializable
2125
data object Withdrew : Verb {
2226
override val increasesBalance: Boolean = false
2327
}
2428

29+
@Serializable
2530
data object Deposited : Verb {
2631
override val increasesBalance: Boolean = true
2732
}
2833

34+
@Serializable
2935
data object Sent : Verb {
3036
override val increasesBalance: Boolean = false
3137
}
3238

39+
@Serializable
3340
data object Returned : Verb {
3441
override val increasesBalance: Boolean = true
3542
}
3643

44+
@Serializable
3745
data object Spent : Verb {
3846
override val increasesBalance: Boolean = false
3947
}
4048

49+
@Serializable
4150
data object Paid : Verb {
4251
override val increasesBalance: Boolean = false
4352
}
4453

54+
@Serializable
4555
data object Purchased : Verb {
4656
override val increasesBalance: Boolean = true
4757
}
4858

59+
@Serializable
4960
data object ReceivedTip : Verb {
5061
override val increasesBalance: Boolean = true
5162
}
5263

64+
@Serializable
5365
data object SentTip : Verb {
5466
override val increasesBalance: Boolean = false
5567
}

services/code/src/main/java/com/getcode/model/protomapping/MessageContent.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ operator fun MessageContent.Companion.invoke(
4444
amount = GenericAmount.Exact(kinAmount),
4545
verb = verb,
4646
reference = messageId?.let { Reference.IntentId(it) },
47-
hasInteracted = false,
4847
)
4948
}
5049

@@ -63,7 +62,6 @@ operator fun MessageContent.Companion.invoke(
6362
amount = GenericAmount.Partial(fiat),
6463
verb = verb,
6564
reference = messageId?.let { Reference.IntentId(it) },
66-
hasInteracted = false
6765
)
6866
}
6967

services/code/src/main/java/com/getcode/model/protomapping/Reference.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import com.getcode.model.chat.Reference.Signature
99

1010
operator fun Reference.Companion.invoke(proto: ExchangeDataContent): Reference {
1111
return when (proto.referenceCase) {
12-
ReferenceCase.INTENT -> IntentId(proto.intent.toByteArray().toList())
13-
ReferenceCase.SIGNATURE -> Signature(com.getcode.solana.keys.Signature(proto.signature.toByteArray().toList()))
12+
ReferenceCase.INTENT -> IntentId(proto.intent.value.toByteArray().toList())
13+
ReferenceCase.SIGNATURE -> Signature(proto.signature.value.toByteArray().toList())
1414
ReferenceCase.REFERENCE_NOT_SET -> NoneSet
1515
null -> NoneSet
1616
}

services/flipchat/payments/src/main/kotlin/com/getcode/model/protomapping/Reference.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import com.getcode.model.chat.Reference.Signature
99

1010
operator fun Reference.Companion.invoke(proto: ExchangeDataContent): Reference {
1111
return when (proto.referenceCase) {
12-
ReferenceCase.INTENT -> IntentId(proto.intent.toByteArray().toList())
13-
ReferenceCase.SIGNATURE -> Signature(com.getcode.solana.keys.Signature(proto.signature.toByteArray().toList()))
12+
ReferenceCase.INTENT -> IntentId(proto.intent.value.toByteArray().toList())
13+
ReferenceCase.SIGNATURE -> Signature(proto.signature.value.toByteArray().toList())
1414
ReferenceCase.REFERENCE_NOT_SET -> NoneSet
1515
null -> NoneSet
1616
}

0 commit comments

Comments
 (0)