Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/android_intent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.3.6+1

* Bump the minimum Flutter version to 1.12.13+hotfix.5.
* Bump the minimum Dart version to 2.3.0.
* Uses Darts spread operator to build plugin arguments internally.
* Remove deprecated API usage warning in AndroidIntentPlugin.java.
* Migrates the Android example to V2 embedding.

## 0.3.6

* Marks the `action` parameter as optional
Expand Down
26 changes: 0 additions & 26 deletions packages/android_intent/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,3 @@ dependencies {
testImplementation 'androidx.test:core:1.0.0'
testImplementation 'org.robolectric:robolectric:4.3'
}

// TODO(mklim): Remove this hack once androidx.lifecycle is included on stable. https://github.com/flutter/flutter/issues/42348
afterEvaluate {
def containsEmbeddingDependencies = false
for (def configuration : configurations.all) {
for (def dependency : configuration.dependencies) {
if (dependency.group == 'io.flutter' &&
dependency.name.startsWith('flutter_embedding') &&
dependency.isTransitive())
{
containsEmbeddingDependencies = true
break
}
}
}
if (!containsEmbeddingDependencies) {
android {
dependencies {
def lifecycle_version = "1.1.1"
compileOnly "android.arch.lifecycle:runtime:$lifecycle_version"
compileOnly "android.arch.lifecycle:common:$lifecycle_version"
compileOnly "android.arch.lifecycle:common-java8:$lifecycle_version"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static void registerWith(Registrar registrar) {
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
sender.setApplicationContext(binding.getApplicationContext());
sender.setActivity(null);
impl.startListening(binding.getFlutterEngine().getDartExecutor());
impl.startListening(binding.getBinaryMessenger());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,27 @@
android:label="android_intent_example"
android:name="io.flutter.app.FlutterApplication">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:name=".EmbeddingV1Activity"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="adjustResize"/>
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:name=".MainActivity"
android:windowSoftInputMode="adjustResize">
</activity>

<activity android:name="io.flutter.embedding.android.FlutterActivity"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="flutterEmbedding" android:value="2"/>
</application>
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.androidintent.AndroidIntentPlugin;

public class EmbeddingV1Activity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
AndroidIntentPlugin.registerWith(
registrarFor("io.flutter.plugins.androidintent.AndroidIntentPlugin"));
}
}

This file was deleted.

3 changes: 0 additions & 3 deletions packages/android_intent/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@ dev_dependencies:
# The following section is specific to Flutter.
flutter:
uses-material-design: true

environment:
flutter: ">=1.9.1+hotfix.2 <2.0.0"
44 changes: 18 additions & 26 deletions packages/android_intent/lib/android_intent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,31 +134,23 @@ class AndroidIntent {
if (!_platform.isAndroid) {
return;
}
final Map<String, dynamic> args = <String, dynamic>{};
if (action != null) {
args['action'] = action;
}
if (flags != null) {
args['flags'] = convertFlags(flags);
}
if (category != null) {
args['category'] = category;
}
if (data != null) {
args['data'] = data;
}
if (arguments != null) {
args['arguments'] = arguments;
}
if (package != null) {
args['package'] = package;
if (componentName != null) {
args['componentName'] = componentName;
}
}
if (type != null) {
args['type'] = type;
}
await _channel.invokeMethod<void>('launch', args);

await _channel.invokeMethod<void>('launch', _buildArguments());
}

/// Constructs the map of arguments which is passed to the plugin.
Map<String, dynamic> _buildArguments() {
return {
if (action != null) 'action': action,
if (flags != null) 'flags': convertFlags(flags),
if (category != null) 'category': category,
if (data != null) 'data': data,
if (arguments != null) 'arguments': arguments,
if (package != null) ...{
'package': package,
if (componentName != null) 'componentName': componentName,
},
if (type != null) 'type': type,
};
}
}
6 changes: 3 additions & 3 deletions packages/android_intent/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: android_intent
description: Flutter plugin for launching Android Intents. Not supported on iOS.
homepage: https://github.com/flutter/plugins/tree/master/packages/android_intent
version: 0.3.6
version: 0.3.6+1

flutter:
plugin:
Expand All @@ -23,5 +23,5 @@ dev_dependencies:
pedantic: ^1.8.0

environment:
sdk: ">=2.0.0-dev.28.0 <3.0.0"
flutter: ">=1.10.0 <2.0.0"
sdk: ">=2.3.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that we're bumping the min supported Dart and Flutter versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dart version was increased to make the spread operator available.

Flutter version was increased to the latest stable version to be inline with other plugins like google_maps, connectivity etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be forcing all consumers of this plugin to upgrade their Dart version just so that this plugin can use the spread operator? I'm not sure how many people are on various versions of Dart, but my initial thought is that using the spread operator is a pretty trivial detail and we probably shouldn't force a language change on people just do that. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you asked. I had similar concerns but ended up with:

  • Current stable is referring to Dart 2.7, while this PR only bumps to 2.3 (when spread was introduced, roughly)
    • Every time I bump a Flutter version on my machine, the bundled Dart version is synced
    • The previous stable version (1.9) shipped with Dart 2.5, so I think we're ok
  • IMO Flutters official plugins should showcase new language (stable) features so that users adopt them quicker, thus making the the platform more attractive
    • Flutters style guide mentions how to use the spread operator, so I assumed it's already accepted
  • Reducing LOC is always a compelling argument although not too strong one here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think current stable including a higher version of Dart already makes this a non-issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @mklim mentioned, your first bullet point is probably the right answer. If stable has bumped Dart then we're probably good.

I would caution the 2nd and 3rd bullet points. I actually don't think using new language features or showcasing capabilities would be seen as an appropriate reason to break versions. I'll defer to @amirh and @Hixie in that regard, but that would be my guess.

In any case, bullet point 1 makes sense and works for me.