Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit fb9a4b5

Browse files
authored
Allow FDL plugin to be registered without an activity (#1835)
1 parent f8efbe8 commit fb9a4b5

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

packages/firebase_dynamic_links/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.0+5
2+
3+
* Fix the bug below properly by allowing the activity to be null (but still registering the plugin). If activity is null, we don't get a latestIntent, instead we expect the intent listener to grab it.
4+
15
## 0.4.0+4
26

37
* Fixed bug on Android when a headless plugin tries to register this plugin causing a crash due no activity from the registrar.

packages/firebase_dynamic_links/android/src/main/java/io/flutter/plugins/firebasedynamiclinks/FirebaseDynamicLinksPlugin.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public class FirebaseDynamicLinksPlugin implements MethodCallHandler {
2828

2929
private FirebaseDynamicLinksPlugin(Registrar registrar) {
3030
this.registrar = registrar;
31-
latestIntent = registrar.activity().getIntent();
31+
if (registrar.activity() != null) {
32+
latestIntent = registrar.activity().getIntent();
33+
}
3234

3335
registrar.addNewIntentListener(
3436
new PluginRegistry.NewIntentListener() {
@@ -41,9 +43,6 @@ public boolean onNewIntent(Intent intent) {
4143
}
4244

4345
public static void registerWith(Registrar registrar) {
44-
if (registrar.activity() == null) {
45-
return;
46-
}
4746
final MethodChannel channel =
4847
new MethodChannel(registrar.messenger(), "plugins.flutter.io/firebase_dynamic_links");
4948
channel.setMethodCallHandler(new FirebaseDynamicLinksPlugin(registrar));

packages/firebase_dynamic_links/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: firebase_dynamic_links
22
description: Flutter plugin for Google Dynamic Links for Firebase, an app solution for creating
33
and handling links across multiple platforms.
4-
version: 0.4.0+4
4+
version: 0.4.0+5
55

66
author: Flutter Team <flutter-dev@googlegroups.com>
77
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_dynamic_links

0 commit comments

Comments
 (0)