Skip to content

Commit

Permalink
Merge pull request breadwallet#8 from breadwallet/release/4.12.3
Browse files Browse the repository at this point in the history
Release/4.12.3
  • Loading branch information
DrewCarlson authored Sep 24, 2021
2 parents a4ce72c + eda32dd commit c38cf66
Show file tree
Hide file tree
Showing 466 changed files with 34,949 additions and 3,900 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ DerivedData/
## Gcc Patch
/*.gcno

*/google-services.json
/app/src/main/res/font/*.otf
/app/src/main/res/font/*.ttf

## xcode-frameworks folders and plists so that xcode does not complain prior first build of Cosmos.xcframework
cosmos-bundled/build-frameworks/
!cosmos-bundled/build-frameworks/Cosmos.xcframework/Info.plist
Expand Down
15 changes: 8 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ stages:
default:
# image: alvrme/alpine-android:android-29-jdk11
tags:
- ios-12
- xcode-10
- macos-10_13
- macos
before_script:
- git submodule update --init --checkout

variables:
ANDROID_SDK_ROOT: /Users/builder/Library/Android/sdk
SIGNING_KEY: /builds/breadwallet/brd-mobile/brd-android/FakeSigningKey
SIGNING_PASSWORD: qwerty
SIGNING_ALIAS: key0
Expand Down Expand Up @@ -44,6 +43,10 @@ build-cosmos:
- buildSrc/**/Libs.kt
- cosmos-*/**/*
- .gitlab-ci.yml
artifacts:
when: on_failure
paths:
- ./**/build/reports/tests

build-android:
stage: build
Expand Down Expand Up @@ -83,11 +86,9 @@ build-ios:
script:
- ./gradlew :cosmos-bundled:createXCFramework
- xcodebuild clean -workspace brd-ios/breadwallet.xcworkspace -scheme breadwallet | xcpretty
- xcodebuild test -workspace brd-ios/breadwallet.xcworkspace -scheme breadwallet -destination 'platform=iOS Simulator,name=iPhone 12,OS=14.4' | xcpretty -s
- xcodebuild test -workspace brd-ios/breadwallet.xcworkspace -scheme breadwallet -destination 'platform=iOS Simulator,name=iPhone 12,OS=14.5' | xcpretty -s
tags:
- ios-12
- xcode-10
- macos-10_13
- macos

deploy-appetize:
stage: deploy
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
path = external/google-services
url = ../../breadwallet/google-services.git
update = none
[submodule "external/in-app-i18n"]
path = external/in-app-i18n
url = ../../breadwallet/in-app-i18n.git
update = none
[submodule "external/redacted-compiler-plugin"]
path = external/redacted-compiler-plugin
url = https://github.com/ZacSweers/redacted-compiler-plugin.git
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ Each module contains only code related to a single feature, helping keep the pro

The following modules are available, click on the name to learn more.

- [`cosmos-core`](/cosmos-core) Internal shared utilities for all other modules to leverage.
- [`cosmos-address-resolver`](/cosmos-address-resolver) Utilities for resolving addresses from name services ([UnstoppableDomains](https://unstoppabledomains.com/), [ENS](https://ens.domains/), [Fio](https://fioprotocol.io/), and [PayString](https://paystring.org/)).
- [`cosmos-bakers-api-client`](/cosmos-bakers-api-client) Tezos baker data API client ([baking-bad.org](http://baking-bad.org)).
- [`cosmos-brd-api-client`](/cosmos-brd-api-client) A Hydra compatible API wrapper for Kotlin and Swift.
- [`cosmos-bundled`](/cosmos-bundled) Depends on all other modules to produce final dependency artifacts.
- [`cosmos-exchange`](/cosmos-exchange) Presentation module for crypto exchange features.
- [`cosmos-core`](/cosmos-core) Internal shared utilities for all other modules to leverage.
- [`cosmos-preferences`](/cosmos-preferences) SharedPreferences and UserDefaults wrapper for common Kotlin code.
- [`cosmos-websocket`](/cosmos-websocket) WebSocket client APIs for common Kotlin.

**Mobile Applications**

Expand Down Expand Up @@ -165,4 +170,4 @@ A light clone of this repository can be created with `git clone [email protected]:b

**BRD** source code is available under the terms of the Business Source License 1.1 (`BUSL-1.1`), see [`LICENSE`](./LICENSE).

[WalletKit](https://github.com/blockset-corp/walletkit) is available under the terms of the MIT License.
[WalletKit](https://github.com/blockset-corp/walletkit) is available under the terms of the MIT License.
22 changes: 0 additions & 22 deletions brd-android/LICENSE

This file was deleted.

72 changes: 0 additions & 72 deletions brd-android/README.md

This file was deleted.

7 changes: 6 additions & 1 deletion brd-android/app-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ redacted {
}

project.tasks.register<brd.DownloadBundles>("downloadBundles")
project.tasks.register<brd.DownloadSupportArticles>("downloadSupportArticles")

android {
compileSdkVersion(BrdRelease.ANDROID_COMPILE_SDK)
Expand All @@ -36,8 +37,12 @@ android {

dependencies {
implementation(project(":brd-android:theme"))
implementation(project(":cosmos-preferences"))
implementation(project(":cosmos-brd-api-client"))
implementation(Libs.Kotlin.StdLibJdk8)
implementation(Libs.Coroutines.Core)
implementation(Libs.Coroutines.Core) {
version { strictly(brd.COROUTINES_VERSION) }
}
api(Libs.WalletKit.CoreAndroid)

implementation(Libs.Androidx.LifecycleExtensions)
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions brd-android/app-core/src/main/assets/support/sections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":360001021034,"name":"Send and Receive","position":1},{"id":360001029113,"name":"Buy and Sell","position":2},{"id":360001020454,"name":"Importing Wallets","position":3},{"id":360001028173,"name":"App Settings","position":4},{"id":360001028193,"name":"Security","position":5},{"id":360001020074,"name":"Troubleshooting","position":6},{"id":360001029053,"name":"Cryptocurrency Basics","position":7},{"id":360001020974,"name":"BRD Rewards","position":8},{"id":360001020954,"name":"Miscellaneous","position":9}]
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fun BigDecimal.formatCryptoForUi(
currencyFormat.decimalFormatSymbols = decimalFormatSymbols
currencyFormat.maximumFractionDigits = scale
currencyFormat.minimumFractionDigits = 0
return "${currencyFormat.format(amount)} ${currencyCode.toUpperCase()}"
return "${currencyFormat.format(amount)} ${currencyCode.uppercase()}"
}

val Wallet.currencyId: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class RatesRepository private constructor(private val mContext: Context) {
return if (fromCurrency.isNullOrBlank() || toCurrency.isNullOrBlank()) {
null
} else {
"$fromCurrency$CACHE_KEY_DELIMITER$toCurrency".toLowerCase(Locale.ROOT)
"$fromCurrency$CACHE_KEY_DELIMITER$toCurrency".lowercase()
}
}

Expand Down Expand Up @@ -165,7 +165,7 @@ class RatesRepository private constructor(private val mContext: Context) {
* @return the price change.
*/
fun getPriceChange(currencyCode: String): PriceChange? {
return mPriceChanges[currencyCode.toUpperCase(Locale.ROOT)]
return mPriceChanges[currencyCode.uppercase()]
}

@get:Synchronized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import android.content.SharedPreferences
import android.text.format.DateUtils
import androidx.annotation.VisibleForTesting
import androidx.core.content.edit
import com.brd.api.BrdApiHost
import com.brd.prefs.BrdPreferences
import com.breadwallet.app.Conversion
import com.breadwallet.appcore.BuildConfig
import com.breadwallet.model.PriceAlert
import com.breadwallet.tools.util.Bip39Reader
import com.breadwallet.tools.util.ServerBundlesHelper
Expand All @@ -29,6 +32,9 @@ import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.launch
import org.kodein.di.android.closestKodein
import org.kodein.di.direct
import org.kodein.di.erased.instance
import java.util.Currency
import java.util.Locale
import java.util.UUID
Expand Down Expand Up @@ -106,6 +112,8 @@ object BRSharedPrefs {
* This removes the need for a context parameter.
*/
fun initialize(context: Context, applicationScope: CoroutineScope) {
val kodein by closestKodein(context)
brdPreferences = kodein.direct.instance()
brdPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
applicationScope.launch {
_trackedConversionChanges.value = getTrackedConversions()
Expand All @@ -115,6 +123,7 @@ object BRSharedPrefs {
}

private lateinit var brdPrefs: SharedPreferences
private lateinit var brdPreferences: BrdPreferences
private val promptChangeChannel = BroadcastChannel<Unit>(Channel.CONFLATED)

var lastGiftCheckTime: Long
Expand Down Expand Up @@ -149,10 +158,10 @@ object BRSharedPrefs {
}

fun getReceiveAddress(iso: String): String? =
brdPrefs.getString(RECEIVE_ADDRESS + iso.toUpperCase(), "")
brdPrefs.getString(RECEIVE_ADDRESS + iso.uppercase(), "")

fun putReceiveAddress(tmpAddr: String, iso: String) =
brdPrefs.edit { putString(RECEIVE_ADDRESS + iso.toUpperCase(), tmpAddr) }
brdPrefs.edit { putString(RECEIVE_ADDRESS + iso.uppercase(), tmpAddr) }

@JvmStatic
fun getSecureTime() =
Expand All @@ -169,19 +178,19 @@ object BRSharedPrefs {
}

fun getLastSyncTime(iso: String) =
brdPrefs.getLong(LAST_SYNC_TIME_PREFIX + iso.toUpperCase(), 0)
brdPrefs.getLong(LAST_SYNC_TIME_PREFIX + iso.uppercase(), 0)

fun putLastSyncTime(iso: String, time: Long) =
brdPrefs.edit { putLong(LAST_SYNC_TIME_PREFIX + iso.toUpperCase(), time) }
brdPrefs.edit { putLong(LAST_SYNC_TIME_PREFIX + iso.uppercase(), time) }

fun getLastSendTransactionBlockheight(iso: String) =
brdPrefs.getLong(LAST_SEND_TRANSACTION_BLOCK_HEIGHT_PREFIX + iso.toUpperCase(), 0)
brdPrefs.getLong(LAST_SEND_TRANSACTION_BLOCK_HEIGHT_PREFIX + iso.uppercase(), 0)

fun putLastSendTransactionBlockheight(
iso: String,
blockHeight: Long
) = brdPrefs.edit {
putLong(LAST_SEND_TRANSACTION_BLOCK_HEIGHT_PREFIX + iso.toUpperCase(), blockHeight)
putLong(LAST_SEND_TRANSACTION_BLOCK_HEIGHT_PREFIX + iso.uppercase(), blockHeight)
}

//if the user prefers all in crypto units, not fiat currencies
Expand Down Expand Up @@ -218,31 +227,31 @@ object BRSharedPrefs {
brdPrefs.edit { putBoolean(GEO_PERMISSIONS_REQUESTED, requested) }

fun getStartHeight(iso: String): Long =
brdPrefs.getLong(START_HEIGHT_PREFIX + iso.toUpperCase(), 0)
brdPrefs.getLong(START_HEIGHT_PREFIX + iso.uppercase(), 0)

fun putStartHeight(iso: String, startHeight: Long) =
brdPrefs.edit { putLong(START_HEIGHT_PREFIX + iso.toUpperCase(), startHeight) }
brdPrefs.edit { putLong(START_HEIGHT_PREFIX + iso.uppercase(), startHeight) }

fun getLastRescanTime(iso: String): Long =
brdPrefs.getLong(RESCAN_TIME_PREFIX + iso.toUpperCase(), 0)
brdPrefs.getLong(RESCAN_TIME_PREFIX + iso.uppercase(), 0)

fun putLastRescanTime(iso: String, time: Long) =
brdPrefs.edit { putLong(RESCAN_TIME_PREFIX + iso.toUpperCase(), time) }
brdPrefs.edit { putLong(RESCAN_TIME_PREFIX + iso.uppercase(), time) }

fun getLastBlockHeight(iso: String): Int =
brdPrefs.getInt(LAST_BLOCK_HEIGHT_PREFIX + iso.toUpperCase(), 0)
brdPrefs.getInt(LAST_BLOCK_HEIGHT_PREFIX + iso.uppercase(), 0)

fun putLastBlockHeight(iso: String, lastHeight: Int) =
brdPrefs.edit {
putInt(LAST_BLOCK_HEIGHT_PREFIX + iso.toUpperCase(), lastHeight)
putInt(LAST_BLOCK_HEIGHT_PREFIX + iso.uppercase(), lastHeight)
}

fun getScanRecommended(iso: String): Boolean =
brdPrefs.getBoolean(SCAN_RECOMMENDED_PREFIX + iso.toUpperCase(), false)
brdPrefs.getBoolean(SCAN_RECOMMENDED_PREFIX + iso.uppercase(), false)

fun putScanRecommended(iso: String, recommended: Boolean) =
brdPrefs.edit {
putBoolean(SCAN_RECOMMENDED_PREFIX + iso.toUpperCase(), recommended)
putBoolean(SCAN_RECOMMENDED_PREFIX + iso.uppercase(), recommended)
}

@JvmStatic
Expand All @@ -258,10 +267,11 @@ object BRSharedPrefs {
}

fun getDebugHost(): String? =
brdPrefs.getString(DEBUG_HOST, "")
brdPreferences.debugApiHost

fun putDebugHost(host: String) =
brdPrefs.edit { putString(DEBUG_HOST, host) }
fun getApiHost(): String {
return BrdApiHost.hostFor(BuildConfig.DEBUG, brdPreferences.hydraActivated).host
}

fun clearAllPrefs() = brdPrefs.edit { clear() }

Expand All @@ -286,10 +296,10 @@ object BRSharedPrefs {
brdPrefs.edit { putBoolean(PROMPT_PREFIX + promptName, dismissed) }

fun getTrustNode(iso: String): String? =
brdPrefs.getString(TRUST_NODE_PREFIX + iso.toUpperCase(), "")
brdPrefs.getString(TRUST_NODE_PREFIX + iso.uppercase(), "")

fun putTrustNode(iso: String, trustNode: String) =
brdPrefs.edit { putString(TRUST_NODE_PREFIX + iso.toUpperCase(), trustNode) }
brdPrefs.edit { putString(TRUST_NODE_PREFIX + iso.uppercase(), trustNode) }

fun putFCMRegistrationToken(token: String) =
brdPrefs.edit { putString(FCM_TOKEN, token) }
Expand Down
Loading

0 comments on commit c38cf66

Please sign in to comment.