Skip to content

Commit

Permalink
squashed: misc fixes, lib patches & upgrades
Browse files Browse the repository at this point in the history
- also removed an un-necessary patch
- build fixes for enabling hermes
- go back to using fork for camera-roll
- fix storage permissions backward compatibility
  • Loading branch information
siddarthkay committed Nov 28, 2023
1 parent 158a15c commit a0c6d4e
Show file tree
Hide file tree
Showing 34 changed files with 3,827 additions and 3,435 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ run-clojure: export TARGET := clojure
run-clojure: ##@run Watch for and build Clojure changes for mobile
yarn shadow-cljs watch mobile

run-metro: export TARGET := clojure
run-metro: export TARGET := android
run-metro: ##@run Start Metro to build React Native changes
@scripts/start-react-native.sh

Expand Down Expand Up @@ -368,7 +368,7 @@ component-test-watch: ##@ Watch tests and re-run no changes to cljs files
@@scripts/check-metro-shadow-process.sh
rm -rf ./component-spec
yarn install
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js' -e cljs
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js --testEnvironment node ' -e cljs

component-test: export TARGET := clojure
component-test: export COMPONENT_TEST := true
Expand All @@ -378,7 +378,7 @@ component-test: ##@test Run component tests once in NodeJS
rm -rf ./component-spec
yarn install
yarn shadow-cljs compile component-test && \
jest --config=test/jest/jest.config.js
jest --clearCache && jest --config=test/jest/jest.config.js --testEnvironment node

#--------------
# Other
Expand Down
54 changes: 19 additions & 35 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,9 @@ apply plugin: "com.facebook.react"

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile
import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy

/*
Enabling Hermes on x86 devices is crashing the app after a few reloads,
this flag can be used to disable Hermes while building app.
https://github.com/status-im/status-mobile/issues/14031
*/

// def disableHermes = System.getenv('DISABLE_HERMES') == 'true'

project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"],
entryFile: "index.js",
/* NOTE: Hermes engine is required for Android 64-bit builds running on 64 devices,
* to guard against a hang in the UI thread after invoking status-go.
* Also a clean and rebuild is required when changing this. */
enableHermes: hermesEnabled.toBoolean(),
/* Disable 'The first definition was here.' warnings */
hermesFlagsRelease: ["-w"],
/* FIXME: Workaround for crash caused by missing libhermes-executor-release.so.
* https://github.com/facebook/react-native/issues/32928 */
deleteDebugFilesForVariant: { false },
enableVmCleanup: false,
bundleInPr: true,
inputExcludes: ["android/**", "ios/**", "react-native/**", "src/**", "test/**"]
]

/*
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
Expand All @@ -53,7 +29,7 @@ react {

/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
nodeExecutableAndArgs = ["node", "--max-old-space-size=16384" ]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
Expand All @@ -79,12 +55,6 @@ react {
// hermesFlags = ["-O", "-output-source-map"]
}


// NOTE: Uncomment if building RN from a fork
// configurations.all {
// exclude group: 'com.facebook.react', module: 'react-native'
// }

/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
Expand Down Expand Up @@ -262,6 +232,23 @@ android {
versionNameSuffix ".pr"
debuggable false
matchingFallbacks = ["release"]
// necessary to make react-native-config's code generation work
resValue "string", "build_config_package", "im.status.ethereum"
}
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:

// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride = versionCodes.get(abi) + defaultConfig.versionCode
}

}
}

Expand All @@ -279,11 +266,8 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
// implementation 'com.facebook.soloader:soloader:0.10.4+'
// implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
implementation "androidx.core:core-splashscreen:1.0.0"


if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
Expand Down
6 changes: 3 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<application
Expand Down
15 changes: 0 additions & 15 deletions android/app/src/main/java/im/status/ethereum/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,6 @@ protected String getMainComponentName() {
return "StatusIm";
}

/**
* Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
* DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
* (aka React 18) with two boolean flags.
*/
/** MainActivity.java:64: error: incompatible types: MainActivity cannot be converted to ReactActivity this, ^
protected ReactActivityDelegate createReactActivityDelegate() {
return new DefaultReactActivityDelegate(
this,
getMainComponentName(),
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
DefaultNewArchitectureEntryPoint.getFabricEnabled()
);
}
*/
private static void registerUncaughtExceptionHandler(final Context context) {
final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
Expand Down
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ allprojects {
flatDir { dirs "libs", System.env.STATUS_GO_ANDROID_LIBDIR }
google()
mavenCentral()
maven { url "https://www.jitpack.io" }
maven { url 'https://mvnrepository.com/artifact/com.github.gundy/semver4j'}
}
}
18 changes: 11 additions & 7 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
# $keytool -genkey -v -keystore ./status-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias status

# Version requirements used throughout the Gradle scripts
kotlinVersion=1.6.20
kotlinVersion=1.7.22
minSdkVersion=24
compileSdkVersion=31
targetSdkVersion=31
buildToolsVersion=31.0.0
compileSdkVersion=33
targetSdkVersion=33
buildToolsVersion=33.0.0
supportLibVersion=28.0.0
# This should match version from nix/mobile/android/maven-and-npm-deps/maven/default.nix
gradlePluginVersion=7.2.2
kotlinPluginVersion=1.6.20
# This should match version from nix/pkgs/aapt2/default.nix
gradlePluginVersion=7.4.2
kotlinPluginVersion=1.7.22

android.useAndroidX=true
android.enableJetifier=true
Expand All @@ -55,3 +55,7 @@ commitHash=unknown
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['react-native-reanimated/plugin', '@babel/plugin-transform-named-capturing-groups-regex','@babel/plugin-proposal-logical-assignment-operators'],
plugins: ['react-native-reanimated/plugin', '@babel/plugin-transform-named-capturing-groups-regex'],
env: {
test: {
presets: [
Expand All @@ -9,7 +9,7 @@ module.exports = {
'@babel/preset-env',
{
targets: {
node: '14',
node: 'current',
},
},
],
Expand Down
5 changes: 2 additions & 3 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ abstract_target 'Status' do
pod 'SSZipArchive', '2.4.3'

permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"

pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone/Permission-Microphone.podspec"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera/Permission-Camera.podspec"
pod "react-native-status-keycard", path: "../node_modules/react-native-status-keycard"
pod "react-native-status", path: "../modules/react-native-status"
pod "Keycard", git: "https://github.com/status-im/Keycard.swift.git"
Expand Down
Loading

0 comments on commit a0c6d4e

Please sign in to comment.