Skip to content

Commit a7db4a1

Browse files
committed
Merge branch 'develop'
2 parents 0043b01 + 4c71bb4 commit a7db4a1

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

api/src/main/java/com/getcode/solana/organizer/Organizer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ class Organizer(
5959

6060
fun getAccountInfo() = accountInfos
6161

62-
val buckets: List<AccountInfo> = accountInfos.values.toList().sortedBy { it.accountType.sortOrder() }
62+
val buckets: List<AccountInfo>
63+
get() = accountInfos.values.toList().sortedBy { it.accountType.sortOrder() }
6364

6465
fun propagateBalances() {
6566
val balances = mutableMapOf<AccountType, Kin>()

app/src/main/java/com/getcode/notifications/CodePushMessagingService.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CodePushMessagingService : FirebaseMessagingService(),
5151

5252
if (notification != null) {
5353
val (type, titleKey, messageContent) = notification
54-
val title = titleKey.localizedStringByKey(resources)
54+
val title = titleKey.localizedStringByKey(resources) ?: titleKey
5555
val body = messageContent.localizedText(resources, currencyUtils)
5656
notify(type, title, body)
5757
} else {
@@ -134,12 +134,12 @@ private fun NotificationManager.getActiveNotification(notificationId: Int): Noti
134134
}
135135
return null
136136
}
137-
private fun String.localizedStringByKey(resources: ResourceHelper): String {
137+
private fun String.localizedStringByKey(resources: ResourceHelper): String? {
138138
val name = this.replace(".", "_")
139139
val resId = resources.getIdentifier(
140140
name,
141141
ResourceType.String,
142142
).let { if (it == 0) null else it }
143143

144-
return resId?.let { resources.getString(it) }.orEmpty()
144+
return resId?.let { resources.getString(it) }
145145
}

app/src/main/java/com/getcode/ui/components/chat/utils/LocalizedText.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,24 @@ import com.getcode.util.formatted
1717
import com.getcode.util.resources.ResourceHelper
1818
import com.getcode.util.resources.ResourceType
1919
import com.getcode.utils.FormatUtils
20+
import timber.log.Timber
2021
import java.util.Locale
2122

2223
internal fun MessageContent.localizedText(resources: ResourceHelper, currencyUtils: CurrencyUtils,): String {
2324
return when (val content = this) {
2425
is MessageContent.Exchange -> {
2526
val amount = when (val kinAmount = content.amount) {
2627
is GenericAmount.Exact -> {
28+
Timber.d("exact")
2729
val currency = currencyUtils.getCurrency(kinAmount.currencyCode.name)
2830
kinAmount.amount.formatted(resources = resources, currency = currency ?: Currency.Kin)
2931
}
3032

3133
is GenericAmount.Partial -> {
32-
FormatUtils.formatCurrency(kinAmount.fiat.amount, Locale.getDefault())
34+
Timber.d("partial")
35+
FormatUtils.formatCurrency(kinAmount.fiat.amount, Locale.getDefault()).let {
36+
"$it ${resources.getString(R.string.core_ofKin)}"
37+
}
3338
}
3439
}
3540

@@ -69,6 +74,7 @@ internal fun MessageContent.localizedText(resources: ResourceHelper, currencyUti
6974

7075
internal val MessageContent.localizedText: String
7176
@Composable get() {
77+
val context = LocalContext.current
7278
return when (val content = this) {
7379
is MessageContent.Exchange -> {
7480
val amount = when (val kinAmount = content.amount) {
@@ -79,7 +85,9 @@ internal val MessageContent.localizedText: String
7985
}
8086

8187
is GenericAmount.Partial -> {
82-
FormatUtils.formatCurrency(kinAmount.fiat.amount, Locale.getDefault())
88+
FormatUtils.formatCurrency(kinAmount.fiat.amount, Locale.getDefault()).let {
89+
"$it ${context.getString(R.string.core_ofKin)}"
90+
}
8391
}
8492
}
8593

0 commit comments

Comments
 (0)