From 4440718e6455bdcb5f7436e68c8aadce033d9783 Mon Sep 17 00:00:00 2001 From: taea Date: Fri, 6 Mar 2026 19:19:58 -0500 Subject: [PATCH 1/3] fix android env var passthrough --- packages/desktop/.env.development | 1 + packages/mobile/.env.development | 1 + packages/mobile/android/app/build.gradle | 6 --- .../com/quietmobile/Backend/BackendWorker.kt | 15 ++++-- .../main/java/com/quietmobile/MainActivity.kt | 49 ++++++++++--------- packages/mobile/package.json | 4 +- 6 files changed, 41 insertions(+), 35 deletions(-) diff --git a/packages/desktop/.env.development b/packages/desktop/.env.development index d1302ca6c2..69254342b9 100644 --- a/packages/desktop/.env.development +++ b/packages/desktop/.env.development @@ -1,6 +1,7 @@ # Node environment COLORIZE=true QSS_ALLOWED=true +QPS_ALLOWED=true QSS_ENDPOINT=ws://127.0.0.1:3003 LOG_TO_FILE=true ENVFILE=.env.development diff --git a/packages/mobile/.env.development b/packages/mobile/.env.development index 6b61adda23..40ea712d18 100644 --- a/packages/mobile/.env.development +++ b/packages/mobile/.env.development @@ -4,3 +4,4 @@ SHOULD_RUN_BACKEND_WORKER=true COLORIZE=false QSS_ALLOWED=true QSS_ENDPOINT=ws://127.0.0.1:3003 +QPS_ALLOWED=true diff --git a/packages/mobile/android/app/build.gradle b/packages/mobile/android/app/build.gradle index 92239d9d49..af22ecd6a0 100644 --- a/packages/mobile/android/app/build.gradle +++ b/packages/mobile/android/app/build.gradle @@ -215,12 +215,6 @@ android { } } } - buildTypes.each { - it.buildConfigField("Boolean", "SHOULD_RUN_BACKEND_WORKER", "true") - it.buildConfigField("Boolean", "QSS_ALLOWED", "false") - it.buildConfigField("String", "QSS_ENDPOINT", "\"\"") - it.buildConfigField("Boolean", "DEBUG", "false") - } buildTypes { debug { signingConfig = signingConfigs.debug diff --git a/packages/mobile/android/app/src/main/java/com/quietmobile/Backend/BackendWorker.kt b/packages/mobile/android/app/src/main/java/com/quietmobile/Backend/BackendWorker.kt index caf815598b..383aea261e 100644 --- a/packages/mobile/android/app/src/main/java/com/quietmobile/Backend/BackendWorker.kt +++ b/packages/mobile/android/app/src/main/java/com/quietmobile/Backend/BackendWorker.kt @@ -232,9 +232,18 @@ class BackendWorker(private val context: Context, workerParams: WorkerParameters command.add(scriptPath) command.addAll(args) - val envVars = mutableListOf() - envVars.add("QSS_ALLOWED=${BuildConfig.QSS_ALLOWED}") - envVars.add("QSS_ENDPOINT=${BuildConfig.QSS_ENDPOINT}") + val standardFields = setOf( + "DEBUG", "APPLICATION_ID", "BUILD_TYPE", "FLAVOR", + "VERSION_CODE", "VERSION_NAME", "LIBRARY_PACKAGE_NAME", + "IS_NEW_ARCHITECTURE_ENABLED", "IS_HERMES_ENABLED" + ) + val envVars = BuildConfig::class.java.fields + .filter { it.name !in standardFields } + .mapNotNull { field -> + field.get(null)?.let { value -> "${field.name}=$value" } + } + .also { vars -> vars.forEach { Log.d("BackendWorker", "Passing env var: $it") } } + .toMutableList() nodeProject.waitForInit() diff --git a/packages/mobile/android/app/src/main/java/com/quietmobile/MainActivity.kt b/packages/mobile/android/app/src/main/java/com/quietmobile/MainActivity.kt index b9a304774a..4989e36652 100644 --- a/packages/mobile/android/app/src/main/java/com/quietmobile/MainActivity.kt +++ b/packages/mobile/android/app/src/main/java/com/quietmobile/MainActivity.kt @@ -35,16 +35,17 @@ class MainActivity : ReactActivity() { * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] */ override fun createReactActivityDelegate(): ReactActivityDelegate = - DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) override fun onCreate(savedInstanceState: Bundle?) { - // pass null to super.onCreate https://github.com/software-mansion/react-native-screens?tab=readme-ov-file#android + // pass null to super.onCreate + // https://github.com/software-mansion/react-native-screens?tab=readme-ov-file#android super.onCreate(null) val intent = intent checkAgainstIntentUpdate(intent) - if (BuildConfig.SHOULD_RUN_BACKEND_WORKER) { + if (BuildConfig.SHOULD_RUN_BACKEND_WORKER == "true") { val context = applicationContext BackendWorkManager(context).enqueueRequests() } @@ -63,16 +64,14 @@ class MainActivity : ReactActivity() { @RequiresApi(Build.VERSION_CODES.TIRAMISU) private fun checkNotificationsPermission() { - if (ContextCompat.checkSelfPermission( - this, - Manifest.permission.POST_NOTIFICATIONS - ) != PackageManager.PERMISSION_GRANTED + if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != + PackageManager.PERMISSION_GRANTED ) { // Requesting the permission ActivityCompat.requestPermissions( - this, - arrayOf(Manifest.permission.POST_NOTIFICATIONS), - NOTIFICATION_PERMISSION_REQUEST_CODE + this, + arrayOf(Manifest.permission.POST_NOTIFICATIONS), + NOTIFICATION_PERMISSION_REQUEST_CODE ) } } @@ -103,12 +102,13 @@ class MainActivity : ReactActivity() { @Throws(java.lang.Exception::class) private fun respondOnNotification(bundle: Bundle) { - val channel = bundle.getString("channel") - ?: throw java.lang.Exception("respondOnNotification() failed because of missing channel") + val channel = + bundle.getString("channel") + ?: throw java.lang.Exception( + "respondOnNotification() failed because of missing channel" + ) - getCurrentReactContext { context: ReactContext -> - emitSwitchChannelEvent(context, channel) - } + getCurrentReactContext { context: ReactContext -> emitSwitchChannelEvent(context, channel) } } @SuppressLint("VisibleForTests") @@ -117,19 +117,20 @@ class MainActivity : ReactActivity() { if (null != reactContext) { callback(reactContext) } else { - reactInstanceManager.addReactInstanceEventListener(object : ReactInstanceEventListener { - override fun onReactContextInitialized(context: ReactContext) { - callback(context) - reactInstanceManager.removeReactInstanceEventListener(this) - } - }) + reactInstanceManager.addReactInstanceEventListener( + object : ReactInstanceEventListener { + override fun onReactContextInitialized(context: ReactContext) { + callback(context) + reactInstanceManager.removeReactInstanceEventListener(this) + } + } + ) } } private fun emitSwitchChannelEvent(reactContext: ReactContext, channel: String) { - val deviceEventEmitter: RCTDeviceEventEmitter = reactContext.getJSModule( - RCTDeviceEventEmitter::class.java - ) + val deviceEventEmitter: RCTDeviceEventEmitter = + reactContext.getJSModule(RCTDeviceEventEmitter::class.java) deviceEventEmitter.emit("notification", channel) } diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 9ffec91b3f..653c540f25 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -3,9 +3,9 @@ "version": "7.0.0", "scripts": { "build": "tsc -p tsconfig.build.json --noEmit", - "storybook-android": "ENVFILE=.env.storybook react-native run-android --mode=storybookDebug --appIdSuffix=storybook.debug", + "storybook-android": "react-native run-android --mode=storybookDebug --appIdSuffix=storybook.debug", "storybook-ios": "ENVFILE=.env.storybook react-native run-ios", - "android": "ENVFILE=.env.development react-native run-android --mode=standardDebug --appIdSuffix=debug", + "android": "react-native run-android --mode=standardDebug --appIdSuffix=debug", "ios": "ENVFILE=.env.development react-native run-ios", "start": "react-native start", "test": "TZ=UTC jest --testPathIgnorePatterns=\"./e2e\" --transformIgnorePatterns \"./node_modules/(?!@d11/react-native-fast-image)/\"", From 8d49a5bda61e3b6bfb904fb4c9e347d3c11ace5f Mon Sep 17 00:00:00 2001 From: taea Date: Fri, 6 Mar 2026 19:20:09 -0500 Subject: [PATCH 2/3] fix android studio build --- packages/mobile/android/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/mobile/android/build.gradle b/packages/mobile/android/build.gradle index 76282e953e..f813929859 100644 --- a/packages/mobile/android/build.gradle +++ b/packages/mobile/android/build.gradle @@ -37,3 +37,7 @@ allprojects { } apply plugin: "com.facebook.react.rootproject" + +ext { + REACT_NATIVE_NODE_MODULES_DIR = file("$rootDir/../node_modules/react-native") +} From c3403ed105e85a219642f7a02ed3f994ce72adf9 Mon Sep 17 00:00:00 2001 From: taea Date: Fri, 6 Mar 2026 19:20:34 -0500 Subject: [PATCH 3/3] fix ios crash on captcha --- .../drawers/Captcha.drawer.tsx | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/packages/mobile/src/components/ModalBottomDrawer/drawers/Captcha.drawer.tsx b/packages/mobile/src/components/ModalBottomDrawer/drawers/Captcha.drawer.tsx index d8eeef4993..69a904bf8b 100644 --- a/packages/mobile/src/components/ModalBottomDrawer/drawers/Captcha.drawer.tsx +++ b/packages/mobile/src/components/ModalBottomDrawer/drawers/Captcha.drawer.tsx @@ -130,35 +130,39 @@ export const CaptchaDrawer: FC = () => { ) return ( - - - - Prove you are human - Complete the challenge to continue. - {status === 'loading' && ( - - - Loading challenge… - - )} - {errorMessage && ( - - {errorMessage} - - Try again - - - )} - closeScreen('Captcha screen cancelled via button')} - style={styles.cancelButton} - > - Cancel - + <> + + + + Prove you are human + Complete the challenge to continue. + {status === 'loading' && ( + + + Loading challenge… + + )} + {errorMessage && ( + + {errorMessage} + + Try again + + + )} + closeScreen('Captcha screen cancelled via button')} + style={styles.cancelButton} + > + Cancel + + + + {siteKey !== '' && ( - - + )} + ) }