This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[url_launcher] Convert Windows to Pigeon #6991
Merged
auto-submit
merged 10 commits into
flutter-team-archive:main
from
stuartmorgan-g:url-launcher-windows-pigeon
Jan 25, 2023
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8dd4845
Initial definition matching current API
stuartmorgan-g 66233b6
Rename, autoformat
stuartmorgan-g f40164d
Update native implementation and unit tests
stuartmorgan-g 938ac6a
Update Dart; remove unnecessary Pigeon test API
stuartmorgan-g 7056e0d
Version bump
stuartmorgan-g fbff3bb
autoformat
stuartmorgan-g 3fbffb8
Adjust mock API setup
stuartmorgan-g b9f430b
Improve comment
stuartmorgan-g ee06e05
Merge branch 'main' into url-launcher-windows-pigeon
stuartmorgan-g 04604dc
Merge branch 'main' into url-launcher-windows-pigeon
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
71 changes: 71 additions & 0 deletions
71
packages/url_launcher/url_launcher_windows/lib/src/messages.g.dart
This file contains hidden or 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,71 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
| // Autogenerated from Pigeon (v5.0.1), do not edit directly. | ||
| // See also: https://pub.dev/packages/pigeon | ||
| // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import | ||
| import 'dart:async'; | ||
| import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; | ||
|
|
||
| import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; | ||
| import 'package:flutter/services.dart'; | ||
|
|
||
| class UrlLauncherApi { | ||
| /// Constructor for [UrlLauncherApi]. The [binaryMessenger] named argument is | ||
| /// available for dependency injection. If it is left null, the default | ||
| /// BinaryMessenger will be used which routes to the host platform. | ||
| UrlLauncherApi({BinaryMessenger? binaryMessenger}) | ||
| : _binaryMessenger = binaryMessenger; | ||
| final BinaryMessenger? _binaryMessenger; | ||
|
|
||
| static const MessageCodec<Object?> codec = StandardMessageCodec(); | ||
|
|
||
| Future<bool> canLaunchUrl(String arg_url) async { | ||
| final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( | ||
| 'dev.flutter.pigeon.UrlLauncherApi.canLaunchUrl', codec, | ||
| binaryMessenger: _binaryMessenger); | ||
| final List<Object?>? replyList = | ||
| await channel.send(<Object?>[arg_url]) as List<Object?>?; | ||
| if (replyList == null) { | ||
| throw PlatformException( | ||
| code: 'channel-error', | ||
| message: 'Unable to establish connection on channel.', | ||
| ); | ||
| } else if (replyList.length > 1) { | ||
| throw PlatformException( | ||
| code: replyList[0]! as String, | ||
| message: replyList[1] as String?, | ||
| details: replyList[2], | ||
| ); | ||
| } else if (replyList[0] == null) { | ||
| throw PlatformException( | ||
| code: 'null-error', | ||
| message: 'Host platform returned null value for non-null return value.', | ||
| ); | ||
| } else { | ||
| return (replyList[0] as bool?)!; | ||
| } | ||
| } | ||
|
|
||
| Future<void> launchUrl(String arg_url) async { | ||
| final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( | ||
| 'dev.flutter.pigeon.UrlLauncherApi.launchUrl', codec, | ||
| binaryMessenger: _binaryMessenger); | ||
| final List<Object?>? replyList = | ||
| await channel.send(<Object?>[arg_url]) as List<Object?>?; | ||
| if (replyList == null) { | ||
| throw PlatformException( | ||
| code: 'channel-error', | ||
| message: 'Unable to establish connection on channel.', | ||
| ); | ||
| } else if (replyList.length > 1) { | ||
| throw PlatformException( | ||
| code: replyList[0]! as String, | ||
| message: replyList[1] as String?, | ||
| details: replyList[2], | ||
| ); | ||
| } else { | ||
| return; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
3 changes: 3 additions & 0 deletions
3
packages/url_launcher/url_launcher_windows/pigeons/copyright.txt
This file contains hidden or 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,3 @@ | ||
| Copyright 2013 The Flutter Authors. All rights reserved. | ||
| Use of this source code is governed by a BSD-style license that can be | ||
| found in the LICENSE file. |
18 changes: 18 additions & 0 deletions
18
packages/url_launcher/url_launcher_windows/pigeons/messages.dart
This file contains hidden or 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,18 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:pigeon/pigeon.dart'; | ||
|
|
||
| @ConfigurePigeon(PigeonOptions( | ||
| dartOut: 'lib/src/messages.g.dart', | ||
| cppOptions: CppOptions(namespace: 'url_launcher_windows'), | ||
| cppHeaderOut: 'windows/messages.g.h', | ||
| cppSourceOut: 'windows/messages.g.cpp', | ||
| copyrightHeader: 'pigeons/copyright.txt', | ||
| )) | ||
| @HostApi(dartHostTestHandler: 'TestUrlLauncherApi') | ||
| abstract class UrlLauncherApi { | ||
| bool canLaunchUrl(String url); | ||
| void launchUrl(String url); | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.