forked from firebase/flutterfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade in-app-messaging to plugin api v2 (firebase#1369)
* Upgraded in-app-messaging to plugins api v2.
- Loading branch information
Showing
16 changed files
with
151 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
|
||
android.enableR8=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...p/src/androidTest/java/com/example/firebase_in_app_messaging/EmbeddingV1ActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.example.firebase_in_app_messaging; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import com.example.firebase_in_app_messaging_example.EmbeddingV1Activity; | ||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class EmbeddingV1ActivityTest { | ||
@Rule | ||
public ActivityTestRule<EmbeddingV1Activity> rule = | ||
new ActivityTestRule<>(EmbeddingV1Activity.class); | ||
} |
12 changes: 12 additions & 0 deletions
12
...roid/app/src/androidTest/java/com/example/firebase_in_app_messaging/MainActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.firebase_in_app_messaging; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import com.example.firebase_in_app_messaging_example.MainActivity; | ||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class MainActivityTest { | ||
@Rule public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../app/src/main/java/com/example/firebase_in_app_messaging_example/EmbeddingV1Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.example.firebase_in_app_messaging_example; | ||
|
||
import android.os.Bundle; | ||
import io.flutter.app.FlutterActivity; | ||
import io.flutter.plugins.GeneratedPluginRegistrant; | ||
|
||
public class EmbeddingV1Activity extends FlutterActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
GeneratedPluginRegistrant.registerWith(this); | ||
} | ||
} |
21 changes: 15 additions & 6 deletions
21
...android/app/src/main/java/com/example/firebase_in_app_messaging_example/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
package com.example.firebase_in_app_messaging_example; | ||
|
||
import android.os.Bundle; | ||
import io.flutter.app.FlutterActivity; | ||
import io.flutter.plugins.GeneratedPluginRegistrant; | ||
import com.example.firebase_in_app_messaging.FirebaseInAppMessagingPlugin; | ||
import dev.flutter.plugins.e2e.E2EPlugin; | ||
import io.flutter.embedding.android.FlutterActivity; | ||
import io.flutter.embedding.engine.FlutterEngine; | ||
import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry; | ||
import io.flutter.plugins.firebaseanalytics.FirebaseAnalyticsPlugin; | ||
|
||
public class MainActivity extends FlutterActivity { | ||
// TODO(gaaclarke): Remove this once v2 of GeneratedPluginRegistrant rolls to stable. | ||
// https://github.com/flutter/flutter/issues/42694 | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
GeneratedPluginRegistrant.registerWith(this); | ||
public void configureFlutterEngine(FlutterEngine flutterEngine) { | ||
flutterEngine.getPlugins().add(new E2EPlugin()); | ||
flutterEngine.getPlugins().add(new FirebaseInAppMessagingPlugin()); | ||
final ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine); | ||
FirebaseAnalyticsPlugin.registerWith( | ||
shimPluginRegistry.registrarFor( | ||
"io.flutter.plugins.firebaseanalytics.FirebaseAnalyticsPlugin")); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/firebase_in_app_messaging/example/android/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.enableJetifier=true | ||
android.useAndroidX=true | ||
android.enableR8=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
packages/firebase_in_app_messaging/example/test_driver/firebase_in_app_messaging.dart
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
packages/firebase_in_app_messaging/example/test_driver/firebase_in_app_messaging_test.dart
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
name: firebase_in_app_messaging | ||
description: Flutter plugin for Firebase In-App Messaging. | ||
version: 0.1.0 | ||
version: 0.1.1 | ||
author: Flutter Team <[email protected]> | ||
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_in_app_messaging | ||
|
||
environment: | ||
sdk: ">=2.1.0 <3.0.0" | ||
sdk: ">=2.0.0-dev.28.0 <3.0.0" | ||
flutter: ">=1.9.1+hotfix.5 <2.0.0" | ||
|
||
dependencies: | ||
meta: ^1.1.6 | ||
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
e2e: ^0.2.1 | ||
flutter_test: | ||
sdk: flutter | ||
flutter_driver: | ||
|
21 changes: 21 additions & 0 deletions
21
packages/firebase_in_app_messaging/test/firebase_in_app_messaging_e2e.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:e2e/e2e.dart'; | ||
import 'package:firebase_in_app_messaging/firebase_in_app_messaging.dart'; | ||
|
||
void main() { | ||
E2EWidgetsFlutterBinding.ensureInitialized(); | ||
FirebaseInAppMessaging fiam; | ||
|
||
setUp(() { | ||
fiam = FirebaseInAppMessaging(); | ||
}); | ||
|
||
testWidgets('triggerEvent', (WidgetTester tester) async { | ||
expect(fiam.triggerEvent('someEvent'), completes); | ||
}); | ||
|
||
testWidgets('logging', (WidgetTester tester) async { | ||
expect(fiam.setMessagesSuppressed(true), completes); | ||
expect(fiam.setAutomaticDataCollectionEnabled(true), completes); | ||
}); | ||
} |