Skip to content

Commit 4391cb0

Browse files
authored
Merge pull request #139 from synonymdev/feat/activity-explore
feat: Activity explore
2 parents 49b7b61 + bea7164 commit 4391cb0

File tree

21 files changed

+679
-80
lines changed

21 files changed

+679
-80
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package to.bitkit.ext
2+
3+
import uniffi.bitkitcore.Activity
4+
5+
val Activity.idValue: String
6+
get() = when (this) {
7+
is Activity.Lightning -> v1.id
8+
is Activity.Onchain -> v1.txId
9+
}

app/src/main/java/to/bitkit/repositories/WalletRepo.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import to.bitkit.data.entities.InvoiceTagEntity
2121
import to.bitkit.data.keychain.Keychain
2222
import to.bitkit.di.BgDispatcher
2323
import to.bitkit.env.Env
24+
import to.bitkit.ext.idValue
2425
import to.bitkit.ext.toHex
2526
import to.bitkit.models.BalanceState
2627
import to.bitkit.models.NodeLifecycleState
@@ -529,12 +530,6 @@ class WalletRepo @Inject constructor(
529530
is Activity.Onchain -> paymentHashOrTxId == v1.txId
530531
}
531532

532-
private val Activity.idValue: String
533-
get() = when (this) {
534-
is Activity.Lightning -> v1.id
535-
is Activity.Onchain -> v1.txId
536-
}
537-
538533
private suspend fun Scanner.OnChain.extractLightningHashOrAddress(): String {
539534
val address = this.invoice.address
540535
val lightningInvoice: String = this.invoice.params?.get("lightning") ?: address

app/src/main/java/to/bitkit/ui/ContentView.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import to.bitkit.ui.screens.transfer.external.ExternalFeeCustomScreen
5959
import to.bitkit.ui.screens.transfer.external.ExternalSuccessScreen
6060
import to.bitkit.ui.screens.wallets.HomeScreen
6161
import to.bitkit.ui.screens.wallets.activity.ActivityItemScreen
62+
import to.bitkit.ui.screens.wallets.activity.ActivityExploreScreen
6263
import to.bitkit.ui.settings.BackupSettingsScreen
6364
import to.bitkit.ui.settings.BlocktankRegtestScreen
6465
import to.bitkit.ui.settings.BlocktankRegtestViewModel
@@ -642,7 +643,17 @@ private fun NavGraphBuilder.activityItem(
642643
ActivityItemScreen(
643644
viewModel = activityListViewModel,
644645
activityItem = navBackEntry.toRoute(),
646+
onExploreClick = { id -> navController.navigateToActivityExplore(id) },
645647
onBackClick = { navController.popBackStack() },
648+
onCloseClick = { navController.navigateToHome() },
649+
)
650+
}
651+
composableWithDefaultTransitions<Routes.ActivityExplore> { navBackEntry ->
652+
ActivityExploreScreen(
653+
viewModel = activityListViewModel,
654+
route = navBackEntry.toRoute(),
655+
onBackClick = { navController.popBackStack() },
656+
onCloseClick = { navController.navigateToHome() },
646657
)
647658
}
648659
}
@@ -819,6 +830,10 @@ fun NavController.navigateToActivityItem(id: String) = navigate(
819830
route = Routes.ActivityItem(id),
820831
)
821832

833+
fun NavController.navigateToActivityExplore(id: String) = navigate(
834+
route = Routes.ActivityExplore(id),
835+
)
836+
822837
fun NavController.navigateToQrScanner() = navigate(
823838
route = Routes.QrScanner,
824839
)
@@ -990,6 +1005,9 @@ object Routes {
9901005
@Serializable
9911006
data class ActivityItem(val id: String)
9921007

1008+
@Serializable
1009+
data class ActivityExplore(val id: String)
1010+
9931011
@Serializable
9941012
data object QrScanner
9951013
}

app/src/main/java/to/bitkit/ui/components/Text.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import androidx.compose.ui.text.AnnotatedString
99
import androidx.compose.ui.text.TextStyle
1010
import androidx.compose.ui.text.font.FontWeight
1111
import androidx.compose.ui.text.style.TextAlign
12+
import androidx.compose.ui.text.style.TextOverflow
1213
import androidx.compose.ui.text.toUpperCase
1314
import androidx.compose.ui.unit.TextUnit
1415
import androidx.compose.ui.unit.sp
@@ -240,11 +241,16 @@ fun BodySSB(
240241
text: String,
241242
modifier: Modifier = Modifier,
242243
color: Color = MaterialTheme.colorScheme.primary,
244+
maxLines: Int = Int.MAX_VALUE,
245+
overflow: TextOverflow = TextOverflow.Clip,
246+
243247
) {
244248
BodySSB(
245249
text = AnnotatedString(text),
246250
color = color,
247251
modifier = modifier,
252+
maxLines = maxLines,
253+
overflow = overflow,
248254
)
249255
}
250256

@@ -253,6 +259,8 @@ fun BodySSB(
253259
text: AnnotatedString,
254260
modifier: Modifier = Modifier,
255261
color: Color = MaterialTheme.colorScheme.primary,
262+
maxLines: Int = Int.MAX_VALUE,
263+
overflow: TextOverflow = TextOverflow.Clip,
256264
) {
257265
Text(
258266
text = text,
@@ -266,6 +274,8 @@ fun BodySSB(
266274
textAlign = TextAlign.Start,
267275
),
268276
modifier = modifier,
277+
maxLines = maxLines,
278+
overflow = overflow,
269279
)
270280
}
271281

app/src/main/java/to/bitkit/ui/screens/DevSettingsScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fun DevSettingsScreen(
5757
NodeDetails(uiState)
5858
InfoField(
5959
value = uiState.onchainAddress,
60-
label = stringResource(R.string.address),
60+
label = stringResource(R.string.wallet__activity_address),
6161
maxLength = 36,
6262
trailingIcon = {
6363
Row {

app/src/main/java/to/bitkit/ui/screens/wallets/HomeScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import to.bitkit.ui.navigateToTransferSavingsIntro
5959
import to.bitkit.ui.navigateToTransferSpendingAmount
6060
import to.bitkit.ui.navigateToTransferSpendingIntro
6161
import to.bitkit.ui.scaffold.AppScaffold
62-
import to.bitkit.ui.screens.wallets.activity.ActivityList
62+
import to.bitkit.ui.screens.wallets.activity.HomeActivityList
6363
import to.bitkit.ui.screens.wallets.activity.AllActivityScreen
6464
import to.bitkit.ui.screens.wallets.activity.DateRangeSelectorSheet
6565
import to.bitkit.ui.screens.wallets.activity.TagSelectorSheet
@@ -266,7 +266,7 @@ private fun HomeContentView(
266266
Spacer(modifier = Modifier.height(16.dp))
267267
val activity = activityListViewModel ?: return@Column
268268
val latestActivities by activity.latestActivities.collectAsStateWithLifecycle()
269-
ActivityList(
269+
HomeActivityList(
270270
items = latestActivities,
271271
onAllActivityClick = { walletNavController.navigate(HomeRoutes.AllActivity) },
272272
onActivityItemClick = { rootNavController.navigateToActivityItem(it) },

0 commit comments

Comments
 (0)