diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 7fa45754d..000000000 --- a/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": ["module:metro-react-native-babel-preset"], - "plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]], - "env": { - "production": { - "plugins": ["transform-remove-console"] - } - } -} diff --git a/.circleci/config.yml b/.circleci/config.yml index 8e1745caa..ecf37450e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -106,8 +106,10 @@ jobs: environment: # GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError" - GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false - JVM_OPTS: -Xmx4096m + # GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false + # JVM_OPTS: -Xmx4096m + JAVA_OPTS: '-Xms512m -Xmx2g' + GRADLE_OPTS: '-Xmx3g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"' TERM: dumb BASH_ENV: "~/.nvm/nvm.sh" @@ -133,7 +135,9 @@ jobs: cd android echo -e "" > ./gradle.properties - echo -e "android.enableAapt2=false" >> ./gradle.properties + # echo -e "android.enableAapt2=false" >> ./gradle.properties + echo -e "android.useAndroidX=true" >> ./gradle.properties + echo -e "android.enableJetifier=true" >> ./gradle.properties if [[ $KEYSTORE ]]; then echo $KEYSTORE_BASE64 | base64 --decode > ./app/$KEYSTORE @@ -154,6 +158,7 @@ jobs: - run: name: Build Android App command: | + npx jetify cd android if [[ $KEYSTORE ]]; then ./gradlew bundleRelease diff --git a/.eslintrc.js b/.eslintrc.js index b1eb0bc83..8548429f6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -46,6 +46,7 @@ module.exports = { "jsx-quotes": [2, "prefer-single"], "jsx-a11y/href-no-hash": 0, "import/prefer-default-export": 0, + "import/no-cycle": 0, "camelcase": 0, "no-underscore-dangle": 0, "no-return-assign": 0, diff --git a/README.md b/README.md index 2883ffe23..416379bf5 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,10 @@ Readme will guide you on how to config. 1) Jitsi integration 2) Notification Preferences 3) Two-way authentication -4) Authentication via SAML -5) Authentication via Custom OAuth -6) Authentication via CAS -7) Bugsnag -8) Optional Analytics -9) Typescript -10) Prettier +4) Bugsnag +5) Optional Analytics +6) Typescript +7) Prettier ## Features | Feature | Status | @@ -89,8 +86,8 @@ Readme will guide you on how to config. | Tablet Support | ❌ | | Read receipt | ✅ | | Broadbast Channel | ✅ | -| Authentication via SAML | ❌ | -| Authentication via CAS | ❌ | +| Authentication via SAML | ✅ | +| Authentication via CAS | ✅ | | Custom Fields on Signup | ✅ | | Report message | ✅ | | Theming | ❌ | @@ -110,7 +107,7 @@ Readme will guide you on how to config. | Accessibility (Advanced) | ❌ | | Authentication via Meteor | ❌ | | Authentication via Wordpress | ❌ | -| Authentication via Custom OAuth | ❌ | +| Authentication via Custom OAuth | ✅ | | Add user to the room | ✅ | | Send message | ✅ | | Authentication via Email | ✅ | diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index c2c7e00df..e95058caa 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -34,7 +34,9 @@ exports[`Storyshots Message list 1`] = ` variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: - // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits - def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] + // 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 = @@ -158,6 +178,15 @@ android { } } + packagingOptions { + pickFirst '**/armeabi-v7a/libc++_shared.so' + pickFirst '**/x86/libc++_shared.so' + pickFirst '**/arm64-v8a/libc++_shared.so' + pickFirst '**/x86_64/libc++_shared.so' + pickFirst '**/x86/libjsc.so' + pickFirst '**/armeabi-v7a/libjsc.so' + } + bundle { language { enableSplit = false @@ -173,46 +202,24 @@ android { dependencies { addUnimodulesDependencies() - implementation "org.webkit:android-jsc:r241213" - implementation project(':rn-extensions-share') - implementation project(':rn-fetch-blob') - implementation project(':react-native-document-picker') - implementation project(':react-native-firebase') - implementation project(':react-native-webview') - implementation project(':react-native-orientation-locker') - implementation project(':react-native-splash-screen') - implementation project(':react-native-screens') - implementation project(':react-native-action-sheet') - implementation(project(":react-native-device-info"), { - exclude group: "com.google.android.gms" - }) - implementation project(':react-native-gesture-handler') - implementation project(':react-native-image-crop-picker') - implementation project(':react-native-localize') - implementation project(':react-native-audio') - implementation project(":reactnativekeyboardinput") - implementation project(':react-native-video') - implementation project(':react-native-vector-icons') - implementation project(':react-native-fast-image') - implementation project(':realm') implementation project(':reactnativenotifications') + implementation project(":reactnativekeyboardinput") implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "com.android.support:appcompat-v7:${ rootProject.ext.supportLibVersion }" - implementation "com.android.support:support-v4:${ rootProject.ext.supportLibVersion }" - implementation "com.android.support:customtabs:${ rootProject.ext.supportLibVersion }" - implementation "com.android.support:design:${ rootProject.ext.supportLibVersion }" implementation "com.facebook.react:react-native:+" // From node_modules - implementation 'com.facebook.fresco:fresco:1.10.0' - implementation 'com.facebook.fresco:animated-gif:1.10.0' - implementation 'com.facebook.fresco:animated-webp:1.10.0' - implementation 'com.facebook.fresco:webpsupport:1.10.0' - implementation "com.google.android.gms:play-services-base:16.1.0" implementation "com.google.firebase:firebase-messaging:18.0.0" implementation "com.google.firebase:firebase-core:16.0.9" - implementation "com.google.firebase:firebase-perf:16.2.5" - implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') { + implementation "com.google.firebase:firebase-perf:17.0.2" + implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') { transitive = true } + + if (enableHermes) { + def hermesPath = "../../node_modules/hermesvm/android/"; + debugImplementation files(hermesPath + "hermes-debug.aar") + releaseImplementation files(hermesPath + "hermes-release.aar") + } else { + implementation jscFlavor + } } // Run this once to be able to run the application with BUCK @@ -223,3 +230,4 @@ task copyDownloadableDepsToLibs(type: Copy) { } apply plugin: 'com.google.gms.google-services' +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) \ No newline at end of file diff --git a/android/app/build_defs.bzl b/android/app/build_defs.bzl new file mode 100644 index 000000000..fff270f8d --- /dev/null +++ b/android/app/build_defs.bzl @@ -0,0 +1,19 @@ +"""Helper definitions to glob .aar and .jar targets""" + +def create_aar_targets(aarfiles): + for aarfile in aarfiles: + name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] + lib_deps.append(":" + name) + android_prebuilt_aar( + name = name, + aar = aarfile, + ) + +def create_jar_targets(jarfiles): + for jarfile in jarfiles: + name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] + lib_deps.append(":" + name) + prebuilt_jar( + name = name, + binary_jar = jarfile, + ) diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 8b9246863..11b025724 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -8,91 +8,3 @@ # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Disabling obfuscation is useful if you collect stack traces from production crashes -# (unless you are using a system that supports de-obfuscate the stack traces). -# -dontobfuscate - -# React Native - -# Keep our interfaces so they can be used by other ProGuard rules. -# See http://sourceforge.net/p/proguard/bugs/466/ --keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip --keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters --keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip - -# Do not strip any method/class that is annotated with @DoNotStrip --keep @com.facebook.proguard.annotations.DoNotStrip class * --keep @com.facebook.common.internal.DoNotStrip class * --keepclassmembers class * { - @com.facebook.proguard.annotations.DoNotStrip *; - @com.facebook.common.internal.DoNotStrip *; -} - --keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { - void set*(***); - *** get*(); -} - --keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } --keep class * extends com.facebook.react.bridge.NativeModule { *; } --keepclassmembers,includedescriptorclasses class * { native ; } --keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } - --dontwarn com.facebook.react.** --keep,includedescriptorclasses class com.facebook.react.bridge.** { *; } - -# TextLayoutBuilder uses a non-public Android constructor within StaticLayout. -# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. --dontwarn android.text.StaticLayout - -# okhttp - --keepattributes Signature --keepattributes *Annotation* --keep class okhttp3.** { *; } --keep interface okhttp3.** { *; } --dontwarn okhttp3.** - -# okio - --keep class sun.misc.Unsafe { *; } --dontwarn java.nio.file.* --dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement --dontwarn okio.** - -# Fresco -# Keep our interfaces so they can be used by other ProGuard rules. -# See http://sourceforge.net/p/proguard/bugs/466/ --keep,allowobfuscation @interface com.facebook.soloader.DoNotOptimize - -# Do not strip any method/class that is annotated with @DoNotOptimize --keep @com.facebook.soloader.DoNotOptimize class * --keepclassmembers class * { - @com.facebook.soloader.DoNotOptimize *; -} - -# Keep native methods --keepclassmembers class * { - native ; -} - -# For Fabric to properly de-obfuscate your crash reports, you need to remove this line from your ProGuard config: -# -printmapping mapping.txt --keepattributes SourceFile,LineNumberTable --keep public class * extends java.lang.Exception --keep class com.crashlytics.** { *; } --dontwarn com.crashlytics.** - - --dontwarn javax.annotation.** --dontwarn com.facebook.infer.** diff --git a/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java b/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java index 687fa2cd4..e4a8c2276 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java +++ b/android/app/src/main/java/chat/rocket/reactnative/MainActivity.java @@ -36,6 +36,7 @@ public class MainActivity extends ReactFragmentActivity { }; } + // from react-native-orientation @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); diff --git a/android/app/src/main/java/chat/rocket/reactnative/MainApplication.java b/android/app/src/main/java/chat/rocket/reactnative/MainApplication.java index 89c788f32..5640f910b 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/MainApplication.java +++ b/android/app/src/main/java/chat/rocket/reactnative/MainApplication.java @@ -1,50 +1,35 @@ package chat.rocket.reactnative; import android.app.Application; +import android.util.Log; +import android.content.Context; +import android.os.Bundle; +import com.facebook.react.PackageList; +import com.facebook.hermes.reactexecutor.HermesExecutorFactory; +import com.facebook.react.bridge.JavaScriptExecutorFactory; import com.facebook.react.ReactApplication; -import io.github.elyx0.reactnativedocumentpicker.DocumentPickerPackage; -import io.invertase.firebase.RNFirebasePackage; -import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage; -import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage; -import io.invertase.firebase.perf.RNFirebasePerformancePackage; -import com.reactnativecommunity.webview.RNCWebViewPackage; -import org.wonday.orientation.OrientationPackage; -import org.devio.rn.splashscreen.SplashScreenReactPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; -import com.reactcommunity.rnlocalize.RNLocalizePackage; -import com.reactnative.ivpusic.imagepicker.PickerPackage; -import com.brentvatne.react.ReactVideoPackage; -import com.dylanvann.fastimage.FastImageViewPackage; -import com.oblador.vectoricons.VectorIconsPackage; -import com.rnim.rn.audio.ReactNativeAudioPackage; -import com.wix.reactnativekeyboardinput.KeyboardInputPackage; -import com.wix.reactnativenotifications.RNNotificationsPackage; -import com.wix.reactnativenotifications.core.AppLaunchHelper; -import com.wix.reactnativenotifications.core.AppLifecycleFacade; -import com.wix.reactnativenotifications.core.JsIOHelper; -import com.wix.reactnativenotifications.core.notification.INotificationsApplication; -import com.wix.reactnativenotifications.core.notification.IPushNotification; -import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; -import com.learnium.RNDeviceInfo.RNDeviceInfo; -import com.actionsheet.ActionSheetPackage; -import io.realm.react.RealmReactPackage; -import com.swmansion.rnscreens.RNScreensPackage; -import chat.rocket.SharePackage; -import com.RNFetchBlob.RNFetchBlobPackage; - import chat.rocket.reactnative.generated.BasePackageList; import org.unimodules.adapters.react.ModuleRegistryAdapter; import org.unimodules.adapters.react.ReactModuleRegistryProvider; import org.unimodules.core.interfaces.SingletonModule; -import android.content.Context; -import android.os.Bundle; +import com.wix.reactnativenotifications.RNNotificationsPackage; +import com.wix.reactnativenotifications.core.AppLaunchHelper; +import com.wix.reactnativenotifications.core.AppLifecycleFacade; +import com.wix.reactnativenotifications.core.JsIOHelper; +import com.wix.reactnativenotifications.core.notification.INotificationsApplication; +import com.wix.reactnativenotifications.core.notification.IPushNotification; +import com.wix.reactnativekeyboardinput.KeyboardInputPackage; + +import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage; +import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage; +import io.invertase.firebase.perf.RNFirebasePerformancePackage; import java.util.Arrays; import java.util.List; @@ -61,33 +46,15 @@ public class MainApplication extends Application implements ReactApplication, IN @Override protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new DocumentPickerPackage(), - new RNFirebasePackage(), - new RNFirebaseCrashlyticsPackage(), - new RNFirebaseAnalyticsPackage(), - new RNFirebasePerformancePackage(), - new RNCWebViewPackage(), - new OrientationPackage(), - new SplashScreenReactPackage(), - new SharePackage(), - new RNFetchBlobPackage(), - new RNGestureHandlerPackage(), - new RNScreensPackage(), - new ActionSheetPackage(), - new RNDeviceInfo(), - new PickerPackage(), - new VectorIconsPackage(), - new RealmReactPackage(), - new ReactVideoPackage(), - new ReactNativeAudioPackage(), - new KeyboardInputPackage(MainApplication.this), - new FastImageViewPackage(), - new RNLocalizePackage(), - new RNNotificationsPackage(MainApplication.this), - new ModuleRegistryAdapter(mModuleRegistryProvider) - ); + @SuppressWarnings("UnnecessaryLocalVariable") + List packages = new PackageList(this).getPackages(); + packages.add(new RNFirebaseCrashlyticsPackage()); + packages.add(new RNFirebaseAnalyticsPackage()); + packages.add(new RNFirebasePerformancePackage()); + packages.add(new KeyboardInputPackage(MainApplication.this)); + packages.add(new RNNotificationsPackage(MainApplication.this)); + packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider)); + return packages; } @Override diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 28c600d30..fdfc9173c 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,6 +1,7 @@