Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
4 changes: 4 additions & 0 deletions packages/url_launcher/url_launcher_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.0.38

* Updates android implementation to support api 34 broadcast receiver requirements.

## 6.0.37

* Sets android.defaults.buildfeatures.buildconfig to true for compatibility with AGP 8.0+.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ android {
}

dependencies {

// Java language implementation
implementation "androidx.core:core:1.10.1"
implementation 'androidx.annotation:annotation:1.6.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.1.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.core.content.ContextCompat;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -143,7 +144,11 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
webview.setWebChromeClient(new FlutterWebChromeClient());

// Register receiver that may finish this Activity.
registerReceiver(broadcastReceiver, closeIntentFilter);
ContextCompat.registerReceiver(
this,
broadcastReceiver,
closeIntentFilter,
ContextCompat.RECEIVER_EXPORTED);
}

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,27 @@ void main() {
// sms:, tel:, and mailto: links may not be openable on every device, so
// aren't tested here.
});

testWidgets('launch and close', (WidgetTester _) async {
final UrlLauncherPlatform launcher = UrlLauncherPlatform.instance;

// Launch a url then close.
expect(
await launcher.launch('https://flutter.dev',
useSafariVC: true,
useWebView: true,
enableJavaScript: false,
enableDomStorage: false,
universalLinksOnly: false,
headers: <String, String>{'my_header_key': 'my_header_value'}),
true);
// Allow time for page to load.
await Future.delayed(Duration(seconds: 3));
await launcher.closeWebView();
// Delay required to catch android side crashes in onDestroy
await Future.delayed(Duration(seconds: 3));

// sms:, tel:, and mailto: links may not be openable on every device, so
// aren't tested here.
});
}
3 changes: 1 addition & 2 deletions packages/url_launcher/url_launcher_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: url_launcher_android
description: Android implementation of the url_launcher plugin.
repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
version: 6.0.37

version: 6.0.38
environment:
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"
Expand Down