Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add openUrl method to native automator #2219

Merged
merged 14 commits into from
Jun 13, 2024
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
6 changes: 6 additions & 0 deletions dev/e2e_app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="patrol" />
</intent-filter>
</activity>
<receiver android:exported="false"
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
Expand Down
16 changes: 16 additions & 0 deletions dev/e2e_app/integration_test/deep_link_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'common.dart';

void main() {
patrol('Open url in the app', ($) async {
await createApp($);
await $.native.pressHome();

await $.native.openUrl('patrol://check/somepath?query=10');
await $.pumpAndSettle();

expect($('Applink Screen'), findsOneWidget);
expect($('Uri: patrol://check/somepath?query=10'), findsOneWidget);
expect($('Path: /somepath'), findsOneWidget);
expect($('Query: query=10'), findsOneWidget);
});
}
11 changes: 11 additions & 0 deletions dev/e2e_app/integration_test/external_link_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'common.dart';

void main() {
patrol('Open external url', ($) async {
await createApp($);

await $.native.openUrl('https://leancode.co');

await $.native.waitUntilVisible(Selector(text: 'Subscribe'));
});
}
2 changes: 1 addition & 1 deletion dev/e2e_app/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
10 changes: 8 additions & 2 deletions dev/e2e_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
PODS:
- app_links (0.0.1):
- Flutter
- CocoaAsyncSocket (7.6.5)
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
Expand All @@ -17,6 +19,7 @@ PODS:
- Flutter

DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`)
Expand All @@ -30,6 +33,8 @@ SPEC REPOS:
- CocoaAsyncSocket

EXTERNAL SOURCES:
app_links:
:path: ".symlinks/plugins/app_links/ios"
Flutter:
:path: Flutter
flutter_local_notifications:
Expand All @@ -46,8 +51,9 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
app_links: e70ca16b4b0f88253b3b3660200d4a10b4ea9795
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
Expand All @@ -57,4 +63,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: b2bb71756d032256bcb4043384dd40772d5e6a93

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
8 changes: 4 additions & 4 deletions dev/e2e_app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1430;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -578,7 +578,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -656,7 +656,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -705,7 +705,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
11 changes: 11 additions & 0 deletions dev/e2e_app/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>patrol</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
22 changes: 22 additions & 0 deletions dev/e2e_app/lib/applink_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:flutter/material.dart';

class ApplinkScreen extends StatelessWidget {
const ApplinkScreen({super.key, required this.uri});

final Uri uri;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Applink Screen')),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Uri: $uri'),
Text('Path: ${uri.path}'),
Text('Query: ${uri.query}'),
],
),
);
}
}
13 changes: 13 additions & 0 deletions dev/e2e_app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:app_links/app_links.dart';
import 'package:e2e_app/applink_screen.dart';
import 'package:e2e_app/loading_screen.dart';
import 'package:e2e_app/location_screen.dart';
import 'package:e2e_app/notifications_screen.dart';
Expand Down Expand Up @@ -54,6 +56,7 @@ class ExampleHomePage extends StatefulWidget {
}

class _ExampleHomePageState extends State<ExampleHomePage> {
final _appLinks = AppLinks();
var _counter = 0;

void _incrementCounter([int value = 1]) {
Expand All @@ -72,6 +75,16 @@ class _ExampleHomePageState extends State<ExampleHomePage> {

@override
Widget build(BuildContext context) {
_appLinks.uriLinkStream.listen((uri) {
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (_) => ApplinkScreen(
uri: uri,
),
),
);
});

return Scaffold(
key: const Key('scaffold'),
appBar: AppBar(
Expand Down
6 changes: 4 additions & 2 deletions dev/e2e_app/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

import FlutterMacOS
import Foundation

import app_links
import flutter_local_notifications
import flutter_timezone
import geolocator_apple
import patrol

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
FlutterLocalNotificationsPlugin.register(
with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
FlutterTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterTimezonePlugin"))
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
PatrolPlugin.register(with: registry.registrar(forPlugin: "PatrolPlugin"))
Expand Down
8 changes: 7 additions & 1 deletion dev/e2e_app/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
PODS:
- app_links (1.0.0):
- FlutterMacOS
- CocoaAsyncSocket (7.6.5)
- flutter_local_notifications (0.0.1):
- FlutterMacOS
Expand All @@ -13,6 +15,7 @@ PODS:
- FlutterMacOS

DEPENDENCIES:
- app_links (from `Flutter/ephemeral/.symlinks/plugins/app_links/macos`)
- flutter_local_notifications (from `Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos`)
- flutter_timezone (from `Flutter/ephemeral/.symlinks/plugins/flutter_timezone/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
Expand All @@ -24,6 +27,8 @@ SPEC REPOS:
- CocoaAsyncSocket

EXTERNAL SOURCES:
app_links:
:path: Flutter/ephemeral/.symlinks/plugins/app_links/macos
flutter_local_notifications:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos
flutter_timezone:
Expand All @@ -36,6 +41,7 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/patrol/darwin

SPEC CHECKSUMS:
app_links: 10e0a0ab602ffaf34d142cd4862f29d34b303b2a
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
flutter_local_notifications: 3805ca215b2fb7f397d78b66db91f6a747af52e4
flutter_timezone: 6b906d1740654acb16e50b639835628fea851037
Expand All @@ -45,4 +51,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 4dcdd5fa8959bf7a21c4e3da36b083ff9ad52d38

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion dev/e2e_app/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
11 changes: 11 additions & 0 deletions dev/e2e_app/macos/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>patrol</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSMinimumSystemVersion</key>
Expand Down
32 changes: 28 additions & 4 deletions dev/e2e_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.11.3"
app_links:
dependency: "direct main"
description:
name: app_links
sha256: "96e677810b83707ff5e10fac11e4839daa0ea4e0123c35864c092699165eb3db"
url: "https://pub.dev"
source: hosted
version: "6.1.1"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -304,6 +312,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
gtk:
dependency: transitive
description:
name: gtk
sha256: e8ce9ca4b1df106e4d72dad201d345ea1a036cc12c360f1a7d5a758f78ffa42c
url: "https://pub.dev"
source: hosted
version: "2.1.0"
hotreloader:
dependency: transitive
description:
Expand Down Expand Up @@ -430,15 +446,15 @@ packages:
path: "../../packages/patrol"
relative: true
source: path
version: "3.7.0"
version: "3.8.0"
patrol_finders:
dependency: transitive
description:
name: patrol_finders
sha256: "909a5c28ba1730e5e1e06e06ec78f4ccc49f7e211f3a0919adac552841df19ee"
sha256: "6bf2c3093fbccd02f80f73fafc1bd021d76410cbab6e329be220b5e3bc58f072"
url: "https://pub.dev"
source: hosted
version: "2.0.1+1"
version: "2.1.2"
permission_handler:
dependency: "direct main"
description:
Expand Down Expand Up @@ -644,6 +660,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
webview_flutter:
dependency: "direct main"
description:
Expand Down Expand Up @@ -702,4 +726,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
flutter: ">=3.22.0"
1 change: 1 addition & 0 deletions dev/e2e_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environment:
flutter: '>=3.16.0'

dependencies:
app_links: ^6.1.1
cupertino_icons: ^1.0.6
flutter:
sdk: flutter
Expand Down
1 change: 1 addition & 0 deletions docs/native/feature-parity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impossible to reach 100%. macOS support is still in alpha, so it has no native f
| [Open notifications] | ✅ | ✅ | ❌ |
| [Tap on notification] | ✅ | ✅ | ❌ |
| [Open quick settings] | ✅ | ✅ | ❌ |
| [Open url] | ✅ | ✅ | ✅ |
| [Toggle dark mode] | ✅ | ✅ | ❌ |
| [Toggle airplane mode] | ✅ see [#1359] | ✅ | ❌ |
| [Toggle cellular] | ✅ | ✅ | ❌ |
Expand Down
4 changes: 4 additions & 0 deletions packages/patrol/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.8.0

- Add `openUrl(String url)` method, for testing deeplinks. (#2219)

## 3.7.3

- Try closing system dialog when disabling wifi on iOS. (#2123)
Expand Down
Loading
Loading