Skip to content
Draft
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 packages/mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Quiet Mobile is a React Native app for Android and iOS that shares a Node.js [ba
```
You should see your phone under "List of Devices Attached". If you do not, try `adb kill-server` or restarting your phone and your dev machine. You device should not appear as "Unauthorized". If it does, make sure you have accepted any "USB Debugging" prompts on your device.


**NOTE:** In order to build Quiet, you can't run a plan `./gradlew assembleDebug`, you *must* run `./gradlew assembleStandardDebug`.

1. Run Quiet

From the `packages/mobile` directory
Expand Down
166 changes: 61 additions & 105 deletions packages/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "kotlin-android"

apply plugin: "com.facebook.react"

react {
Expand All @@ -10,7 +8,6 @@ react {

def googleServicesJsonPath = file("google-services.json")


/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
Expand Down Expand Up @@ -93,23 +90,6 @@ project.ext.react = [
// Run Proguard to shrink the Java bytecode in release builds.
def enableProguardInReleaseBuilds = false

/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*
* Using this 16KB Aligned build from Maven Central
* https://github.com/react-native-community/jsc-android-buildscripts/pull/184
* https://repo1.maven.org/maven2/io/github/react-native-community/jsc-android-intl/
*/
def jscFlavor = "io.github.react-native-community:jsc-android-intl:2026004.0.1@aar"

/**
* Whether to enable the Hermes VM.
*
Expand Down Expand Up @@ -145,46 +125,44 @@ def getNDK() {
return rootProject.ext.has("NDK_PATH") ? rootProject.ext.get("NDK_PATH") : null
}

android {
ndkPath = getNDK()
ndkVersion = rootProject.ext.ndkVersion
android {
ndkPath = getNDK()
ndkVersion = "28.2.13676358"

buildToolsVersion(rootProject.ext.buildToolsVersion)
compileSdkVersion(rootProject.ext.compileSdkVersion)

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

packagingOptions {
jniLibs {
useLegacyPackaging = true
pickFirsts += ["lib/arm64-v8a/libc++_shared.so", "lib/arm64-v8a/libc++_shared.so"]
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

namespace "com.quietmobile"

defaultConfig {
applicationId = "com.quietmobile"
minSdkVersion(rootProject.ext.minSdkVersion)
targetSdkVersion(rootProject.ext.targetSdkVersion)
versionCode 615
versionName "7.1.0"
resValue("string", "build_config_package", "com.quietmobile")
testBuildType = System.getProperty("testBuildType", "debug")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk {
//noinspection ChromeOsAbiSupport
abiFilters "arm64-v8a"
packagingOptions {
jniLibs {
useLegacyPackaging = true
pickFirsts += ["lib/arm64-v8a/libc++_shared.so", "lib/arm64-v8a/libc++_shared.so"]
}
}
externalNativeBuild {
cmake {
cppFlags ""

namespace "com.quietmobile"
compileSdkVersion = rootProject.ext.compileSdkVersion
defaultConfig {
applicationId = "com.quietmobile"
targetSdk = rootProject.ext.targetSdkVersion
minSdk = rootProject.ext.minSdkVersion
versionCode = 615
versionName = "7.1.0"
resValue("string", "build_config_package", "com.quietmobile")
testBuildType = System.getProperty("testBuildType", "debug")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk {
//noinspection ChromeOsAbiSupport
abiFilters "arm64-v8a"
}
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
}
splits {
abi {
reset()
Expand Down Expand Up @@ -267,54 +245,45 @@ android {
}

dependencies {
implementation("androidx.appcompat:appcompat:1.7.1")
implementation(fileTree(dir: "libs", include: ["*.jar", "*.so"])) // this picks up Quiet's libtor.so
// version set by the React Native Gradle Plugin in npm
implementation("com.facebook.react:react-android")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.2.0")

//noinspection GradleDynamicVersion // TODO this needs to be re-configured on npm side...
androidTestImplementation("com.wix:detox:+")
androidTestImplementation("androidx.test:core:1.7.0")
androidTestImplementation("androidx.test.ext:junit:1.3.0")
androidTestImplementation(libs.androidx.core)
androidTestImplementation(libs.androidx.junit)

if (enableHermes) {
//noinspection GradleDynamicVersion
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
exclude group: "com.facebook.fbjni"
}
} else {
implementation(jscFlavor)
implementation(libs.jsc.android.intl)
}

// TODO these can't be further updated until Quiet targets API 36
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version")
implementation("androidx.core:core-ktx:1.16.0")
// for tor binary libtor.so
implementation(fileTree(dir: "libs", include: ["*.jar", "*.so"]))

implementation("com.google.code.gson:gson:2.13.2")
implementation(platform("com.google.firebase:firebase-bom:33.14.0"))
implementation("com.google.firebase:firebase-messaging-ktx")
implementation("androidx.security:security-crypto:1.1.0-alpha06")
implementation(project(":react-native-fs")) // comes from npm module
implementation(group: "commons-io", name: "commons-io", version: "2.20.0")

// Websockets connection
implementation("io.socket:socket.io-client:2.1.2") {
implementation(libs.socket.io.client) {
exclude(group: "org.json", module: "json")
}

// Work manager
implementation("androidx.work:work-runtime:2.11.1")
implementation("androidx.work:work-runtime-ktx:2.11.1")

// For animated GIF support
implementation("com.facebook.fresco:fresco:3.6.0")
implementation("com.facebook.fresco:animated-gif:3.6.0")
implementation("com.goterl:lazysodium-android:5.2.0@aar")
implementation("net.java.dev.jna:jna:5.18.1@aar")
implementation("com.apicatalog:copper-multibase:4.1.0")
implementation("org.msgpack:msgpack-core:0.9.12")

implementation("com.google.guava:guava:33.5.0-android")
implementation(project(":react-native-fs"))
implementation(libs.commons.io)
implementation(libs.androidx.appcompat)
implementation(libs.react.android)
implementation(libs.androidx.swiperefreshlayout)
implementation(libs.kotlin.stdlib.jdk7)
implementation(libs.androidx.core.ktx)
implementation(libs.gson)
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.messaging)
implementation(libs.androidx.security.crypto)
implementation(libs.androidx.work.runtime)
implementation(libs.androidx.work.runtime.ktx)
implementation(libs.guava)
implementation(libs.lazysodium.android)
implementation(libs.jna)
implementation(libs.copper.multibase)
implementation(libs.msgpack.core)
}

// Run this once to be able to run the application with BUCK
Expand Down Expand Up @@ -346,19 +315,6 @@ if (googleServicesJsonPath.exists()) {
logger.warn("google-services.json not found in packages/mobile/android/app; Firebase runtime setup will remain incomplete until it is added.")
}

repositories {
mavenCentral()
maven {
name = "Central Portal Snapshots"
url = uri("https://central.sonatype.com/repository/maven/")

// Only search this repository for the specific dependency
content {
includeModule("com.goterl", "lazysodium-java")
}
}
}

tasks.register("CopyNodeProjectAssetsFolder", Copy) {
description = "Copies the Node Project to a build folder for manipulation."

Expand Down Expand Up @@ -420,11 +376,13 @@ tasks.register("GenerateNodeProjectAssetsLists") {
}

project.android.sourceSets.main.assets.srcDirs += "${rootProject.layout.buildDirectory.get()}/nodejs-assets/"

tasks.getByPath(":${project.name}:preBuild").dependsOn GenerateNodeProjectAssetsLists

def abi_name = "arm64"

tasks.named("preBuild") {
dependsOn(tasks.named("GenerateNodeProjectAssetsLists"))
dependsOn("GenerateNodeNativeAssetsLists${abi_name}")
}

tasks.register("GenerateNodeNativeAssetsLists${abi_name}") {
description = "Generates a list for runtime copying"
mkdir("${rootProject.layout.buildDirectory.get()}/nodejs-native-assets/nodejs-native-assets-${abi_name}/")
Expand Down Expand Up @@ -460,6 +418,4 @@ tasks.register("GenerateNodeNativeAssetsLists${abi_name}") {
}
}

tasks.getByPath(":${project.name}:preBuild").dependsOn("GenerateNodeNativeAssetsLists${abi_name}")

project.android.sourceSets.main.assets.srcDirs += "${rootProject.layout.buildDirectory.get()}/nodejs-native-assets/"
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ class BackendWorkManager(private val context: Context) {
}

if (BackendWorker.isShutdownInProgress()) {
Log.i(TAG, "Skipping enqueueRequests because shutdown is in progress: " + BackendWorker.lifecycleSummary())
Log.i(TAG, "Skipping enqueueRequests because shutdown is in progress: ${BackendWorker.lifecycleSummary()}")
return
}

if (BackendWorker.isNodeRuntimeActive() || BackendWorker.isStartupInProgress()) {
Log.i(TAG, "Skipping enqueueRequests because backend lifecycle is active: " + BackendWorker.lifecycleSummary())
Log.i(TAG, "Skipping enqueueRequests because backend lifecycle is active: ${BackendWorker.lifecycleSummary()}")
return
}

if (running || enqueued) {
Log.i(TAG, "Skipping enqueueRequests because matching work already exists running=" + running + " enqueued=" + enqueued)
Log.i(TAG,
"Skipping enqueueRequests because matching work already exists running=$running enqueued=$enqueued"
)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class NotificationHandler(private val context: Context) {
NotificationManagerCompat.from(context.applicationContext)

Log.i(TAG, "Posting group notification group=$group notificationId=$id")
// TODO app crashes if user does not grant permission
notificationManager.notify(id, groupBuilder.build())
}

Expand Down Expand Up @@ -161,6 +162,7 @@ class NotificationHandler(private val context: Context) {
TAG,
"Posting message notification channelId=$channelId notificationId=$id channelName=$channelName",
)
// TODO app crashes if user does not grant permission
notificationManager.notify(id, builder.build())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ object MsgpackDecoder {
}
}

private fun readPositiveIntOrRecord(): Any? {
private fun readPositiveIntOrRecord(): Any {
val value = unpacker.unpackInt()
val record = records[value]
return if (record != null) readRecord(record) else value
Expand Down Expand Up @@ -101,7 +101,7 @@ object MsgpackDecoder {
return MutableList(count) { readValue() }
}

private fun readRecordDefinition(recordId: Int): Any? {
private fun readRecordDefinition(recordId: Int): Any {
val keysValue = readValue() as? List<*>
?: throw IllegalStateException("Invalid msgpackr record definition")
val keys = keysValue.map {
Expand Down
Loading
Loading