From c576b1cf9c66af81deeeeae6982b175d8d519e7e Mon Sep 17 00:00:00 2001 From: jaumard Date: Thu, 30 May 2024 10:42:12 +0200 Subject: [PATCH 01/11] add support for parsing URI intent into android_intent_plus --- .../plus/androidintent/IntentSender.java | 6 ++++++ .../plus/androidintent/MethodCallHandlerImpl.java | 11 ++++++++++- packages/android_intent_plus/example/lib/main.dart | 10 ++++++++++ packages/android_intent_plus/example/pubspec.yaml | 3 ++- packages/android_intent_plus/lib/android_intent.dart | 12 ++++++++++++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java index 3fe3588935..84fef0601b 100644 --- a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java +++ b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java @@ -11,6 +11,8 @@ import android.util.Log; import androidx.annotation.Nullable; +import java.net.URISyntaxException; + /** Forms and launches intents. */ public final class IntentSender { private static final String TAG = "IntentSender"; @@ -175,4 +177,8 @@ Intent buildIntent( return intent; } + + public Intent parse(String uri) throws URISyntaxException { + return Intent.parseUri(uri, Intent.URI_INTENT_SCHEME); + } } diff --git a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java index 261b992034..19119c0391 100644 --- a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java +++ b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java @@ -14,6 +14,8 @@ import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; + +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Map; @@ -91,7 +93,14 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { sender.buildIntent( action, flags, category, data, arguments, packageName, componentName, type); - if ("launch".equalsIgnoreCase(call.method)) { + if ("parseAndLaunch".equalsIgnoreCase(call.method)) { + try { + intent = sender.parse(call.argument("uri")); + sender.send(intent); + } catch (URISyntaxException e) { + result.error("WRONG_URI", "Uri's syntax is wrong", null); + } + } else if ("launch".equalsIgnoreCase(call.method)) { if (intent != null && !sender.canResolveActivity(intent)) { Log.i(TAG, "Cannot resolve explicit intent, falling back to implicit"); diff --git a/packages/android_intent_plus/example/lib/main.dart b/packages/android_intent_plus/example/lib/main.dart index a98f4dfa5a..28d2735ca2 100644 --- a/packages/android_intent_plus/example/lib/main.dart +++ b/packages/android_intent_plus/example/lib/main.dart @@ -36,6 +36,7 @@ class MyApp extends StatelessWidget { /// Holds the different intent widgets. class MyHomePage extends StatelessWidget { const MyHomePage({super.key}); + static const _intent = 'intent://payment#Intent;action=ch.twint.action.TWINT_PAYMENT;scheme=twint;S.code=98815;S.startingOrigin=EXTERNAL_WEB_BROWSER;S.browser_fallback_url=;end'; void _createAlarm() { const intent = AndroidIntent( @@ -69,6 +70,11 @@ class MyHomePage extends StatelessWidget { child: const Text( 'Tap here to set an alarm\non weekdays at 9:30pm.'), ), + ElevatedButton( + onPressed: _parseAndLaunch, + child: const Text( + 'Tap here to parse and launch intent $_intent'), + ), ElevatedButton( onPressed: _openChooser, child: const Text('Tap here to launch Intent with Chooser'), @@ -111,6 +117,10 @@ class MyHomePage extends StatelessWidget { ); intent.sendBroadcast(); } + + void _parseAndLaunch() { + AndroidIntent.parseAndLaunch(_intent); + } } /// Launches intents to specific Android activities. diff --git a/packages/android_intent_plus/example/pubspec.yaml b/packages/android_intent_plus/example/pubspec.yaml index df7860acac..6b0fe925c9 100644 --- a/packages/android_intent_plus/example/pubspec.yaml +++ b/packages/android_intent_plus/example/pubspec.yaml @@ -9,7 +9,8 @@ dependencies: flutter: sdk: flutter platform: ^3.1.0 - android_intent_plus: ^5.0.2 + android_intent_plus: #^5.0.2 + path: ../ dev_dependencies: flutter_driver: diff --git a/packages/android_intent_plus/lib/android_intent.dart b/packages/android_intent_plus/lib/android_intent.dart index 3626a3a43d..51b5083ef6 100644 --- a/packages/android_intent_plus/lib/android_intent.dart +++ b/packages/android_intent_plus/lib/android_intent.dart @@ -150,6 +150,18 @@ class AndroidIntent { await _channel.invokeMethod('launch', _buildArguments()); } + /// Parse and Launch the intent in format. + /// + /// Equivalent of native android Intent.parseUri(URI, Intent.URI_INTENT_SCHEME) + /// This works only on Android platforms. + static Future parseAndLaunch(String uri) async { + if (!const LocalPlatform().isAndroid) { + return; + } + + await const MethodChannel(_kChannelName).invokeMethod('parseAndLaunch', {'uri': uri}); + } + /// Launch the intent with 'createChooser(intent, title)'. /// /// This works only on Android platforms. From fd0c19ed50738db84b0818a13f0be097678e7f3e Mon Sep 17 00:00:00 2001 From: jaumard Date: Thu, 30 May 2024 10:45:22 +0200 Subject: [PATCH 02/11] update changelog and pubspec --- packages/android_intent_plus/CHANGELOG.md | 4 ++++ packages/android_intent_plus/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/android_intent_plus/CHANGELOG.md b/packages/android_intent_plus/CHANGELOG.md index 3cf468ac05..2fb73e4509 100644 --- a/packages/android_intent_plus/CHANGELOG.md +++ b/packages/android_intent_plus/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.3 + +- **FIX**(android_intent_plus): Add support for parking intent URI ([#2164](https://github.com/fluttercommunity/plus_plugins/issues/2164)). + ## 5.0.2 - **REFACTOR**(android_intent_plus): Migrate Android example to use the new plugins declaration ([#2773](https://github.com/fluttercommunity/plus_plugins/issues/2773)). ([7c2de04d](https://github.com/fluttercommunity/plus_plugins/commit/7c2de04deffa1dc788d93c12e5cee1fd98821514)) diff --git a/packages/android_intent_plus/pubspec.yaml b/packages/android_intent_plus/pubspec.yaml index fda935714b..8ac6cfe987 100644 --- a/packages/android_intent_plus/pubspec.yaml +++ b/packages/android_intent_plus/pubspec.yaml @@ -1,6 +1,6 @@ name: android_intent_plus description: Flutter plugin for launching Android Intents. Not supported on iOS. -version: 5.0.2 +version: 5.0.3 homepage: https://plus.fluttercommunity.dev/ repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/android_intent_plus issue_tracker: https://github.com/fluttercommunity/plus_plugins/labels/android_intent_plus From 6b59a1b457ed1738c52264055eda31161999cbdf Mon Sep 17 00:00:00 2001 From: jaumard Date: Thu, 30 May 2024 10:51:15 +0200 Subject: [PATCH 03/11] format code --- packages/android_intent_plus/lib/android_intent.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/android_intent_plus/lib/android_intent.dart b/packages/android_intent_plus/lib/android_intent.dart index 51b5083ef6..b680b962af 100644 --- a/packages/android_intent_plus/lib/android_intent.dart +++ b/packages/android_intent_plus/lib/android_intent.dart @@ -159,7 +159,8 @@ class AndroidIntent { return; } - await const MethodChannel(_kChannelName).invokeMethod('parseAndLaunch', {'uri': uri}); + await const MethodChannel(_kChannelName) + .invokeMethod('parseAndLaunch', {'uri': uri}); } /// Launch the intent with 'createChooser(intent, title)'. From 38b38b60b2f6ef9858b365a825d019327364faa5 Mon Sep 17 00:00:00 2001 From: jaumard Date: Thu, 30 May 2024 10:56:59 +0200 Subject: [PATCH 04/11] format code --- .../plus/androidintent/IntentSender.java | 7 +++---- .../androidintent/MethodCallHandlerImpl.java | 17 ++++++++--------- .../android_intent_plus/example/lib/main.dart | 6 +++--- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java index 84fef0601b..2158b42024 100644 --- a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java +++ b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/IntentSender.java @@ -10,7 +10,6 @@ import android.text.TextUtils; import android.util.Log; import androidx.annotation.Nullable; - import java.net.URISyntaxException; /** Forms and launches intents. */ @@ -178,7 +177,7 @@ Intent buildIntent( return intent; } - public Intent parse(String uri) throws URISyntaxException { - return Intent.parseUri(uri, Intent.URI_INTENT_SCHEME); - } + public Intent parse(String uri) throws URISyntaxException { + return Intent.parseUri(uri, Intent.URI_INTENT_SCHEME); + } } diff --git a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java index 19119c0391..2e7bf29862 100644 --- a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java +++ b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java @@ -14,7 +14,6 @@ import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; - import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Map; @@ -93,14 +92,14 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { sender.buildIntent( action, flags, category, data, arguments, packageName, componentName, type); - if ("parseAndLaunch".equalsIgnoreCase(call.method)) { - try { - intent = sender.parse(call.argument("uri")); - sender.send(intent); - } catch (URISyntaxException e) { - result.error("WRONG_URI", "Uri's syntax is wrong", null); - } - } else if ("launch".equalsIgnoreCase(call.method)) { + if ("parseAndLaunch".equalsIgnoreCase(call.method)) { + try { + intent = sender.parse(call.argument("uri")); + sender.send(intent); + } catch (URISyntaxException e) { + result.error("WRONG_URI", "Uri's syntax is wrong", null); + } + } else if ("launch".equalsIgnoreCase(call.method)) { if (intent != null && !sender.canResolveActivity(intent)) { Log.i(TAG, "Cannot resolve explicit intent, falling back to implicit"); diff --git a/packages/android_intent_plus/example/lib/main.dart b/packages/android_intent_plus/example/lib/main.dart index 28d2735ca2..bf350446df 100644 --- a/packages/android_intent_plus/example/lib/main.dart +++ b/packages/android_intent_plus/example/lib/main.dart @@ -36,7 +36,8 @@ class MyApp extends StatelessWidget { /// Holds the different intent widgets. class MyHomePage extends StatelessWidget { const MyHomePage({super.key}); - static const _intent = 'intent://payment#Intent;action=ch.twint.action.TWINT_PAYMENT;scheme=twint;S.code=98815;S.startingOrigin=EXTERNAL_WEB_BROWSER;S.browser_fallback_url=;end'; + static const _intent = + 'intent://payment#Intent;action=ch.twint.action.TWINT_PAYMENT;scheme=twint;S.code=98815;S.startingOrigin=EXTERNAL_WEB_BROWSER;S.browser_fallback_url=;end'; void _createAlarm() { const intent = AndroidIntent( @@ -72,8 +73,7 @@ class MyHomePage extends StatelessWidget { ), ElevatedButton( onPressed: _parseAndLaunch, - child: const Text( - 'Tap here to parse and launch intent $_intent'), + child: const Text('Tap here to parse and launch intent $_intent'), ), ElevatedButton( onPressed: _openChooser, From 4cdd1c799f300810e79945a782a52f7d21763459 Mon Sep 17 00:00:00 2001 From: jaumard Date: Thu, 30 May 2024 11:09:09 +0200 Subject: [PATCH 05/11] fix integration test --- .../example/integration_test/android_intent_plus_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart b/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart index c5613c3e96..45807c0967 100644 --- a/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart +++ b/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart @@ -25,7 +25,7 @@ void main() { (Widget widget) => widget is Text && widget.data!.startsWith('Tap here'), ), - findsNWidgets(4), + findsNWidgets(5), ); } else { expect( From ea0a75d1c3dbedac3eaea3c98bb9032a6600dc54 Mon Sep 17 00:00:00 2001 From: jaumard Date: Thu, 30 May 2024 13:34:42 +0200 Subject: [PATCH 06/11] Revert "update changelog and pubspec" This reverts commit fd0c19ed50738db84b0818a13f0be097678e7f3e. --- packages/android_intent_plus/CHANGELOG.md | 4 ---- packages/android_intent_plus/pubspec.yaml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/android_intent_plus/CHANGELOG.md b/packages/android_intent_plus/CHANGELOG.md index 2fb73e4509..3cf468ac05 100644 --- a/packages/android_intent_plus/CHANGELOG.md +++ b/packages/android_intent_plus/CHANGELOG.md @@ -1,7 +1,3 @@ -## 5.0.3 - -- **FIX**(android_intent_plus): Add support for parking intent URI ([#2164](https://github.com/fluttercommunity/plus_plugins/issues/2164)). - ## 5.0.2 - **REFACTOR**(android_intent_plus): Migrate Android example to use the new plugins declaration ([#2773](https://github.com/fluttercommunity/plus_plugins/issues/2773)). ([7c2de04d](https://github.com/fluttercommunity/plus_plugins/commit/7c2de04deffa1dc788d93c12e5cee1fd98821514)) diff --git a/packages/android_intent_plus/pubspec.yaml b/packages/android_intent_plus/pubspec.yaml index 8ac6cfe987..fda935714b 100644 --- a/packages/android_intent_plus/pubspec.yaml +++ b/packages/android_intent_plus/pubspec.yaml @@ -1,6 +1,6 @@ name: android_intent_plus description: Flutter plugin for launching Android Intents. Not supported on iOS. -version: 5.0.3 +version: 5.0.2 homepage: https://plus.fluttercommunity.dev/ repository: https://github.com/fluttercommunity/plus_plugins/tree/main/packages/android_intent_plus issue_tracker: https://github.com/fluttercommunity/plus_plugins/labels/android_intent_plus From 7d41e28595904df491e7db865e19caaabb067f32 Mon Sep 17 00:00:00 2001 From: jaumard Date: Thu, 30 May 2024 13:51:56 +0200 Subject: [PATCH 07/11] fix feedbacks --- .../plus/androidintent/MethodCallHandlerImpl.java | 3 ++- packages/android_intent_plus/example/lib/main.dart | 5 +++-- packages/android_intent_plus/example/pubspec.yaml | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java index 2e7bf29862..cac0071153 100644 --- a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java +++ b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java @@ -97,7 +97,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { intent = sender.parse(call.argument("uri")); sender.send(intent); } catch (URISyntaxException e) { - result.error("WRONG_URI", "Uri's syntax is wrong", null); + final String errorMessage = "Uri's syntax is wrong"; + result.error("WRONG_URI", errorMessage, errorMessage); } } else if ("launch".equalsIgnoreCase(call.method)) { diff --git a/packages/android_intent_plus/example/lib/main.dart b/packages/android_intent_plus/example/lib/main.dart index bf350446df..12a0db6db5 100644 --- a/packages/android_intent_plus/example/lib/main.dart +++ b/packages/android_intent_plus/example/lib/main.dart @@ -37,7 +37,7 @@ class MyApp extends StatelessWidget { class MyHomePage extends StatelessWidget { const MyHomePage({super.key}); static const _intent = - 'intent://payment#Intent;action=ch.twint.action.TWINT_PAYMENT;scheme=twint;S.code=98815;S.startingOrigin=EXTERNAL_WEB_BROWSER;S.browser_fallback_url=;end'; + 'intent:#Intent;action=android.intent.action.SET_ALARM;B.android.intent.extra.alarm.SKIP_UI=true;S.android.intent.extra.alarm.MESSAGE=Create%20a%20Flutter%20app;i.android.intent.extra.alarm.MINUTES=30;i.android.intent.extra.alarm.HOUR=21;end'; void _createAlarm() { const intent = AndroidIntent( @@ -73,7 +73,8 @@ class MyHomePage extends StatelessWidget { ), ElevatedButton( onPressed: _parseAndLaunch, - child: const Text('Tap here to parse and launch intent $_intent'), + child: const Text( + 'Tap here to set an alarm\n based on URI: $_intent'), ), ElevatedButton( onPressed: _openChooser, diff --git a/packages/android_intent_plus/example/pubspec.yaml b/packages/android_intent_plus/example/pubspec.yaml index 6b0fe925c9..df7860acac 100644 --- a/packages/android_intent_plus/example/pubspec.yaml +++ b/packages/android_intent_plus/example/pubspec.yaml @@ -9,8 +9,7 @@ dependencies: flutter: sdk: flutter platform: ^3.1.0 - android_intent_plus: #^5.0.2 - path: ../ + android_intent_plus: ^5.0.2 dev_dependencies: flutter_driver: From d8d56f892b8dd4f091deed26c9bf361169b5956b Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Thu, 30 May 2024 14:58:27 +0200 Subject: [PATCH 08/11] add missing result.success --- .../plus/androidintent/MethodCallHandlerImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java index cac0071153..8d99532b71 100644 --- a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java +++ b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java @@ -96,6 +96,7 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { try { intent = sender.parse(call.argument("uri")); sender.send(intent); + result.success(null); } catch (URISyntaxException e) { final String errorMessage = "Uri's syntax is wrong"; result.error("WRONG_URI", errorMessage, errorMessage); From 9c821a4be74cde435499f32a47ea331537a5d770 Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Thu, 30 May 2024 14:58:50 +0200 Subject: [PATCH 09/11] improve parsing error message --- .../plus/androidintent/MethodCallHandlerImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java index 8d99532b71..b56ff44845 100644 --- a/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java +++ b/packages/android_intent_plus/android/src/main/java/dev/fluttercommunity/plus/androidintent/MethodCallHandlerImpl.java @@ -98,8 +98,7 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { sender.send(intent); result.success(null); } catch (URISyntaxException e) { - final String errorMessage = "Uri's syntax is wrong"; - result.error("WRONG_URI", errorMessage, errorMessage); + result.error("parse_error", "Failed to parse URI", e.getMessage()); } } else if ("launch".equalsIgnoreCase(call.method)) { From 260ef85124860fdb1c0fb281bfac3e6a78bea240 Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Thu, 30 May 2024 14:59:04 +0200 Subject: [PATCH 10/11] cleanup example --- .../android_intent_plus/example/lib/main.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/android_intent_plus/example/lib/main.dart b/packages/android_intent_plus/example/lib/main.dart index 12a0db6db5..7e7cc43e4f 100644 --- a/packages/android_intent_plus/example/lib/main.dart +++ b/packages/android_intent_plus/example/lib/main.dart @@ -36,8 +36,6 @@ class MyApp extends StatelessWidget { /// Holds the different intent widgets. class MyHomePage extends StatelessWidget { const MyHomePage({super.key}); - static const _intent = - 'intent:#Intent;action=android.intent.action.SET_ALARM;B.android.intent.extra.alarm.SKIP_UI=true;S.android.intent.extra.alarm.MESSAGE=Create%20a%20Flutter%20app;i.android.intent.extra.alarm.MINUTES=30;i.android.intent.extra.alarm.HOUR=21;end'; void _createAlarm() { const intent = AndroidIntent( @@ -73,8 +71,7 @@ class MyHomePage extends StatelessWidget { ), ElevatedButton( onPressed: _parseAndLaunch, - child: const Text( - 'Tap here to set an alarm\n based on URI: $_intent'), + child: const Text('Tap here to set an alarm\n based on URI'), ), ElevatedButton( onPressed: _openChooser, @@ -120,7 +117,15 @@ class MyHomePage extends StatelessWidget { } void _parseAndLaunch() { - AndroidIntent.parseAndLaunch(_intent); + const intent = 'intent:#Intent;' + 'action=android.intent.action.SET_ALARM;' + 'B.android.intent.extra.alarm.SKIP_UI=true;' + 'S.android.intent.extra.alarm.MESSAGE=Create%20a%20Flutter%20app;' + 'i.android.intent.extra.alarm.MINUTES=30;' + 'i.android.intent.extra.alarm.HOUR=21;' + 'end'; + + AndroidIntent.parseAndLaunch(intent); } } From d494ea08d947d2b1cb6e58a2bea9214d1986a2df Mon Sep 17 00:00:00 2001 From: Miguel Beltran Date: Thu, 30 May 2024 15:04:45 +0200 Subject: [PATCH 11/11] add integration test --- .../integration_test/android_intent_plus_test.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart b/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart index 45807c0967..8fe526a6dd 100644 --- a/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart +++ b/packages/android_intent_plus/example/integration_test/android_intent_plus_test.dart @@ -64,6 +64,18 @@ void main() { await intent.launch(); }, skip: !Platform.isAndroid); + testWidgets('Parse and Launch should not throw', (WidgetTester tester) async { + const intent = 'intent:#Intent;' + 'action=android.intent.action.SET_ALARM;' + 'B.android.intent.extra.alarm.SKIP_UI=true;' + 'S.android.intent.extra.alarm.MESSAGE=Create%20a%20Flutter%20app;' + 'i.android.intent.extra.alarm.MINUTES=30;' + 'i.android.intent.extra.alarm.HOUR=21;' + 'end'; + + AndroidIntent.parseAndLaunch(intent); + }, skip: !Platform.isAndroid); + testWidgets('LaunchChooser should not throw', (WidgetTester tester) async { const intent = AndroidIntent( action: 'android.intent.action.SEND',