Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e41ea0e
add android show title customization functionality
Alex-Usmanov Oct 17, 2023
fb67692
Pass the parameter
Alex-Usmanov Oct 17, 2023
21cd06f
Dependency overrides
Alex-Usmanov Oct 17, 2023
276c08b
Add tests for native side
Alex-Usmanov Oct 17, 2023
1897451
Cover dart side with tests
Alex-Usmanov Oct 17, 2023
5cd1709
Format
Alex-Usmanov Oct 17, 2023
bc943c5
Reduce code repetition
Alex-Usmanov Oct 17, 2023
d6306ba
Revert todo change
Alex-Usmanov Oct 18, 2023
f59475b
Wrap browser customization values in another configuration object
Alex-Usmanov Oct 20, 2023
157343b
Remove deps overrides
Alex-Usmanov Oct 20, 2023
ae20b08
Revert more deps overrides
Alex-Usmanov Oct 20, 2023
214b0a9
Revert web as well
Alex-Usmanov Oct 20, 2023
cd7dfc9
Revert go_router
Alex-Usmanov Oct 20, 2023
d205c7c
Merge branch 'main' into main
Alex-Usmanov Oct 20, 2023
5eef662
Merge remote-tracking branch 'upstream/main'
Alex-Usmanov Oct 27, 2023
c86ff6e
Format files
Alex-Usmanov Oct 27, 2023
92b2197
Fix tests
Alex-Usmanov Oct 27, 2023
425617e
Add browseroptions to launchUrlString & add more tests
Alex-Usmanov Oct 30, 2023
ece2b78
Fix docstrings
Alex-Usmanov Dec 7, 2023
3ddd644
Revert test format change
Alex-Usmanov Dec 7, 2023
cd361d0
Fix tests
Alex-Usmanov Dec 8, 2023
f0017b7
Version bumps and changelogs
Alex-Usmanov Dec 8, 2023
6105671
Merge remote-tracking branch 'upstream/main'
Alex-Usmanov Dec 8, 2023
a50be0f
Return path-based dependencies
Alex-Usmanov Dec 8, 2023
ef9c154
Add licences
Alex-Usmanov Dec 11, 2023
f4b08cb
Merge remote-tracking branch 'upstream/main'
Alex-Usmanov Dec 11, 2023
80d439b
Fix documentation & changelog
Alex-Usmanov Dec 26, 2023
992d38e
Merge remote-tracking branch 'upstream/main'
Alex-Usmanov Dec 26, 2023
193c076
Add backticks to SFSafariViewController in platform interface changelog
Alex-Usmanov Jan 4, 2024
b399c9b
Merge remote-tracking branch 'upstream/main'
Alex-Usmanov Jan 4, 2024
1ad83a2
More merging
Alex-Usmanov Jan 4, 2024
298a705
Merge remote-tracking branch 'upstream/main' into show-title
Alex-Usmanov Feb 12, 2024
70f5eb0
Merge remote-tracking branch 'upstream/main' into show-title
Alex-Usmanov Mar 31, 2024
8f67ab9
Remove dependency overrides
Alex-Usmanov Mar 31, 2024
c203ae0
Revert changelog
Alex-Usmanov Apr 1, 2024
5ae7bc9
Merge branch 'main' into show-title
Alex-Usmanov Apr 7, 2024
e646958
Merge remote-tracking branch 'upstream/main' into show-title
Alex-Usmanov May 10, 2024
7d92695
Merge remote-tracking branch 'upstream/main' into show-title
Alex-Usmanov May 21, 2024
90360b0
Fix missing classname in type_conversion.dart
Alex-Usmanov Jun 3, 2024
647a8ce
Merge remote-tracking branch 'upstream/main' into show-title
Alex-Usmanov Jun 3, 2024
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
Prev Previous commit
Next Next commit
Format files
  • Loading branch information
Alex-Usmanov committed Oct 27, 2023
commit c86ff6ef53d0c76ac5db5976ee2ff3b8276f2251
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/** Generated class from Pigeon. */
Expand All @@ -35,8 +31,7 @@ public static class FlutterError extends RuntimeException {
/** The error details. Must be a datatype supported by the api codec. */
public final Object details;

public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details)
{
public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) {
super(message);
this.code = code;
this.details = details;
Expand All @@ -55,15 +50,15 @@ protected static ArrayList<Object> wrapError(@NonNull Throwable exception) {
errorList.add(exception.toString());
errorList.add(exception.getClass().getSimpleName());
errorList.add(
"Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
"Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
}
return errorList;
}

/**
* Configuration options for an in-app WebView.
*
* Generated class from Pigeon that represents data sent in messages.
* <p>Generated class from Pigeon that represents data sent in messages.
*/
public static final class WebViewOptions {
private @NonNull Boolean enableJavaScript;
Expand Down Expand Up @@ -244,19 +239,20 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) {
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface UrlLauncherApi {
/** Returns true if the URL can definitely be launched. */
@NonNull
@NonNull
Boolean canLaunchUrl(@NonNull String url);
/** Opens the URL externally, returning true if successful. */
@NonNull
@NonNull
Boolean launchUrl(@NonNull String url, @NonNull Map<String, String> headers);
/**
* Opens the URL in an in-app WebView, returning true if it opens
* successfully.
*/
@NonNull
Boolean openUrlInApp(@NonNull String url, @NonNull Boolean allowCustomTab, @NonNull WebViewOptions webViewOptions, @NonNull BrowserOptions browserOptions);

@NonNull
/** Opens the URL in an in-app WebView, returning true if it opens successfully. */
@NonNull
Boolean openUrlInApp(
@NonNull String url,
@NonNull Boolean allowCustomTab,
@NonNull WebViewOptions webViewOptions,
@NonNull BrowserOptions browserOptions);

@NonNull
Boolean supportsCustomTabs();
/** Closes the view opened by [openUrlInSafariViewController]. */
void closeWebView();
Expand All @@ -265,12 +261,14 @@ public interface UrlLauncherApi {
static @NonNull MessageCodec<Object> getCodec() {
return UrlLauncherApiCodec.INSTANCE;
}
/**Sets up an instance of `UrlLauncherApi` to handle messages through the `binaryMessenger`. */
/** Sets up an instance of `UrlLauncherApi` to handle messages through the `binaryMessenger`. */
static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLauncherApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.canLaunchUrl", getCodec());
binaryMessenger,
"dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.canLaunchUrl",
getCodec());
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Expand All @@ -280,8 +278,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLaunche
try {
Boolean output = api.canLaunchUrl(urlArg);
wrapped.add(0, output);
}
catch (Throwable exception) {
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
Expand All @@ -294,7 +291,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLaunche
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.launchUrl", getCodec());
binaryMessenger,
"dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.launchUrl",
getCodec());
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Expand All @@ -305,8 +304,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLaunche
try {
Boolean output = api.launchUrl(urlArg, headersArg);
wrapped.add(0, output);
}
catch (Throwable exception) {
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
Expand All @@ -319,7 +317,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLaunche
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.openUrlInApp", getCodec());
binaryMessenger,
"dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.openUrlInApp",
getCodec());
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Expand All @@ -330,10 +330,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLaunche
WebViewOptions webViewOptionsArg = (WebViewOptions) args.get(2);
BrowserOptions browserOptionsArg = (BrowserOptions) args.get(3);
try {
Boolean output = api.openUrlInApp(urlArg, allowCustomTabArg, webViewOptionsArg, browserOptionsArg);
Boolean output =
api.openUrlInApp(
urlArg, allowCustomTabArg, webViewOptionsArg, browserOptionsArg);
wrapped.add(0, output);
}
catch (Throwable exception) {
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
Expand All @@ -346,16 +347,17 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLaunche
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.supportsCustomTabs", getCodec());
binaryMessenger,
"dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.supportsCustomTabs",
getCodec());
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
try {
Boolean output = api.supportsCustomTabs();
wrapped.add(0, output);
}
catch (Throwable exception) {
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
Expand All @@ -368,16 +370,17 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable UrlLaunche
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.closeWebView", getCodec());
binaryMessenger,
"dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.closeWebView",
getCodec());
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
try {
api.closeWebView();
wrapped.add(0, null);
}
catch (Throwable exception) {
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import androidx.annotation.VisibleForTesting;
import androidx.browser.customtabs.CustomTabsClient;
import androidx.browser.customtabs.CustomTabsIntent;
import io.flutter.plugins.urllauncher.Messages.BrowserOptions;
import io.flutter.plugins.urllauncher.Messages.UrlLauncherApi;
import io.flutter.plugins.urllauncher.Messages.WebViewOptions;
import io.flutter.plugins.urllauncher.Messages.BrowserOptions;
import java.util.Collections;
import java.util.Locale;
import java.util.Map;
Expand Down
42 changes: 27 additions & 15 deletions packages/url_launcher/url_launcher_android/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class _UrlLauncherApiCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
case 128:
return BrowserOptions.decode(readValue(buffer)!);
case 129:
case 129:
return WebViewOptions.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
Expand All @@ -105,7 +105,8 @@ class UrlLauncherApi {
/// Returns true if the URL can definitely be launched.
Future<bool> canLaunchUrl(String arg_url) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.canLaunchUrl', codec,
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.canLaunchUrl',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_url]) as List<Object?>?;
Expand All @@ -131,9 +132,11 @@ class UrlLauncherApi {
}

/// Opens the URL externally, returning true if successful.
Future<bool> launchUrl(String arg_url, Map<String?, String?> arg_headers) async {
Future<bool> launchUrl(
String arg_url, Map<String?, String?> arg_headers) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.launchUrl', codec,
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.launchUrl',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_url, arg_headers]) as List<Object?>?;
Expand All @@ -160,12 +163,21 @@ class UrlLauncherApi {

/// Opens the URL in an in-app WebView, returning true if it opens
/// successfully.
Future<bool> openUrlInApp(String arg_url, bool arg_allowCustomTab, WebViewOptions arg_webViewOptions, BrowserOptions arg_browserOptions) async {
Future<bool> openUrlInApp(
String arg_url,
bool arg_allowCustomTab,
WebViewOptions arg_webViewOptions,
BrowserOptions arg_browserOptions) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.openUrlInApp', codec,
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.openUrlInApp',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_url, arg_allowCustomTab, arg_webViewOptions, arg_browserOptions]) as List<Object?>?;
final List<Object?>? replyList = await channel.send(<Object?>[
arg_url,
arg_allowCustomTab,
arg_webViewOptions,
arg_browserOptions
]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
Expand All @@ -189,10 +201,10 @@ class UrlLauncherApi {

Future<bool> supportsCustomTabs() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.supportsCustomTabs', codec,
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.supportsCustomTabs',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(null) as List<Object?>?;
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
Expand All @@ -217,10 +229,10 @@ class UrlLauncherApi {
/// Closes the view opened by [openUrlInSafariViewController].
Future<void> closeWebView() async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.closeWebView', codec,
'dev.flutter.pigeon.url_launcher_android.UrlLauncherApi.closeWebView',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(null) as List<Object?>?;
final List<Object?>? replyList = await channel.send(null) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
Expand Down