diff --git a/android/app/build.gradle b/android/app/build.gradle index ac4c10df0..3ede227be 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -211,9 +211,9 @@ dependencies { // implementation "androidx.core:core-splashscreen:1.0.0" playImplementation project(':react-native-notifications') // playImplementation 'com.google.firebase:firebase-core:16.0.0' - // playImplementation project(':@react-native-firebase_app') - // playImplementation project(':@react-native-firebase_analytics') - // playImplementation project(':@react-native-firebase_crashlytics') + playImplementation project(':@react-native-firebase_app') + playImplementation project(':@react-native-firebase_analytics') + playImplementation project(':@react-native-firebase_crashlytics') implementation "com.google.code.gson:gson:2.8.9" implementation "com.github.bumptech.glide:glide:4.9.0" diff --git a/android/app/src/main/java/chat/rocket/reactnative/MainApplication.kt b/android/app/src/main/java/chat/rocket/reactnative/MainApplication.kt index 9b708c7fc..3a0029f27 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/MainApplication.kt +++ b/android/app/src/main/java/chat/rocket/reactnative/MainApplication.kt @@ -19,7 +19,8 @@ import chat.rocket.reactnative.networking.SSLPinningPackage; import com.reactnativecommunity.viewpager.RNCViewPagerPackage; import android.content.res.Configuration; -class MainApplication : Application(), ReactApplication { +open class MainApplication : Application(), ReactApplication { + override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { @@ -28,6 +29,7 @@ class MainApplication : Application(), ReactApplication { // Packages that cannot be autolinked yet can be added manually here, for example: add(RNCViewPagerPackage()) add(SSLPinningPackage()) + addAll(AdditionalModules().getAdditionalModules()) } override fun getJSMainModuleName(): String = "index" diff --git a/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java b/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java index aad807859..e9629acac 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java +++ b/android/app/src/main/java/chat/rocket/reactnative/networking/SSLPinningModule.java @@ -6,7 +6,7 @@ import com.facebook.react.modules.network.NetworkingModule; import com.facebook.react.modules.network.CustomClientBuilder; import com.facebook.react.modules.network.ReactCookieJarContainer; import com.facebook.react.modules.websocket.WebSocketModule; -import com.facebook.react.modules.fresco.ReactOkHttpNetworkFetcher; +// import com.facebook.react.modules.fresco.ReactOkHttpNetworkFetcher; import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.Promise; @@ -103,9 +103,9 @@ public class SSLPinningModule extends ReactContextBaseJavaModule implements KeyC // Websocket react-native layer WebSocketModule.setCustomClientBuilder(new CustomClient()); // Image networking react-native layer - ReactOkHttpNetworkFetcher.setOkHttpClient(getOkHttpClient()); + // ReactOkHttpNetworkFetcher.setOkHttpClient(getOkHttpClient()); // RNFetchBlob networking layer - RNFetchBlob.applyCustomOkHttpClient(getOkHttpClient()); + // RNFetchBlob.applyCustomOkHttpClient(getOkHttpClient()); // RNCWebView onReceivedClientCertRequest RNCWebViewManager.setCertificateAlias(data); // FastImage Glide network layer diff --git a/android/app/src/play/java/chat/rocket/reactnative/AdditionalModules.java b/android/app/src/play/java/chat/rocket/reactnative/AdditionalModules.java index 5a32de49e..827acacda 100644 --- a/android/app/src/play/java/chat/rocket/reactnative/AdditionalModules.java +++ b/android/app/src/play/java/chat/rocket/reactnative/AdditionalModules.java @@ -1,7 +1,5 @@ package chat.rocket.reactnative; -import android.app.Application; - import com.facebook.react.ReactPackage; import java.util.Arrays; @@ -12,7 +10,7 @@ import io.invertase.firebase.app.ReactNativeFirebaseAppPackage; import io.invertase.firebase.crashlytics.ReactNativeFirebaseCrashlyticsPackage; public class AdditionalModules { - public List getAdditionalModules(Application application) { + public List getAdditionalModules() { return Arrays.asList( new ReactNativeFirebaseAnalyticsPackage(), new ReactNativeFirebaseAppPackage(), diff --git a/android/app/src/play/java/chat/rocket/reactnative/Encryption.java b/android/app/src/play/java/chat/rocket/reactnative/Encryption.java index 9b3857a69..7ddab1979 100644 --- a/android/app/src/play/java/chat/rocket/reactnative/Encryption.java +++ b/android/app/src/play/java/chat/rocket/reactnative/Encryption.java @@ -1,6 +1,7 @@ package chat.rocket.reactnative; import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; import android.util.Base64; import android.util.Log; @@ -80,7 +81,7 @@ class Encryption { dbName += "-experimental"; } dbName += ".db"; - Database database = new Database(dbName, reactContext); + Database database = new Database(dbName, reactContext, SQLiteDatabase.CREATE_IF_NECESSARY); String[] query = {ejson.rid}; Cursor cursor = database.rawQuery("select * from subscriptions where id == ? limit 1", query); diff --git a/package.json b/package.json index e4d4f9d32..88a75064b 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "lint": "eslint . && tsc", "prettier-lint": "prettier --write . && yarn lint", "ios": "npx react-native run-ios", - "android": "npx react-native run-android --variant=experimentalPlayDebug", - "android-whitelabel": "npx react-native run-android --main-activity chat.rocket.reactnative.MainActivity --variant=experimentalPlayDebug --appId", + "android": "npx react-native run-android --mode=experimentalPlayDebug", + "android-whitelabel": "npx react-native run-android --main-activity chat.rocket.reactnative.MainActivity --mode=experimentalPlayDebug --appId", "log-android": "react-native log-android", "snyk-protect": "snyk protect", "generate-source-maps-ios": "react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios-release.bundle --sourcemap-output ios-release.bundle.map",