diff --git a/app/build.gradle b/app/build.gradle index c98ce8e..23e0fdf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { applicationId "xyz.tomashrib.zephyruswallet" minSdk 26 targetSdk 32 - versionCode 61 - versionName "0.6.1" + versionCode 71 + versionName "0.7.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/java/xyz/tomashrib/zephyruswallet/ui/wallet/HomeScreen.kt b/app/src/main/java/xyz/tomashrib/zephyruswallet/ui/wallet/HomeScreen.kt index 68bbecc..0917e59 100644 --- a/app/src/main/java/xyz/tomashrib/zephyruswallet/ui/wallet/HomeScreen.kt +++ b/app/src/main/java/xyz/tomashrib/zephyruswallet/ui/wallet/HomeScreen.kt @@ -211,6 +211,7 @@ internal fun HomeScreen( } } + // tx history container Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center, @@ -224,7 +225,8 @@ internal fun HomeScreen( bottom.linkTo(buttonsBar.top) } ){ - //this should display transaction history + + //this displays all transactions from history allTransactions?.let { TransactionHistoryList(transactions = it) } } @@ -357,16 +359,14 @@ fun isOnline(context: Context): Boolean { @Composable fun TransactionHistoryList(transactions: List){ - val unconfirmedTransactions = transactions.filter{ - it.confirmationTime == null - } - val confirmedTransasctions = transactions.filter{ - it.confirmationTime != null - } - val sortedTxList = transactions.sortedWith(compareByDescending(nullsLast(), { it.confirmationTime?.height })) + // sorts transactions by confirmation time, if unconfirmed it goes to the top + val sortedTxList = transactions.sortedWith(compareByDescending(nullsLast()) { it.confirmationTime?.height }) + // for scrollable tx history val scrollState = rememberScrollState() + + // container for all txs Column( verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally, @@ -376,7 +376,11 @@ fun TransactionHistoryList(transactions: List){ .padding(vertical = 10.dp, horizontal = 10.dp) .verticalScroll(scrollState) ) { + + // for every transaction in list for(item in sortedTxList){ + + //if unconfirmed if (item.confirmationTime == null){ TransactionHistoryTile( isPayment = (checkIsPayment(item.received.toString(), item.sent.toString())), @@ -385,8 +389,9 @@ fun TransactionHistoryList(transactions: List){ sent = item.sent.toString(), timestamp = "pending", ) + // space between Spacer(Modifier.padding(vertical = 10.dp)) - } else{ + } else{ // if confirmed TransactionHistoryTile( isPayment = (checkIsPayment(item.received.toString(), item.sent.toString())), isConfirmed = (checkIsConfirmed(item.confirmationTime.toString())), @@ -394,6 +399,7 @@ fun TransactionHistoryList(transactions: List){ sent = item.sent.toString(), timestamp = item.confirmationTime!!.timestamp.timestampToString() ) + // space between Spacer(Modifier.padding(vertical = 10.dp)) } }