Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
path = modules/games
url = https://github.com/gruntsoftware/android-games.git
update = none
[submodule "gruntsoftware-build-logic"]
path = gruntsoftware-build-logic
url = https://github.com/gruntsoftware/android-build-logic.git
61 changes: 12 additions & 49 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import org.gradle.kotlin.dsl.grunt

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.jetbrains.kotlin.compose)
alias(grunt.plugins.jetbrains.kotlin.android)
alias(grunt.plugins.jetbrains.kotlin.compose)
alias(libs.plugins.jetbrains.kotlin.kapt)
alias(libs.plugins.jetbrains.kotlin.serialization)
alias(grunt.plugins.jetbrains.kotlin.serialization)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.ksp)
alias(grunt.plugins.ksp)
alias(grunt.plugins.buildlogic.test)
alias(grunt.plugins.buildlogic.detekt)
}

val localProperties = gradleLocalProperties(rootDir, providers)
Expand Down Expand Up @@ -179,15 +182,7 @@ android {
//TODO: rename output apk/bundle
}

val ktlint by configurations.creating

dependencies {
ktlint(libs.pinterest.ktlint) {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}

val gamesModule = findProject(":modules:games:content")
if (gamesModule != null) {
implementation(gamesModule)
Expand Down Expand Up @@ -222,11 +217,11 @@ dependencies {
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.android)
implementation (libs.airbnb.lottie.compose)
implementation(platform(libs.koin.bom))
implementation(libs.bundles.koin)
implementation(platform(libs.koin.annotation.bom))
implementation(libs.koin.annotation)
ksp(libs.koin.annotation.compiler)
implementation(platform(grunt.koin.bom))
implementation(grunt.bundles.koin)
implementation(platform(grunt.koin.annotation.bom))
implementation(grunt.koin.annotation)
ksp(grunt.koin.annotation.compiler)

implementation(platform(libs.squareup.okhttp.bom))
implementation(libs.bundles.squareup.okhttp)
Expand Down Expand Up @@ -255,38 +250,6 @@ dependencies {
androidTestImplementation(libs.slf4j.android)
}

val ktlintCheck by tasks.registering(JavaExec::class) {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Check Kotlin code style"
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
args(
"**/src/**/*.kt",
"**.kts",
"!**/build/**",
)
}

tasks.check {
dependsOn(ktlintCheck)
}

tasks.register<JavaExec>("ktlintFormat") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Check Kotlin code style and format"
classpath = ktlint
mainClass.set("com.pinterest.ktlint.Main")
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
args(
"-F",
"**/src/**/*.kt",
"**.kts",
"!**/build/**",
)
}

tasks.withType<Test> {
jvmArgs("-XX:+EnableDynamicAgentLoading")
}
16 changes: 5 additions & 11 deletions app/src/androidTest/kotlin/flow/RecoverWalletScreenGrabsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ class RecoverWalletScreenGrabsTest {
CleanStatusBar.disable()
}


@OptIn(ExperimentalTestApi::class)
@Test
fun onRecoverFlowSuccess() {

composeTestRule.activityRule.scenario.onActivity {
Screengrab.setDefaultScreenshotStrategy(FalconScreenshotStrategy(it))
}
Expand All @@ -102,7 +100,7 @@ class RecoverWalletScreenGrabsTest {

Screengrab.screenshot("2_input_words_screen")

//seed words input
// seed words input
val editTextTags = (0..11).map { index -> "textFieldSeedWord$index" }

val paperKey = BuildConfig.SCREENGRAB_PAPERKEY
Expand Down Expand Up @@ -148,7 +146,7 @@ class RecoverWalletScreenGrabsTest {

Screengrab.screenshot("6_main_screen")

//setting drawer
// setting drawer
onView(withId(R.id.menuBut)).perform(click())

Screengrab.screenshot("7_setting_drawer_open")
Expand Down Expand Up @@ -216,8 +214,7 @@ class RecoverWalletScreenGrabsTest {
uiDevice.waitForIdle()
Thread.sleep(1000)


//tx send ui
// tx send ui
onView(withId(R.id.nav_send)).perform(click())

onView(withId(R.id.amount_edit)).perform(click())
Expand All @@ -226,16 +223,14 @@ class RecoverWalletScreenGrabsTest {

onView(withId(R.id.close_button)).perform(click())


//tx buy/receive ui
// tx buy/receive ui
onView(withId(R.id.nav_receive)).perform(click())

Screengrab.screenshot("15_transaction_buy_receive")

composeTestRule.onNodeWithTag("buttonClose").performClick()

uiDevice.waitForIdle()

}

private fun waitUntilReady() {
Expand All @@ -262,5 +257,4 @@ class RecoverWalletScreenGrabsTest {
}
}
}

}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/brainwallet/BrainwalletApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ open class BrainwalletApp : Application() {
return context == null || activityCounter.get() <= 0
}

//call onStop on evert activity so
// call onStop on evert activity so
@JvmStatic
fun onStop(app: BRActivity?) {
if (isBackgroundChecker != null) isBackgroundChecker!!.cancel()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/brainwallet/data/model/AppSetting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ data class AppSetting(
-1f,
"$"
)
)
)
2 changes: 1 addition & 1 deletion app/src/main/java/com/brainwallet/data/model/Country.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package com.brainwallet.data.model

data class Country(val name: String, val code: String)
data class Country(val name: String, val code: String)
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import java.io.Serializable
@kotlinx.serialization.Serializable
data class CurrencyEntity(
@JvmField
var code: String ="",
var code: String = "",
@JvmField
var name: String = "",
@JvmField
@SerialName("n")
var rate: Float = 0F,
@JvmField
var symbol: String = ""
) : Serializable
) : Serializable
3 changes: 1 addition & 2 deletions app/src/main/java/com/brainwallet/data/model/Fee.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ data class Fee(
}
}


data class FeeOption(
@FeeType
val type: String,
Expand Down Expand Up @@ -90,5 +89,5 @@ fun FeeOption.getFiatFormatted(currencyEntity: CurrencyEntity): String {

fun List<FeeOption>.getSelectedIndex(selectedFeeType: String): Int {
return indexOfFirst { it.type == selectedFeeType }.takeIf { it >= 0 }
?: 2 //2 -> index of top, since we have [low,medium,top]
?: 2 // 2 -> index of top, since we have [low,medium,top]
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/brainwallet/data/model/IntroLanguage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.brainwallet.data.model

data class IntroLanguage(
val code: String,
val name : String,
val desc : String,
val audio : Int,
val name: String,
val desc: String,
val audio: Int,
val message: String,
val lang: Language
)
3 changes: 1 addition & 2 deletions app/src/main/java/com/brainwallet/data/model/Language.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.Locale
* Brainwallet localizations. Will be updated from time to time
* based on business objectives
*/
enum class Language (
enum class Language(
val code: String,
val title: String,
val desc: String,
Expand Down Expand Up @@ -49,4 +49,3 @@ enum class Language (
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ data class MoonpayCurrencyLimit(
@SerialName("minBuyAmount") val min: Float = 21f,
@SerialName("maxBuyAmount") val max: Float = 29849f
)
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.brainwallet.data.model


data class QuickFiatAmountOption(
val symbol: String = "custom",
val value: Float = -1f
)

fun QuickFiatAmountOption.isCustom(): Boolean = symbol == "custom" && value == -1f

fun QuickFiatAmountOption.getFormattedText(): String = "${symbol}${value.toInt()}"
fun QuickFiatAmountOption.getFormattedText(): String = "${symbol}${value.toInt()}"
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class FirebaseRemoteConfigRepository(
override fun onError(error: FirebaseRemoteConfigException) {
Timber.d("timber: [RemoteConfig] onError ${error.code} | ${error.message}")
}

})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface LtcRepository {
companion object {
const val PREF_KEY_NETWORK_FEE_PER_KB = "network_fee_per_kb"
const val PREF_KEY_NETWORK_FEE_PER_KB_CACHED_AT = "${PREF_KEY_NETWORK_FEE_PER_KB}_cached_at"
const val PREF_KEY_BUY_LIMITS_PREFIX = "buy_limits:" //e.g. buy_limits:usd
const val PREF_KEY_BUY_LIMITS_PREFIX = "buy_limits:" // e.g. buy_limits:usd
const val PREF_KEY_BUY_LIMITS_PREFIX_CACHED_AT = "buy_limits_cached_at:"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class LtcRepositoryImpl(
private val sharedPreferences: SharedPreferences,
) : LtcRepository {

//todo: make it offline first here later, currently just using CurrencyDataSource.getAllCurrencies
// todo: make it offline first here later, currently just using CurrencyDataSource.getAllCurrencies
override suspend fun fetchRates(): List<CurrencyEntity> {
return runCatching {
val rates = remoteApiSource.getRates()

//legacy logic
// legacy logic
FeeManager.updateFeePerKb(context)
val selectedISO = BRSharedPrefs.getIsoSymbol(context)
rates.forEachIndexed { index, currencyEntity ->
Expand All @@ -41,11 +41,10 @@ class LtcRepositoryImpl(
}
}

//save to local
// save to local
currencyDataSource.putCurrencies(rates)
return rates
}.getOrElse { currencyDataSource.getAllCurrencies(true) }

}

/**
Expand All @@ -54,13 +53,13 @@ class LtcRepositoryImpl(
*
* maybe need updaete core if we need to use dynamic fee?
*/
override suspend fun fetchFeePerKb(): Fee = Fee.Default //using static fee
override suspend fun fetchFeePerKb(): Fee = Fee.Default // using static fee

override suspend fun fetchLimits(baseCurrencyCode: String): MoonpayCurrencyLimit {
return sharedPreferences.fetchWithCache(
key = "${PREF_KEY_BUY_LIMITS_PREFIX}${baseCurrencyCode.lowercase()}",
cachedAtKey = "${PREF_KEY_BUY_LIMITS_PREFIX_CACHED_AT}${baseCurrencyCode.lowercase()}",
cacheTimeMs = 5 * 60 * 1000, //5 minutes
cacheTimeMs = 5 * 60 * 1000, // 5 minutes
fetchData = {
remoteApiSource.getMoonpayCurrencyLimit(baseCurrencyCode)
}
Expand All @@ -83,11 +82,10 @@ class LtcRepositoryImpl(
.buildUpon()
.apply {
if (BuildConfig.DEBUG) {
authority("buy-sandbox.moonpay.com")//replace base url from buy.moonpay.com
authority("buy-sandbox.moonpay.com") // replace base url from buy.moonpay.com
}
}
.build()
.toString()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ interface SelectedPeersRepository {
companion object {
const val LITECOIN_NODES_URL = "https://api.blockchair.com/litecoin/nodes"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SelectedPeersRepositoryImpl(
return suspendCoroutine { continuation ->
okHttpClient.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
continuation.resume(emptySet()) //just return empty if failed or need hardcoded?
continuation.resume(emptySet()) // just return empty if failed or need hardcoded?
}

override fun onResponse(call: Call, response: Response) {
Expand All @@ -60,7 +60,7 @@ class SelectedPeersRepositoryImpl(
val dataObject = jsonElement.jsonObject["data"]?.jsonObject
val nodesObject = dataObject?.get("nodes")?.jsonObject

//filter criteria
// filter criteria
val requiredServices = 0x01 or 0x04 // NODE_NETWORK | NODE_BLOOM

nodesObject?.entries
Expand All @@ -72,7 +72,6 @@ class SelectedPeersRepositoryImpl(
?.map { it.key.replace(":9333", "") }
?.toSet().also { Timber.d("Total Selected Peers ${it?.size}") }
?: emptySet()

} ?: emptySet()

sharedPreferences.edit {
Expand All @@ -85,5 +84,4 @@ class SelectedPeersRepositoryImpl(
})
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ interface SettingRepository {
const val KEY_FIAT_CURRENCY_CODE = "fiat_currency_code"
const val KEY_SELECTED_FEE_TYPE = "selected_fee_type"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class SettingRepositoryImpl(
sharedPreferences.getString(KEY_SELECTED_FEE_TYPE, FeeManager.REGULAR)
?: FeeManager.REGULAR


private fun load(): AppSetting {
return AppSetting(
isDarkMode = sharedPreferences.getBoolean(KEY_IS_DARK_MODE, true),
Expand Down
Loading