Skip to content

Commit 96c3ec9

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

23 files changed

Lines changed: 66 additions & 44 deletions

File tree

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
}

0 commit comments

Comments
 (0)