Skip to content

Commit 96c3ec9

Browse files
committed
Merge branch 'develop'
2 parents d9a4c79 + b546bd6 commit 96c3ec9

File tree

23 files changed

+66
-44
lines changed

23 files changed

+66
-44
lines changed

api/build.gradle.kts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.jetbrains.kotlin.cli.common.toBooleanLenient
12
import java.util.Properties
23

34
plugins {
@@ -8,21 +9,32 @@ plugins {
89
}
910

1011
android {
11-
namespace = "com.getcode.api"
12+
namespace = "${Android.namespace}.api"
1213
compileSdk = Android.compileSdkVersion
1314
defaultConfig {
1415
minSdk = Android.minSdkVersion
1516
targetSdk = Android.targetSdkVersion
1617
buildToolsVersion = Android.buildToolsVersion
1718
testInstrumentationRunner = Android.testInstrumentationRunner
1819

20+
buildConfigField("Boolean", "NOTIFY_ERRORS", "false")
21+
1922
javaCompileOptions {
2023
annotationProcessorOptions {
2124
arguments += mapOf("room.schemaLocation" to "$projectDir/schemas")
2225
}
2326
}
2427
}
2528

29+
buildTypes {
30+
getByName("release") {
31+
buildConfigField("Boolean", "NOTIFY_ERRORS", "true")
32+
}
33+
getByName("debug") {
34+
buildConfigField("Boolean", "NOTIFY_ERRORS", (System.getenv("NOTIFY_ERRORS").toBooleanLenient() ?: false).toString())
35+
}
36+
}
37+
2638
java {
2739
toolchain {
2840
languageVersion.set(JavaLanguageVersion.of(17))

api/src/main/java/com/getcode/network/repository/MessagingRepository.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ class MessagingRepository @Inject constructor(
285285
}: result: ${it.result}"
286286
)
287287
}.onFailure {
288+
ErrorUtils.handleError(it)
288289
Timber.e(t = it, message = "Failed to send rendezvous message.")
289290
}
290291
}

api/src/main/java/com/getcode/network/repository/PaymentRepository.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.getcode.network.client.establishRelationship
1414
import com.getcode.network.client.fetchLimits
1515
import com.getcode.network.client.transferWithResult
1616
import com.getcode.network.exchange.Exchange
17+
import com.getcode.utils.ErrorUtils
1718
import dagger.hilt.android.qualifiers.ApplicationContext
1819
import io.reactivex.rxjava3.core.Completable
1920
import kotlinx.coroutines.CoroutineScope
@@ -48,7 +49,7 @@ class PaymentRepository @Inject constructor(
4849

4950
codeScanned(payload.rendezvous)
5051
return payload to loginAttempt
51-
}.getOrNull()
52+
}.onFailure { ErrorUtils.handleError(it) }.getOrNull()
5253
}
5354

5455
suspend fun rejectLogin(rendezvousKey: KeyPair) {
@@ -174,6 +175,7 @@ class PaymentRepository @Inject constructor(
174175
amount = paymentAmount,
175176
successful = false
176177
)
178+
ErrorUtils.handleError(error)
177179
cont.resumeWithException(error)
178180
}
179181
}

api/src/main/java/com/getcode/utils/ErrorUtils.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ object ErrorUtils {
3939
}
4040

4141
if (
42-
!BuildConfig.DEBUG &&
42+
BuildConfig.NOTIFY_ERRORS &&
4343
throwable !is UnknownHostException &&
4444
throwable !is TimeoutException &&
4545
throwable !is ConnectException
@@ -49,16 +49,18 @@ object ErrorUtils {
4949
}
5050
}
5151

52-
fun isNetworkError(throwable: Throwable): Boolean =
52+
private fun isNetworkError(throwable: Throwable): Boolean =
5353
throwable is TimeoutException ||
5454
throwable.cause is TimeoutException ||
5555
throwable is UnknownHostException ||
5656
throwable.cause is UnknownHostException
5757

58-
fun isRuntimeError(throwable: Throwable): Boolean =
58+
private fun isRuntimeError(throwable: Throwable): Boolean =
5959
throwable is StatusRuntimeException ||
6060
throwable.cause is StatusRuntimeException
6161

62-
fun isSuppressibleError(throwable: Throwable): Boolean =
63-
throwable is SQLException || throwable is net.sqlcipher.SQLException
64-
}
62+
private fun isSuppressibleError(throwable: Throwable): Boolean =
63+
throwable is SQLException || throwable is net.sqlcipher.SQLException || throwable is SuppressibleException
64+
}
65+
66+
data class SuppressibleException(override val message: String): Throwable(message)

app/build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ plugins {
1818
val contributorsSigningConfig = ContributorsSignatory(rootProject)
1919

2020
android {
21-
namespace = "com.getcode"
21+
namespace = Android.namespace
2222
compileSdk = Android.compileSdkVersion
2323

2424
defaultConfig {
25-
applicationId = "com.getcode"
25+
applicationId = Android.namespace
2626
versionCode = 304
2727
versionName = "1.1.$versionCode"
2828

@@ -35,6 +35,7 @@ android {
3535
val properties = Properties()
3636
properties.load(propertiesFile.inputStream())
3737
buildConfigField("String", "MIXPANEL_API_KEY", "\"${properties.getProperty("MIXPANEL_API_KEY")}\"")
38+
buildConfigField("Boolean", "NOTIFY_ERRORS", "false")
3839
}
3940

4041
signingConfigs {
@@ -80,7 +81,7 @@ android {
8081

8182
java {
8283
toolchain {
83-
languageVersion.set(JavaLanguageVersion.of(17))
84+
languageVersion.set(JavaLanguageVersion.of(Versions.java))
8485
}
8586
}
8687

app/src/main/java/com/getcode/models/DeepLinkPaymentRequest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import com.getcode.model.CurrencyCode
44
import com.getcode.model.Fiat
55
import com.getcode.network.repository.decodeBase64
66
import com.getcode.solana.keys.PublicKey
7+
import com.getcode.utils.ErrorUtils
78
import com.getcode.vendor.Base58
89
import kotlinx.serialization.SerialName
910
import kotlinx.serialization.Serializable
@@ -75,6 +76,7 @@ data class DeepLinkPaymentRequest(
7576
val destination = runCatching { PublicKey.fromBase58(destinationString) }
7677
.getOrNull()
7778
if (destination == null) {
79+
ErrorUtils.handleError(Throwable())
7880
Timber.e("Invalid destination address")
7981
return null
8082
}

app/src/main/java/com/getcode/navigation/core/BottomSheetNavigator.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.compose.animation.core.AnimationSpec
55
import androidx.compose.animation.core.tween
66
import androidx.compose.foundation.layout.Spacer
77
import androidx.compose.foundation.layout.height
8+
import androidx.compose.foundation.shape.ZeroCornerSize
89
import androidx.compose.material.ExperimentalMaterialApi
910
import androidx.compose.material.ModalBottomSheetDefaults
1011
import androidx.compose.material.ModalBottomSheetLayout
@@ -51,7 +52,9 @@ fun BottomSheetNavigator(
5152
modifier: Modifier = Modifier,
5253
hideOnBackPress: Boolean = true,
5354
scrimColor: Color = CodeTheme.colors.surface.copy(alpha = 0.32f),
54-
sheetShape: Shape = CodeTheme.shapes.extraLarge,
55+
sheetShape: Shape = CodeTheme.shapes.extraLarge.copy(
56+
bottomStart = ZeroCornerSize, bottomEnd = ZeroCornerSize
57+
),
5558
sheetElevation: Dp = ModalBottomSheetDefaults.Elevation,
5659
sheetBackgroundColor: Color = CodeTheme.colors.surface,
5760
sheetContentColor: Color = CodeTheme.colors.onSurface,

app/src/main/java/com/getcode/theme/Type.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,6 @@ internal val typography = Typography(
102102
textAlign = TextAlign.Center
103103
),
104104
caption = TextStyle(
105-
fontFamily = Avenir,
106-
fontSize = 16.sp,
107-
fontWeight = FontWeight.SemiBold,
108-
lineHeight = 19.sp,
109-
//letterSpacing = 0.4.sp
110-
),
111-
overline = TextStyle(
112105
fontFamily = Avenir,
113106
fontSize = 12.sp,
114107
fontWeight = FontWeight.SemiBold,

app/src/main/java/com/getcode/ui/components/TextSection.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ fun TextSection(title: String, description: String) {
1414
Column(verticalArrangement = Arrangement.spacedBy(CodeTheme.dimens.grid.x2)) {
1515
Text(
1616
text = title,
17-
style = CodeTheme.typography.h6.copy(
18-
fontWeight = FontWeight.Bold,
19-
)
17+
style = CodeTheme.typography.subtitle1
2018
)
2119
Text(
2220
text = description,
23-
style = CodeTheme.typography.subtitle2
21+
style = CodeTheme.typography.body2
2422
)
2523
}
2624
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private fun MessageText(modifier: Modifier = Modifier, text: String, date: Insta
172172
Text(
173173
modifier = Modifier.align(Alignment.End),
174174
text = date.formatTimeRelatively(),
175-
style = CodeTheme.typography.overline,
175+
style = CodeTheme.typography.caption,
176176
color = BrandLight,
177177
)
178178
}

app/src/main/java/com/getcode/view/login/LoginHome.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fun LoginHome() {
138138

139139
ClickableText(
140140
text = bottomString,
141-
style = CodeTheme.typography.overline.copy(
141+
style = CodeTheme.typography.caption.copy(
142142
textAlign = TextAlign.Center,
143143
color = BrandLight
144144
),

app/src/main/java/com/getcode/view/main/account/AccountHome.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fun ListItem(item: AccountMainItem, onClick: () -> Unit) {
171171
text = if (isPhoneLinked) stringResource(id = R.string.title_linked)
172172
else stringResource(id = R.string.title_notLinked),
173173
color = BrandLight,
174-
style = CodeTheme.typography.caption.copy(
174+
style = CodeTheme.typography.body1.copy(
175175
fontSize = 12.sp
176176
),
177177
)

app/src/main/java/com/getcode/view/main/account/BetaFlagsScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fun BetaFlagsScreen(
9696
modifier = Modifier
9797
.padding(vertical = CodeTheme.dimens.grid.x1),
9898
text = option.subtitleText,
99-
style = CodeTheme.typography.overline,
99+
style = CodeTheme.typography.caption,
100100
color = BrandLight
101101
)
102102
}

app/src/main/java/com/getcode/view/main/account/ConfirmDeleteAccount.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fun ConfirmDeleteAccount(
4040
) {
4141
Text(
4242
text = stringResource(id = R.string.subtitle_deleteAccountDescription),
43-
style = CodeTheme.typography.subtitle2
43+
style = CodeTheme.typography.body2
4444
)
4545
TextField(
4646
modifier = Modifier
@@ -49,14 +49,14 @@ fun ConfirmDeleteAccount(
4949
placeholder = {
5050
Text(
5151
stringResource(id = R.string.subtitle_typeDelete).format(viewModel.requiredPhrase),
52-
style = CodeTheme.typography.caption
52+
style = CodeTheme.typography.body1
5353
)
5454
},
5555
value = viewModel.typedText.collectAsState().value,
5656
onValueChange = {
5757
viewModel.onTextUpdated(it)
5858
},
59-
textStyle = CodeTheme.typography.caption,
59+
textStyle = CodeTheme.typography.body1,
6060
singleLine = true,
6161
colors = inputColors(),
6262
shape = CodeTheme.shapes.extraSmall

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ fun AccountWithdrawAddress(
9595
.padding(start = CodeTheme.dimens.grid.x2),
9696
text = text,
9797
color = if (isValid) green else Color.Red,
98-
style = CodeTheme.typography.caption.copy(
99-
fontSize = 12.sp
100-
)
98+
style = CodeTheme.typography.caption
10199
)
102100
}
103101
}

app/src/main/java/com/getcode/view/main/currency/CurrencySelectionSheet.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ fun CurrencySelectionSheet(
182182
) {
183183
Text(
184184
modifier = Modifier.padding(bottom = 10.dp),
185-
style = CodeTheme.typography.caption.copy(
186-
fontSize = 14.sp,
187-
),
185+
style = CodeTheme.typography.body2,
188186
color = BrandLight,
189187
text = listItem.text
190188
)

app/src/main/java/com/getcode/view/main/getKin/GetKinSheet.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ fun GetKinSheet(
219219
Text(
220220
modifier = Modifier.padding(top = CodeTheme.dimens.grid.x1),
221221
text = stringResource(it),
222-
style = CodeTheme.typography.caption,
223-
fontSize = 13.sp,
222+
style = CodeTheme.typography.body2,
224223
color = colorResource(R.color.code_brand_light),
225224
)
226225
}

app/src/main/java/com/getcode/view/main/home/DecorView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ internal fun DecorView(
137137
Text(
138138
text = stringResource(id = R.string.title_badge_no_connection),
139139
color = Color.White,
140-
style = CodeTheme.typography.overline
140+
style = CodeTheme.typography.caption
141141
)
142142
}
143143
}

app/src/main/java/com/getcode/view/main/home/HomeViewModel.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class HomeViewModel @Inject constructor(
218218
historyController.fetchChats()
219219
},
220220
onFailure = {
221-
Timber.e(t = it, message = "Auto airdrop failed")
221+
ErrorUtils.handleError(it)
222222
prefRepository.set(PrefsBool.IS_ELIGIBLE_GET_FIRST_KIN_AIRDROP, false)
223223
}
224224
)
@@ -670,8 +670,6 @@ class HomeViewModel @Inject constructor(
670670
}.onSuccess {
671671
historyController.fetchChats()
672672

673-
showToast(paymentConfirmation.localAmount, false)
674-
675673
withContext(Dispatchers.Main) {
676674
uiFlow.update {
677675
val billState = it.billState
@@ -688,11 +686,12 @@ class HomeViewModel @Inject constructor(
688686
delay(1.seconds)
689687
cancelPayment(false)
690688
}.onFailure { error ->
691-
error.printStackTrace()
692689
TopBarManager.showMessage(
693690
resources.getString(R.string.error_title_payment_failed),
694691
resources.getString(R.string.error_description_payment_failed),
695692
)
693+
694+
ErrorUtils.handleError(error)
696695
uiFlow.update { uiModel ->
697696
uiModel.copy(
698697
presentationStyle = PresentationStyle.Hidden,

app/src/main/java/com/getcode/view/main/home/components/ReceivedKinConfirmation.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.getcode.R
2020
import com.getcode.models.Bill
2121
import com.getcode.theme.Brand
2222
import com.getcode.theme.CodeTheme
23+
import com.getcode.theme.White
2324
import com.getcode.util.flagResId
2425
import com.getcode.util.formatted
2526
import com.getcode.ui.components.ButtonState
@@ -52,6 +53,7 @@ internal fun ReceivedKinConfirmation(
5253
style = CodeTheme.typography.subtitle1.copy(
5354
fontWeight = FontWeight.Bold
5455
),
56+
color = White,
5557
text = stringResource(id = R.string.subtitle_youReceived)
5658
)
5759

buildSrc/src/main/java/Dependencies.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@file:Suppress("ConstPropertyName")
22

33
object Android {
4+
const val namespace = "com.getcode"
45
const val compileSdkVersion = 34
56
const val minSdkVersion = 22
67
const val targetSdkVersion = 33

ed25519/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
android {
6-
namespace = "com.getcode.ed25519"
6+
namespace = "${Android.namespace}.ed25519"
77
compileSdk = Android.compileSdkVersion
88
defaultConfig {
99
minSdk = Android.minSdkVersion

scripts/internal-testing-build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
date="$(date '+%m.%d.%y')"
4+
5+
export NOTIFY_ERRORS=true
6+
./gradlew assembleDebug
7+
8+
outputDir="$(pwd)/app/build/outputs/apk/debug"
9+
mv "${outputDir}/app-debug.apk" "${outputDir}/app-${date}-debug.apk"
10+
11+
unset NOTIFY_ERRORS

0 commit comments

Comments
 (0)