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

Commit

Permalink
Implement PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
BeMacized committed Feb 3, 2022
1 parent e76b994 commit 736995c
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 567 deletions.
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher_android/CHANGELOG.md
@@ -1,6 +1,6 @@
## 6.0.15

* Moved away from shared method channel implementation.
* Switches to an in-package method channel implementation.

## 6.0.14

Expand Down
Expand Up @@ -11,7 +11,7 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface.
const MethodChannel _channel =
MethodChannel('plugins.flutter.io/url_launcher_android');

/// An implementation of [UrlLauncherPlatform] that uses method channels.
/// An implementation of [UrlLauncherPlatform] for Android.
class UrlLauncherAndroid extends UrlLauncherPlatform {
/// Registers this class as the default instance of [UrlLauncherPlatform].
static void registerWith() {
Expand Down Expand Up @@ -49,7 +49,6 @@ class UrlLauncherAndroid extends UrlLauncherPlatform {
'launch',
<String, Object>{
'url': url,
'useSafariVC': useSafariVC,
'useWebView': useWebView,
'enableJavaScript': enableJavaScript,
'enableDomStorage': enableDomStorage,
Expand Down
Expand Up @@ -5,6 +5,7 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:url_launcher_android/url_launcher_android.dart';
import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart';

void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -27,6 +28,11 @@ void main() {
log.clear();
});

test('registers instance', () {
UrlLauncherAndroid.registerWith();
expect(UrlLauncherPlatform.instance, isA<UrlLauncherAndroid>());
});

test('canLaunch', () async {
await launcher.canLaunch('http://example.com/');
expect(
Expand Down Expand Up @@ -60,7 +66,6 @@ void main() {
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
Expand All @@ -86,7 +91,6 @@ void main() {
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
Expand All @@ -97,32 +101,6 @@ void main() {
);
});

test('launch force SafariVC', () async {
await launcher.launch(
'http://example.com/',
useSafariVC: true,
useWebView: false,
enableJavaScript: false,
enableDomStorage: false,
universalLinksOnly: false,
headers: const <String, String>{},
);
expect(
log,
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': false,
'headers': <String, String>{},
})
],
);
});

test('launch universal links only', () async {
await launcher.launch(
'http://example.com/',
Expand All @@ -138,7 +116,6 @@ void main() {
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': false,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
Expand All @@ -164,7 +141,6 @@ void main() {
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': true,
'enableJavaScript': false,
'enableDomStorage': false,
Expand All @@ -190,7 +166,6 @@ void main() {
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': true,
'enableJavaScript': true,
'enableDomStorage': false,
Expand All @@ -216,7 +191,6 @@ void main() {
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': true,
'enableJavaScript': false,
'enableDomStorage': true,
Expand All @@ -227,32 +201,6 @@ void main() {
);
});

test('launch force SafariVC to false', () async {
await launcher.launch(
'http://example.com/',
useSafariVC: false,
useWebView: false,
enableJavaScript: false,
enableDomStorage: false,
universalLinksOnly: false,
headers: const <String, String>{},
);
expect(
log,
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': false,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': false,
'headers': <String, String>{},
})
],
);
});

test('launch should return false if platform returns null', () async {
final bool launched = await launcher.launch(
'http://example.com/',
Expand Down
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher_ios/CHANGELOG.md
@@ -1,6 +1,6 @@
## 6.0.15

* Moved away from shared method channel implementation.
* Switches to an in-package method channel implementation.

## 6.0.14

Expand Down
Expand Up @@ -11,7 +11,7 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface.
const MethodChannel _channel =
MethodChannel('plugins.flutter.io/url_launcher_ios');

/// An implementation of [UrlLauncherPlatform] that uses method channels.
/// An implementation of [UrlLauncherPlatform] for iOS.
class UrlLauncherIOS extends UrlLauncherPlatform {
/// Registers this class as the default instance of [UrlLauncherPlatform].
static void registerWith() {
Expand Down Expand Up @@ -50,7 +50,6 @@ class UrlLauncherIOS extends UrlLauncherPlatform {
<String, Object>{
'url': url,
'useSafariVC': useSafariVC,
'useWebView': useWebView,
'enableJavaScript': enableJavaScript,
'enableDomStorage': enableDomStorage,
'universalLinksOnly': universalLinksOnly,
Expand Down
Expand Up @@ -5,6 +5,7 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:url_launcher_ios/url_launcher_ios.dart';
import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart';

void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -27,6 +28,11 @@ void main() {
log.clear();
});

test('registers instance', () {
UrlLauncherIOS.registerWith();
expect(UrlLauncherPlatform.instance, isA<UrlLauncherIOS>());
});

test('canLaunch', () async {
await launcher.canLaunch('http://example.com/');
expect(
Expand Down Expand Up @@ -61,7 +67,6 @@ void main() {
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': false,
Expand All @@ -87,7 +92,6 @@ void main() {
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': false,
Expand All @@ -113,7 +117,6 @@ void main() {
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': false,
Expand All @@ -139,7 +142,6 @@ void main() {
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': false,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': true,
Expand All @@ -149,84 +151,6 @@ void main() {
);
});

test('launch force WebView', () async {
await launcher.launch(
'http://example.com/',
useSafariVC: true,
useWebView: true,
enableJavaScript: false,
enableDomStorage: false,
universalLinksOnly: false,
headers: const <String, String>{},
);
expect(
log,
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': true,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': false,
'headers': <String, String>{},
})
],
);
});

test('launch force WebView enable javascript', () async {
await launcher.launch(
'http://example.com/',
useSafariVC: true,
useWebView: true,
enableJavaScript: true,
enableDomStorage: false,
universalLinksOnly: false,
headers: const <String, String>{},
);
expect(
log,
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': true,
'enableJavaScript': true,
'enableDomStorage': false,
'universalLinksOnly': false,
'headers': <String, String>{},
})
],
);
});

test('launch force WebView enable DOM storage', () async {
await launcher.launch(
'http://example.com/',
useSafariVC: true,
useWebView: true,
enableJavaScript: false,
enableDomStorage: true,
universalLinksOnly: false,
headers: const <String, String>{},
);
expect(
log,
<Matcher>[
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': true,
'useWebView': true,
'enableJavaScript': false,
'enableDomStorage': true,
'universalLinksOnly': false,
'headers': <String, String>{},
})
],
);
});

test('launch force SafariVC to false', () async {
await launcher.launch(
'http://example.com/',
Expand All @@ -243,7 +167,6 @@ void main() {
isMethodCall('launch', arguments: <String, Object>{
'url': 'http://example.com/',
'useSafariVC': false,
'useWebView': false,
'enableJavaScript': false,
'enableDomStorage': false,
'universalLinksOnly': false,
Expand Down
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher_linux/CHANGELOG.md
@@ -1,6 +1,6 @@
## 2.0.4

* Moved away from shared method channel implementation.
* Switches to an in-package method channel implementation.

## 2.0.3

Expand Down
Expand Up @@ -11,7 +11,7 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface.
const MethodChannel _channel =
MethodChannel('plugins.flutter.io/url_launcher_linux');

/// An implementation of [UrlLauncherPlatform] that uses method channels.
/// An implementation of [UrlLauncherPlatform] for Linux.
class UrlLauncherLinux extends UrlLauncherPlatform {
/// Registers this class as the default instance of [UrlLauncherPlatform].
static void registerWith() {
Expand Down Expand Up @@ -44,8 +44,6 @@ class UrlLauncherLinux extends UrlLauncherPlatform {
'launch',
<String, Object>{
'url': url,
'useSafariVC': useSafariVC,
'useWebView': useWebView,
'enableJavaScript': enableJavaScript,
'enableDomStorage': enableDomStorage,
'universalLinksOnly': universalLinksOnly,
Expand Down

0 comments on commit 736995c

Please sign in to comment.