Skip to content

Commit 2ff6195

Browse files
feat(dashpay): add historical metadata backend (#1408)
* fix: use Flow instead of LiveData when observing Work * fix: updates for components * remove duplicate setupRadioGroup method * feat: add exists method * feat: enable transaction metadata saving on prod flavor * feat: build out saving historical data * fix: improve logging * fix: enable reset wallet * fix: make TransactionMetadataDocument a data class * fix: improve some functions for metadata * fix: improve publish transaction metadata worker * fix: improve publish transaction metadata functions * fix: update should save methods in DashPayConfig * fix: use dpp 2.0.0-TX-SNAPSHOT * fix: update save status and progress * fix: last fixes for QA found issues * fix: coderabbit issues * fix: compile issues * fix: remove commented code * fix: remove unneeded argument * fix: remove unneeded nav graphs * fix: remove unneeded nav graphs
1 parent 8abaedc commit 2ff6195

33 files changed

+672
-516
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
coroutinesVersion = '1.6.4'
55
ok_http_version = '4.9.1'
66
dashjVersion = '21.1.8'
7-
dppVersion = "1.7.6-SNAPSHOT"
7+
dppVersion = "2.0.0-TX-SNAPSHOT"
88
hiltVersion = '2.53'
99
hiltCompilerVersion = '1.2.0'
1010
hiltWorkVersion = '1.2.0'
@@ -76,5 +76,6 @@ allprojects {
7676
mavenCentral()
7777
maven { url 'https://jitpack.io' }
7878
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
79+
maven { url 'https://central.sonatype.com/repository/maven-snapshots/' }
7980
}
8081
}

common/src/main/java/org/dash/wallet/common/services/TransactionMetadataProvider.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ interface TransactionMetadataProvider {
118118
markAddressAsync(address, false, TaxCategory.TransferIn, service)
119119
}
120120

121+
/**
122+
* check if the tx metadata table has metadata for the given tx.
123+
*/
124+
suspend fun exists(txId: Sha256Hash): Boolean
125+
121126
// Reset methods
122127
suspend fun clear()
123128
}

common/src/main/java/org/dash/wallet/common/ui/components/DashButton.kt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import androidx.compose.foundation.border
66
import androidx.compose.foundation.layout.Arrangement
77
import androidx.compose.foundation.layout.Column
88
import androidx.compose.foundation.layout.PaddingValues
9-
import androidx.compose.foundation.layout.Row
109
import androidx.compose.foundation.layout.Spacer
11-
import androidx.compose.foundation.layout.defaultMinSize
1210
import androidx.compose.foundation.layout.fillMaxWidth
1311
import androidx.compose.foundation.layout.height
1412
import androidx.compose.foundation.layout.padding
@@ -55,26 +53,27 @@ fun DashButton(
5553
style == Style.Filled -> DashBlue
5654
style == Style.FilledBlue -> DashBlue
5755
style == Style.FilledRed -> MyTheme.Colors.red
58-
style == Style.TintedBlue -> Color(0x0D008DE4)
56+
style == Style.TintedBlue -> MyTheme.Colors.dashBlue5
5957
style == Style.TintedGray -> Color(0x1AB0B6BC)
6058
style == Style.TintedRed -> MyTheme.Colors.red5
61-
style == Style.FilledWhiteBlue -> Color(0xFFFFFFFF)
59+
style == Style.FilledWhiteBlue -> MyTheme.Colors.backgroundPrimary
6260
style == Style.TintedWhite -> Color(0x1AFFFFFF)
61+
style == Style.PlainRed -> MyTheme.Colors.red5
6362
else -> Color.Transparent
6463
}
6564

6665
val contentColor = when {
67-
!isEnabled -> Color(0xFF191C1F).copy(alpha = 0.40f)
66+
!isEnabled -> MyTheme.Colors.textPrimary.copy(alpha = 0.40f)
6867
style == Style.Filled -> Color.White
6968
style == Style.FilledBlue -> Color.White
7069
style == Style.FilledRed -> Color.White
7170
style == Style.TintedBlue -> DashBlue
7271
style == Style.PlainBlue -> DashBlue
73-
style == Style.PlainBlack -> Color(0xFF191C1F)
74-
style == Style.PlainRed -> Color(0xFFEA3943)
75-
style == Style.TintedRed -> Color(0xFFEA3943)
76-
style == Style.TintedGray -> Color(0xFF191C1F)
77-
style == Style.StrokeGray -> Color(0xFF191C1F)
72+
style == Style.PlainBlack -> MyTheme.Colors.textPrimary
73+
style == Style.PlainRed -> MyTheme.Colors.red
74+
style == Style.TintedRed -> MyTheme.Colors.red
75+
style == Style.TintedGray -> MyTheme.Colors.textPrimary
76+
style == Style.StrokeGray -> MyTheme.Colors.textPrimary
7877
style == Style.FilledWhiteBlue -> DashBlue
7978
style == Style.TintedWhite -> Color.White
8079

@@ -125,7 +124,6 @@ fun DashButton(
125124
strokeWidth = 2.dp,
126125
modifier = Modifier
127126
.size(size.iconSize)
128-
.padding(vertical = 2.dp)
129127
)
130128
Spacer(modifier = Modifier.width(size.paddingHorizontal))
131129
}
@@ -134,7 +132,7 @@ fun DashButton(
134132
text,
135133
fontSize = size.fontSize,
136134
lineHeight = size.lineSize,
137-
fontFamily = MyTheme.InterFont,
135+
fontFamily = MyTheme.interRegular,
138136
fontWeight = FontWeight.SemiBold,
139137
color = contentColor,
140138
overflow = TextOverflow.Ellipsis,
@@ -155,7 +153,7 @@ fun DashButton(
155153
}
156154

157155
enum class Style {
158-
Plain,
156+
Plain,
159157
Outlined,
160158
Filled,
161159
FilledBlue,

common/src/main/java/org/dash/wallet/common/ui/components/DashCheckBox.kt

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ import androidx.compose.ui.Modifier
1414
import androidx.compose.ui.draw.clip
1515
import androidx.compose.ui.graphics.Color
1616
import androidx.compose.ui.res.painterResource
17-
import androidx.compose.ui.text.font.FontWeight
1817
import androidx.compose.ui.text.style.TextAlign
1918
import androidx.compose.ui.tooling.preview.Preview
2019
import androidx.compose.ui.unit.dp
21-
import androidx.compose.ui.unit.sp
2220
import org.dash.wallet.common.R
2321

2422
@Composable
@@ -40,7 +38,8 @@ fun DashCheckbox(
4038
Row(
4139
modifier = modifier
4240
.fillMaxWidth()
43-
.clip(RoundedCornerShape(8.dp))
41+
.defaultMinSize(minHeight = 50.dp)
42+
//.clip(RoundedCornerShape(8.dp))
4443
.background(Color.White)
4544
.padding(horizontal = 10.dp, vertical = 8.dp)
4645
.clickable(
@@ -107,7 +106,8 @@ fun DashCheckbox(
107106
// Trailing text content
108107
if (trailingText != null || trailingHelpText != null) {
109108
Column(
110-
verticalArrangement = Arrangement.Center
109+
verticalArrangement = Arrangement.Center,
110+
horizontalAlignment = Alignment.End
111111
) {
112112
trailingText?.let {
113113
Text(
@@ -168,9 +168,20 @@ fun CheckboxSample() {
168168
Column(
169169
modifier = Modifier
170170
.fillMaxWidth()
171+
.background(Color.White)
171172
.padding(16.dp),
172173
verticalArrangement = Arrangement.spacedBy(16.dp)
173174
) {
175+
176+
DashCheckbox(
177+
checked = isChecked4,
178+
onCheckedChange = { isChecked4 = it },
179+
leadingIcon = R.drawable.ic_preview,
180+
title = "text",
181+
subtitle = "help text",
182+
trailingText = "text",
183+
trailingHelpText = "help text"
184+
)
174185
// Example 1: Simple checkbox with leading text
175186
DashCheckbox(
176187
checked = true,
@@ -200,7 +211,7 @@ fun CheckboxSample() {
200211

201212
// Example 1: Simple checkbox with leading text
202213
DashCheckbox(
203-
checked = isChecked,
214+
checked = isChecked2,
204215
onCheckedChange = { isChecked2 = it },
205216
title = "Accept terms and conditions (Disabled)",
206217
subtitle = "Required for account creation (1 line)",
@@ -210,20 +221,13 @@ fun CheckboxSample() {
210221

211222
// Example 1: Simple checkbox with long leading text
212223
DashCheckbox(
213-
checked = isChecked,
224+
checked = isChecked3,
214225
onCheckedChange = { isChecked3 = it },
215226
title = "Accept terms and conditions",
216227
subtitle = "Required for account creation and large downloads of information (two lines)."
217228
)
218229

219230
// Example 2: Checkbox with both leading and trailing content
220-
DashCheckbox(
221-
checked = isChecked,
222-
onCheckedChange = { isChecked4 = it },
223-
title = "Promotional emails",
224-
subtitle = "Receive updates and offers",
225-
trailingText = "Optional",
226-
trailingHelpText = "You can change this later"
227-
)
231+
228232
}
229233
}

0 commit comments

Comments
 (0)