Skip to content

Commit 7851171

Browse files
kroikieSalakar
andauthored
chore(firebase_in_app_messaging): migrate to new firebase_core plugin (#3102)
Co-authored-by: Mike Diarmid <mike.diarmid@gmail.com>
1 parent 1f78d2b commit 7851171

File tree

12 files changed

+89
-95
lines changed

12 files changed

+89
-95
lines changed

packages/firebase_in_app_messaging/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 0.2.0-dev.1
2+
3+
* Depend on `firebase_core` pre-release.
4+
* Firebase iOS SDK versions are now locked to use the same version defined in
5+
`firebase_core`.
6+
* Firebase Android SDK versions are now using the Firebase Bill of Materials (BoM)
7+
to specify individual SDK versions. BoM version is also sourced from
8+
`firebase_core`.
9+
* Allow iOS to be imported as a module.
10+
* Updated package of Android from `com.example.firebase_in_app_messaging` to
11+
`io.flutter.plugins.firebase.inappmessaging`.
12+
113
## 0.1.2
214

315
* Update lower bound of dart dependency to 2.0.0.

packages/firebase_in_app_messaging/android/build.gradle

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.4.2'
11+
classpath 'com.android.tools.build:gradle:3.5.0'
1212
}
1313
}
1414

@@ -21,6 +21,19 @@ rootProject.allprojects {
2121

2222
apply plugin: 'com.android.library'
2323

24+
def firebaseCoreProject = findProject(':firebase_core')
25+
if (firebaseCoreProject == null) {
26+
throw new GradleException('Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?')
27+
} else if (!firebaseCoreProject.properties['FirebaseSDKVersion']) {
28+
throw new GradleException('A newer version of the firebase_core FlutterFire plugin is required, please update your firebase_core pubspec dependency.')
29+
}
30+
31+
def getRootProjectExtOrCoreProperty(name, firebaseCoreProject) {
32+
if (!rootProject.ext.has('FlutterFire')) return firebaseCoreProject.properties[name]
33+
if (!rootProject.ext.get('FlutterFire')[name]) return firebaseCoreProject.properties[name]
34+
return rootProject.ext.get('FlutterFire').get(name)
35+
}
36+
2437
android {
2538
compileSdkVersion 28
2639

@@ -32,7 +45,9 @@ android {
3245
disable 'InvalidPackage'
3346
}
3447
dependencies {
35-
api 'com.google.firebase:firebase-inappmessaging-display:18.0.2'
48+
api firebaseCoreProject
49+
implementation platform("com.google.firebase:firebase-bom:${getRootProjectExtOrCoreProperty("FirebaseSDKVersion", firebaseCoreProject)}")
50+
implementation 'com.google.firebase:firebase-inappmessaging-display'
3651
}
3752
}
3853

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.firebase_in_app_messaging">
2+
package="com.flutter.plugins.firebase.inappmessaging">
33
</manifest>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
package com.example.firebase_in_app_messaging;
5+
package io.flutter.plugins.firebase.inappmessaging;
66

77
import com.google.firebase.inappmessaging.FirebaseInAppMessaging;
88
import io.flutter.embedding.engine.plugins.FlutterPlugin;

packages/firebase_in_app_messaging/example/android/app/src/androidTest/java/com/example/firebase_in_app_messaging/EmbeddingV1ActivityTest.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/firebase_in_app_messaging/example/android/app/src/androidTest/java/com/example/firebase_in_app_messaging/MainActivityTest.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/firebase_in_app_messaging/example/android/app/src/main/AndroidManifest.xml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,19 @@
1010
android:name="io.flutter.app.FlutterApplication"
1111
android:label="firebase_in_app_messaging_example"
1212
android:icon="@mipmap/ic_launcher">
13-
<activity
14-
android:name=".EmbeddingV1Activity"
15-
android:theme="@style/LaunchTheme"
16-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
17-
android:hardwareAccelerated="true"
18-
android:windowSoftInputMode="adjustResize">
19-
</activity>
20-
<activity
21-
android:name=".MainActivity"
22-
android:launchMode="singleTop"
23-
android:theme="@style/LaunchTheme"
24-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
25-
android:hardwareAccelerated="true"
26-
android:windowSoftInputMode="adjustResize">
27-
<!-- This keeps the window background of the activity showing
28-
until Flutter renders its first frame. It can be removed if
29-
there is no splash screen (such as the default splash screen
30-
defined in @style/LaunchTheme). -->
31-
<intent-filter>
32-
<action android:name="android.intent.action.MAIN"/>
33-
<category android:name="android.intent.category.LAUNCHER"/>
34-
</intent-filter>
35-
</activity>
13+
<activity android:name="io.flutter.embedding.android.FlutterActivity"
14+
android:theme="@android:style/Theme.Black.NoTitleBar"
15+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
16+
android:hardwareAccelerated="true"
17+
android:windowSoftInputMode="adjustResize">
18+
<meta-data
19+
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
20+
android:value="true" />
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN"/>
23+
<category android:name="android.intent.category.LAUNCHER"/>
24+
</intent-filter>
25+
</activity>
26+
<meta-data android:name="flutterEmbedding" android:value="2"/>
3627
</application>
3728
</manifest>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package com.example.firebase_in_app_messaging_example;
22

33
import android.os.Bundle;
4+
import dev.flutter.plugins.e2e.E2EPlugin;
45
import io.flutter.app.FlutterActivity;
5-
import io.flutter.plugins.GeneratedPluginRegistrant;
6+
import io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin;
7+
import io.flutter.plugins.firebase.inappmessaging.FirebaseInAppMessagingPlugin;
68

79
public class EmbeddingV1Activity extends FlutterActivity {
810
@Override
911
protected void onCreate(Bundle savedInstanceState) {
1012
super.onCreate(savedInstanceState);
11-
GeneratedPluginRegistrant.registerWith(this);
13+
FlutterFirebaseCorePlugin.registerWith(
14+
registrarFor("io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin"));
15+
// TODO(Salakar) rename as part of re-work FirebaseInAppMessagingPlugin -> FlutterFirebaseInAppMessagingPlugin
16+
FirebaseInAppMessagingPlugin.registerWith(
17+
registrarFor("io.flutter.plugins.firebase.inappmessaging.FirebaseInAppMessagingPlugin"));
18+
E2EPlugin.registerWith(registrarFor("dev.flutter.plugins.e2e.E2EPlugin"));
1219
}
1320
}

packages/firebase_in_app_messaging/example/android/app/src/main/java/com/example/firebase_in_app_messaging_example/MainActivity.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/firebase_in_app_messaging/example/pubspec.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ dependencies:
99
flutter:
1010
sdk: flutter
1111
cupertino_icons: ^0.1.2
12+
firebase_in_app_messaging:
13+
path: ../
14+
firebase_core: ^0.5.0-dev.2
15+
firebase_analytics: ^6.0.0-dev.1
1216

1317
dev_dependencies:
1418
pedantic: ^1.8.0
@@ -19,10 +23,5 @@ dev_dependencies:
1923
sdk: flutter
2024
test: any
2125

22-
firebase_in_app_messaging:
23-
path: ../
24-
firebase_core: ^0.4.0+8
25-
firebase_analytics: ^4.0.2
26-
2726
flutter:
2827
uses-material-design: true

0 commit comments

Comments
 (0)