Skip to content

Commit

Permalink
Merge pull request #158 from muun/52.3-release-branch
Browse files Browse the repository at this point in the history
Apollo: Release source code for 52.3
  • Loading branch information
acrespo authored Nov 14, 2024
2 parents 86048fe + 214baf4 commit 0379bf2
Show file tree
Hide file tree
Showing 378 changed files with 14,635 additions and 22,559 deletions.
44 changes: 44 additions & 0 deletions android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,50 @@ follow [https://changelog.md/](https://changelog.md/) guidelines.

## [Unreleased]

## [52.3] - 2024-10-08

### ADDED

- Several background notification processing reliability improvements

### FIXED

- Fixed cancel payment dialog copy.
- Fixed low occurrence crash when tapping delete wallet.
- Fixed low occurrence crash when entering a payment detail from a notification or recent apps
- Fixed mempool space tx link destination (after mempool.space changed url destination)
- Released certain resources (like SQLite cursors) that weren't being released to avoid leaks.
- Fixed countDownTimer lifecycle issue (not being cancelled) in newop (send) screen

### CHANGED

- Upgrade Firebase to get SDK to get Release Monitoring feature.
- Upgrade Firebase dependencies using BOM (Bill Of Materials). firebase-bom:32.6.0
- Upgrade Firebase Messaging as part of firebase-bom:32.6.0
- Upgrade Firebase Crashlytics as part of firebase-bom:32.6.0
- Upgrade Firebase Analytics as part of firebase-bom:32.6.0
- Update Go version to 1.22.1
- Update Kotlin version to 1.8.20
- Upgrade Dagger to 2.52
- Upgrade SQDelight to 1.5.5
- Upgrade libwallet dependencies (like btcd)
- Removed secp256k1-zkp C code from lib wallet. Replaced it with the native Go version.
- Refactored and enhanced musig code in libwallet
- Enhanced debugging and tracing metadata for ANRs troubleshooting
- Avoid unnecessary writes to Android Keystore
- Avoid double write/delete to Android Keystore in logouts
- Reduce Butterknife usage (in slow effort to migrate Butterknife to ViewBinding)
- Simplified and cleaned libwallet build scripts
- Avoid needless requests when creating a new wallet
- Refactored (cleaned up) delete wallet logic
- Removed Stetho library (long time unused)
- Kotlinized all the repositories, part of an effort to delay access to shared prefs (lazy access).
- Introduced MockK for mocking kotlin classes, fields and properties.
- Upgrade AndroidX Navigation lib version to 2.7.7
- Upgrade AndroidX WorkManager lib version to 2.9.0
- Upgrade Android lifecycle aware components libs to 2.6.2
- Removed no longer needed *-ktx dependencies

## [52.2] - 2024-09-23

### FIXED
Expand Down
2 changes: 1 addition & 1 deletion android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM --platform=linux/amd64 openjdk:17-jdk-buster@sha256:9217da81dcff19e60861791
ENV NDK_VERSION 22.0.7026061
ENV ANDROID_PLATFORM_VERSION 28
ENV ANDROID_BUILD_TOOLS_VERSION 28.0.3
ENV GO_VERSION 1.21.11
ENV GO_VERSION 1.22.1

RUN apt-get update \
&& apt-get install --yes --no-install-recommends \
Expand Down
18 changes: 9 additions & 9 deletions android/apollo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ apply from: "${project.rootDir}/linters/pmd/check-android.gradle"
//apply from: "${project.rootDir}/linters/findbugs/check-android.gradle"

android {
namespace "io.muun.apollo.lib"

compileSdk 34

defaultConfig {
Expand Down Expand Up @@ -70,7 +72,8 @@ ext {
// TODO this currently needs to match common's retrofit version. We should refactor to avoid
// this discipline on our part. We probably need to extract it to a constant in top-level gradle
version_retrofit = '2.5.0'
version_workmanager = '2.7.1'
version_workmanager = '2.9.0' // Next version upgrade requires bump minSdk to 21
version_mockk = '1.13.7' // Latest version targeting kotlin 1.8.20
}


Expand Down Expand Up @@ -105,7 +108,7 @@ dependencies {

// Firebase:
// Import the Firebase BoM
api platform('com.google.firebase:firebase-bom:32.1.1')
api platform('com.google.firebase:firebase-bom:32.6.0')
// When using the BoM, you don't specify versions in Firebase library dependencies

// Push Notifications:
Expand All @@ -119,16 +122,11 @@ dependencies {
// WorkManager: (see https://github.com/muun/muun/issues/5895)
// Guide: https://developer.android.com/topic/libraries/architecture/workmanager/migrating-fb
api "androidx.work:work-runtime:$version_workmanager" // api as needs to be init at app.OnCreate
api "androidx.work:work-runtime-ktx:$version_workmanager" // Kotlin extensions

api 'com.facebook.stetho:stetho:1.5.0'
api 'com.facebook.stetho:stetho-okhttp3:1.5.0'
api 'com.facebook.stetho:stetho-timber:1.5.0@aar'

// Storage:
implementation 'com.squareup.sqlbrite3:sqlbrite:3.2.0'
implementation "com.squareup.sqldelight:android-driver:1.5.3"
implementation "com.squareup.sqldelight:rxjava2-extensions:1.5.3"
implementation "com.squareup.sqldelight:android-driver:1.5.5"
implementation "com.squareup.sqldelight:rxjava2-extensions:1.5.5"

// Networking:
implementation "com.squareup.retrofit2:retrofit:$version_retrofit"
Expand Down Expand Up @@ -162,6 +160,8 @@ dependencies {
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
testImplementation 'org.assertj:assertj-core:3.8.0'
testImplementation 'junit:junit:4.12'
testImplementation "io.mockk:mockk:$version_mockk"

// Can't use Jake Wharton's threeten lib for test. For more info see:
// https://github.com/JakeWharton/ThreeTenABP/issues/47
testImplementation 'org.threeten:threetenbp:1.6.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@
public abstract class BaseDao<ModelT extends PersistentModel> {

protected final String tableName;

protected BriteDatabase briteDb;

protected SupportSQLiteDatabase db;

protected Database delightDb;

protected Scheduler scheduler;

/**
Expand All @@ -49,10 +53,13 @@ public void setDb(BriteDatabase briteDatabase, Database delightDb, final Schedul
this.delightDb = delightDb;
this.scheduler = scheduler;

Preconditions.checkState(
briteDatabase.query("SELECT COUNT(*) FROM " + tableName).getCount() == 1,
"expected table " + tableName + " to exist"
);

try (Cursor cursor = briteDatabase.query("SELECT COUNT(*) FROM " + tableName)) {
Preconditions.checkState(
cursor.getCount() == 1,
"expected table " + tableName + " to exist"
);
}
}

/**
Expand Down Expand Up @@ -182,9 +189,11 @@ public Observable<ModelT> store(@Nonnull ModelT element) {

// FIXME: This is a racy operation. If another thread inserts any row, the id
// won't match.
final Cursor query = briteDb.query("SELECT last_insert_rowid();");
Preconditions.checkState(query.moveToFirst());
final long insertedId = query.getLong(0);
final long insertedId;
try (Cursor query = briteDb.query("SELECT last_insert_rowid();")) {
Preconditions.checkState(query.moveToFirst());
insertedId = query.getLong(0);
}
if (insertedId < 0) {
throw new RuntimeException("Error while inserting new value in the db");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@ public Observable<ModelT> store(@NonNull ModelT element) {
return super.store(element);
}

final Cursor cursor = briteDb.query(
"select id from " + tableName + " where hid = ?",
String.valueOf(element.getHid())
);

if (cursor.getCount() == 0) {
return super.store(element);
}

if (cursor.getCount() == 1) {
cursor.moveToFirst();
element.setId(cursor.getLong(cursor.getColumnIndex("id")));
return super.store(element);
final String id = String.valueOf(element.getHid());
try (Cursor cursor = briteDb.query(
"select id from " + tableName + " where hid = ?", id
)) {

if (cursor.getCount() == 0) {
return super.store(element);
}

if (cursor.getCount() == 1) {
cursor.moveToFirst();
element.setId(cursor.getLong(cursor.getColumnIndex("id")));
return super.store(element);
}
}

return Observable.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.muun.apollo.data.async.gcm.GcmMessageListenerService;
import io.muun.apollo.data.async.tasks.MuunWorkerFactory;
import io.muun.apollo.data.async.tasks.TaskScheduler;
import io.muun.apollo.data.db.DaoManager;
import io.muun.apollo.data.db.contact.ContactDao;
import io.muun.apollo.data.db.operation.OperationDao;
import io.muun.apollo.data.db.public_profile.PublicProfileDao;
Expand Down Expand Up @@ -110,4 +111,6 @@ public interface DataComponent extends ActionComponent {
NotificationService notificationService();

Analytics analytics();

DaoManager daoManager();
}
14 changes: 11 additions & 3 deletions android/apollo/src/main/java/io/muun/apollo/data/external/Gen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import io.muun.apollo.domain.model.IncomingSwap
import io.muun.apollo.domain.model.IncomingSwapHtlc
import io.muun.apollo.domain.model.NextTransactionSize
import io.muun.apollo.domain.model.Operation
import io.muun.apollo.domain.model.PaymentRequest
import io.muun.apollo.domain.model.PublicProfile
import io.muun.apollo.domain.model.SubmarineSwap
import io.muun.apollo.domain.model.SubmarineSwapBestRouteFees
Expand Down Expand Up @@ -44,7 +43,6 @@ import org.javamoney.moneta.Money
import org.threeten.bp.ZonedDateTime
import javax.money.CurrencyUnit
import javax.money.Monetary
import javax.money.MonetaryAmount
import kotlin.random.Random

object Gen {
Expand Down Expand Up @@ -250,7 +248,9 @@ object Gen {
pair.second,
transactionHash() + ":0",
UtxoStatus.CONFIRMED,
pair.second
pair.second,
"m/schema:1'/recovery:1'",
1
)

/**
Expand All @@ -269,6 +269,14 @@ object Gen {
fun nextTransactionSize(vararg entries: SizeForAmount, expectedDebtInSat: Long = 0) =
NextTransactionSize(sizeProgression(*entries), 1, expectedDebtInSat)

/**
* Get a FeeBumpFunctions vector
*/
fun feeBumpFunctions() =
listOf(
"QsgAAAAAAAAAAAAAf4AAAD+AAABAAAAA", // [[100, 0, 0], [+Inf, 1, 2]]
"f4AAAD+AAAAAAAAA" // [[+Inf, 1, 0]]]
)
/**
* Get a Transaction Hash.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,6 @@ abstract class Globals {
*/
abstract val deviceManufacturer: String

/**
* Get the fingerprint of the device where app is running.
*/
abstract val fingerprint: String

/**
* Get the hardware name of the device where app is running.
*/
abstract val hardware: String

/**
* Get the bootloader name of the device where app is running.
*/
abstract val bootloader: String

/**
* Get the bitcoin network specs/parameters of the network this build is using.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ object Crashlytics {
}

analyticsProvider?.report(
AnalyticsEvent.E_CRASHLYTICS_ERROR(
report.error.javaClass.simpleName + ":" + report.error.localizedMessage
)
AnalyticsEvent.E_CRASHLYTICS_ERROR(report)
)

crashlytics?.recordException(report.error)
Expand Down
Loading

0 comments on commit 0379bf2

Please sign in to comment.