mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-24 04:24:52 +08:00
Refactor into monorepo for v6 (#1837)
> You can [learn more about this here](https://blog.invertase.io/react-native-firebase-2019-7e334ca9bcc6).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
apply plugin: "com.android.application"
|
||||
apply plugin: "com.google.firebase.firebase-perf"
|
||||
apply plugin: 'io.fabric'
|
||||
//apply plugin: "com.google.firebase.firebase-perf"
|
||||
//apply plugin: 'io.fabric'
|
||||
|
||||
import com.android.build.OutputFile
|
||||
|
||||
@@ -8,17 +8,18 @@ project.ext.react = [
|
||||
entryFile: "index.js"
|
||||
]
|
||||
|
||||
// up to mono root
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
|
||||
def enableSeparateBuildPerCPUArchitecture = false
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
compileSdkVersion 28
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.testing"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 27
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
@@ -26,8 +27,8 @@ android {
|
||||
}
|
||||
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
missingDimensionStrategy "minReactNative", "minReactNative46"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
}
|
||||
splits {
|
||||
@@ -51,6 +52,10 @@ android {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
signingConfig signingConfigs.release
|
||||
matchingFallbacks = ['release']
|
||||
}
|
||||
debug {
|
||||
matchingFallbacks = ['debug']
|
||||
}
|
||||
}
|
||||
// applicationVariants are e.g. debug, release
|
||||
@@ -68,6 +73,7 @@ android {
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/-no-jdk.kotlin_module'
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
exclude 'META-INF/NOTICE'
|
||||
exclude 'META-INF/LICENSE'
|
||||
@@ -81,73 +87,23 @@ dependencies {
|
||||
implementation "com.facebook.react:react-native:+"
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
|
||||
|
||||
|
||||
/* ----------------------------
|
||||
* REACT NATIVE FIREBASE
|
||||
* ---------------------------- */
|
||||
|
||||
// Library as defined in settings.gradle
|
||||
implementation project(path: ':react-native-firebase', configuration: 'default')
|
||||
// Required dependencies
|
||||
//noinspection GradleCompatible
|
||||
implementation "com.google.firebase:firebase-core:16.0.6"
|
||||
implementation "com.google.android.gms:play-services-base:16.0.1"
|
||||
|
||||
/* -------------------------
|
||||
* OPTIONAL FIREBASE SDKS
|
||||
* ------------------------- */
|
||||
|
||||
implementation('com.google.firebase:firebase-ads:15.0.1') {
|
||||
// exclude `customtabs` as the support lib version is out of date
|
||||
// we manually add it as a dependency below with a custom version
|
||||
exclude group: 'com.android.support', module: 'customtabs'
|
||||
}
|
||||
|
||||
// Authentication
|
||||
implementation "com.google.firebase:firebase-auth:16.1.0"
|
||||
// Analytics
|
||||
implementation "com.google.firebase:firebase-analytics:16.0.6"
|
||||
// Performance Monitoring
|
||||
implementation "com.google.firebase:firebase-perf:16.2.3"
|
||||
// Remote Config
|
||||
implementation "com.google.firebase:firebase-config:16.1.2"
|
||||
// Cloud Storage
|
||||
implementation "com.google.firebase:firebase-storage:16.0.5"
|
||||
// Invites
|
||||
implementation "com.google.firebase:firebase-invites:16.0.6"
|
||||
// Dynamic Links
|
||||
implementation "com.google.firebase:firebase-dynamic-links:16.1.5"
|
||||
// Real-time Database
|
||||
implementation "com.google.firebase:firebase-database:16.0.5"
|
||||
// Cloud Functions
|
||||
implementation "com.google.firebase:firebase-functions:16.1.3"
|
||||
// Cloud Firestore
|
||||
implementation "com.google.firebase:firebase-firestore:17.1.5"
|
||||
// Cloud Messaging / FCM
|
||||
implementation "com.google.firebase:firebase-messaging:17.3.4"
|
||||
// Crashlytics
|
||||
implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
|
||||
transitive = true
|
||||
}
|
||||
|
||||
/* --------------------------------
|
||||
* OPTIONAL SUPPORT LIBS
|
||||
* -------------------------------- */
|
||||
|
||||
// For Firebase Ads
|
||||
implementation "com.android.support:customtabs:27.1.1"
|
||||
|
||||
// For React Native Firebase Notifications
|
||||
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
|
||||
// Libraries as defined in settings.gradle
|
||||
implementation project(path: ':@react-native-firebase/app')
|
||||
implementation project(path: ':@react-native-firebase/analytics')
|
||||
implementation project(path: ':@react-native-firebase/functions')
|
||||
|
||||
/* ------------------------
|
||||
* TESTING SDKS/LIBRARIES
|
||||
* ------------------------ */
|
||||
implementation(project(path: ':jet', configuration: 'default')) {
|
||||
implementation(project(path: ':jet')) {
|
||||
transitive = false
|
||||
}
|
||||
androidTestImplementation(project(path: ":detox"))
|
||||
|
||||
androidTestImplementation project(path: ":detox")
|
||||
androidTestImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test:rules:1.0.2'
|
||||
|
||||
@@ -16,18 +16,25 @@
|
||||
android:name="com.testing.MainApplication"
|
||||
android:allowBackup="false"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/AppTheme">
|
||||
<service
|
||||
android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
tools:ignore="ExportedService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<provider
|
||||
android:name="com.google.firebase.provider.FirebaseInitProvider"
|
||||
android:authorities="${applicationId}.firebaseinitprovider"
|
||||
tools:node="remove"
|
||||
/>
|
||||
|
||||
<!--<service-->
|
||||
<!--android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService"-->
|
||||
<!--android:enabled="true"-->
|
||||
<!--android:exported="true"-->
|
||||
<!--tools:ignore="ExportedService">-->
|
||||
<!--<intent-filter>-->
|
||||
<!--<action android:name="com.google.firebase.MESSAGING_EVENT" />-->
|
||||
<!--</intent-filter>-->
|
||||
<!--</service>-->
|
||||
|
||||
<!--<service-->
|
||||
<!--android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService"-->
|
||||
@@ -37,21 +44,21 @@
|
||||
<!--</intent-filter>-->
|
||||
<!--</service>-->
|
||||
|
||||
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
|
||||
<!--<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />-->
|
||||
|
||||
<receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver" />
|
||||
<receiver
|
||||
android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
||||
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
|
||||
<!--<receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver" />-->
|
||||
<!--<receiver-->
|
||||
<!--android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver"-->
|
||||
<!--android:enabled="true"-->
|
||||
<!--android:exported="true">-->
|
||||
<!--<intent-filter>-->
|
||||
<!--<action android:name="android.intent.action.BOOT_COMPLETED" />-->
|
||||
<!--<action android:name="android.intent.action.QUICKBOOT_POWERON" />-->
|
||||
<!--<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />-->
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!--<category android:name="android.intent.category.DEFAULT" />-->
|
||||
<!--</intent-filter>-->
|
||||
<!--</receiver>-->
|
||||
|
||||
|
||||
<activity
|
||||
|
||||
@@ -9,6 +9,8 @@ import android.provider.Settings;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
|
||||
import io.invertase.firebase.app.ReactNativeFirebaseApp;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
|
||||
public static final int PERMISSION_REQ_CODE = 1234;
|
||||
|
||||
@@ -9,28 +9,15 @@ import com.facebook.react.devsupport.DevInternalSettings;
|
||||
import com.facebook.react.shell.MainReactPackage;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
|
||||
import io.invertase.jet.JetPackage;
|
||||
import io.invertase.firebase.RNFirebasePackage;
|
||||
import io.invertase.firebase.admob.RNFirebaseAdMobPackage;
|
||||
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;
|
||||
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
|
||||
import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage;
|
||||
import io.invertase.firebase.database.RNFirebaseDatabasePackage;
|
||||
import io.invertase.firebase.fabric.crashlytics.RNFirebaseCrashlyticsPackage;
|
||||
import io.invertase.firebase.firestore.RNFirebaseFirestorePackage;
|
||||
import io.invertase.firebase.functions.RNFirebaseFunctionsPackage;
|
||||
import io.invertase.firebase.instanceid.RNFirebaseInstanceIdPackage;
|
||||
import io.invertase.firebase.invites.RNFirebaseInvitesPackage;
|
||||
//import io.invertase.firebase.links.RNFirebaseLinksPackage;
|
||||
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
|
||||
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
|
||||
import io.invertase.firebase.perf.RNFirebasePerformancePackage;
|
||||
import io.invertase.firebase.storage.RNFirebaseStoragePackage;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage;
|
||||
import io.invertase.firebase.app.ReactNativeFirebaseApp;
|
||||
import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;
|
||||
import io.invertase.firebase.functions.ReactNativeFirebaseFunctionsPackage;
|
||||
import io.invertase.jet.JetPackage;
|
||||
|
||||
public class MainApplication extends Application implements ReactApplication {
|
||||
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
||||
@Override
|
||||
@@ -40,25 +27,12 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
return Arrays.<ReactPackage>asList(
|
||||
return Arrays.asList(
|
||||
new MainReactPackage(),
|
||||
new JetPackage(),
|
||||
new RNFirebasePackage(),
|
||||
new RNFirebaseAdMobPackage(),
|
||||
new RNFirebaseAnalyticsPackage(),
|
||||
new RNFirebaseAuthPackage(),
|
||||
new RNFirebaseRemoteConfigPackage(),
|
||||
new RNFirebaseCrashlyticsPackage(),
|
||||
new RNFirebaseDatabasePackage(),
|
||||
new RNFirebaseFirestorePackage(),
|
||||
new RNFirebaseFunctionsPackage(),
|
||||
new RNFirebaseInstanceIdPackage(),
|
||||
new RNFirebaseInvitesPackage(),
|
||||
// new RNFirebaseLinksPackage(),
|
||||
new RNFirebaseMessagingPackage(),
|
||||
new RNFirebaseNotificationsPackage(),
|
||||
new RNFirebasePerformancePackage(),
|
||||
new RNFirebaseStoragePackage()
|
||||
new ReactNativeFirebaseAppPackage(),
|
||||
new ReactNativeFirebaseAnalyticsPackage(),
|
||||
new ReactNativeFirebaseFunctionsPackage()
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -71,14 +45,18 @@ public class MainApplication extends Application implements ReactApplication {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
ReactNativeFirebaseApp.initializeSecondaryApp("secondaryFromNative");
|
||||
|
||||
// TODO move to jet
|
||||
DevInternalSettings settings = (DevInternalSettings) getReactNativeHost().getReactInstanceManager().getDevSupportManager().getDevSettings();
|
||||
DevInternalSettings settings = (DevInternalSettings) getReactNativeHost()
|
||||
.getReactInstanceManager()
|
||||
.getDevSupportManager()
|
||||
.getDevSettings();
|
||||
|
||||
if (settings != null) {
|
||||
settings.setBundleDeltasEnabled(false);
|
||||
}
|
||||
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
SoLoader.init(this, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user