From b5c995b1139bd4ba06906c7860e2bb987079c3e3 Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Mon, 1 Jul 2024 17:50:30 +0900 Subject: [PATCH 1/2] Enable documentation linting with markdownlint --- .github/workflows/docs.yml | 21 +++++++++++++++++++ .markdownlint-cli2.yaml | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 .markdownlint-cli2.yaml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..72b79a8 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,21 @@ +name: CI for all of docs + +on: + push: + branches: + - main + - develop + paths: + - '**.md' + pull_request: + paths: + - '**.md' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DavidAnson/markdownlint-cli2-action@v16 + with: + globs: '**/*.md' \ No newline at end of file diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..fb4960b --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,42 @@ +# Extended Markdownlint configuration in doc/.markdownlint/ +# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for explanations of each rule +config: + # First, set the default + default: true + + # MD001 + heading-increment: false + # MD004 + ul-style: + style: dash + # MD013 + line-length: false + # MD024 + no-duplicate-heading: + siblings_only: true + # MD025 + single-title: false + # MD026 + no-trailing-punctuation: + punctuation: ".,;:!。,;:!?" + # MD029 + ol-prefix: + style: one + # MD033 + no-inline-html: + allowed_elements: + - br + - table + - tr + - td + # MD035 + hr-style: + style: "---" + # MD41 + first-line-h1: false + # MD046 + code-block-style: + style: fenced +ignores: + - LICENSE + - "**/.symlinks/**" \ No newline at end of file From fbcf71a6fd068bbb7b1e33b3a411994df1d8b1c5 Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Mon, 1 Jul 2024 17:53:55 +0900 Subject: [PATCH 2/2] Addressed markdownlint warnings throughout the codebase --- README.md | 17 -------- flutter_custom_tabs/CHANGELOG.md | 4 +- flutter_custom_tabs/README.md | 43 ++++++++----------- flutter_custom_tabs/doc/migration-guides.md | 13 ++++-- .../LaunchImage.imageset/README.md | 5 --- .../LaunchImage.imageset/README.md | 5 --- flutter_custom_tabs_android/CHANGELOG.md | 3 +- flutter_custom_tabs_ios/CHANGELOG.md | 1 - flutter_custom_tabs_ios/README.md | 1 - .../LaunchImage.imageset/README.md | 5 --- .../README.md | 4 +- flutter_custom_tabs_web/README.md | 2 +- flutter_custom_tabs_web/example/README.md | 12 +++--- 13 files changed, 41 insertions(+), 74 deletions(-) delete mode 100644 flutter_custom_tabs/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md delete mode 100644 flutter_custom_tabs/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md delete mode 100644 flutter_custom_tabs_ios/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/README.md b/README.md index 0aa2a0c..6452028 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,3 @@ A Flutter plugin to launch a URL in Custom Tabs with a similar feel to [url_laun which allows you to add the browser experience that Custom Tabs provides to your mobile apps. This plugin is built as federated plugins, see the app facing package [flutter_custom_tabs](./flutter_custom_tabs) for details. - -## License - - Copyright (C) 2015 The Android Open Source Project - Copyright (C) 2018 Shinya Kumagai - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/flutter_custom_tabs/CHANGELOG.md b/flutter_custom_tabs/CHANGELOG.md index 2466908..fb0ca59 100644 --- a/flutter_custom_tabs/CHANGELOG.md +++ b/flutter_custom_tabs/CHANGELOG.md @@ -5,6 +5,7 @@ ## 2.0.0 Highlights of changes from v1.x: + - Refactors the signature for launching a URL in Custom Tabs. - Refactors the signature for manually closing Custom Tabs. - Supports the launch of a deep link URL. @@ -16,7 +17,6 @@ Highlights of changes from v1.x: **NOTE:** Version 2.0.0 includes many breaking changes from version 1.x. For more information, please refer to the [migration guide](https://github.com/droibit/flutter_custom_tabs/blob/main/flutter_custom_tabs/doc/migration-guides.md#migrate-flutter_custom_tabs-from-v1x-to-v200). - ## 2.0.0-beta.2 - Supports launching a URL in an external browser ([#157](https://github.com/droibit/flutter_custom_tabs/pull/157)). @@ -84,7 +84,7 @@ For details on the changes, please refer to the [migration guide](https://github - Update to Android CustomTabsLauncher 1.0.6([#62](https://github.com/droibit/flutter_custom_tabs/pull/62)). -## 1.0.3, +## 1.0.3 - Migrate from deprecated gradle getGenerateBuildConfig to buildFeatures([#49](https://github.com/droibit/flutter_custom_tabs/pull/49)). - Avoiding app crashes caused by URLs containing whitespaces([#50](https://github.com/droibit/flutter_custom_tabs/issues/50), [#52](https://github.com/droibit/flutter_custom_tabs/pull/52)). diff --git a/flutter_custom_tabs/README.md b/flutter_custom_tabs/README.md index 6a4840c..ca2fa99 100644 --- a/flutter_custom_tabs/README.md +++ b/flutter_custom_tabs/README.md @@ -1,10 +1,12 @@ # flutter_custom_tabs + [![pub package](https://img.shields.io/pub/v/flutter_custom_tabs.svg)](https://pub.dartlang.org/packages/flutter_custom_tabs) A Flutter plugin for mobile apps to launch a URL in Custom Tabs. The plugin allows you to add the browser experience that Custom Tabs provides to your mobile apps. In version 2.0, the plugin expands the support for launching a URL in mobile apps: + - Launch a URL in an external browser. - Launch a deep link URL. @@ -14,6 +16,7 @@ In version 2.0, the plugin expands the support for launching a URL in mobile app | Implementation | [Custom Tabs](https://developer.chrome.com/docs/android/custom-tabs/) | [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) | [url_launcher](https://pub.dev/packages/url_launcher) | ## Getting Started + Add `flutter_custom_tabs` to the dependencies of your `pubspec.yaml`. ``` yaml @@ -25,6 +28,7 @@ dependencies: > v2.0.0 includes breaking changes from v1.x. Please refer to the [migration guide](https://github.com/droibit/flutter_custom_tabs/blob/main/flutter_custom_tabs/doc/migration-guides.md) when updating the plugin. ### Requirements for Android + - Android Gradle Plugin v7.4.0 and above. - Kotlin v1.7.0 and above. @@ -40,6 +44,7 @@ buildscript { ``` ## Usage + You can launch a web URL similar to `url_launcher` and specify options to customize appearance and behavior. | Android | iOS | @@ -86,7 +91,7 @@ See the example app for more complex examples. ### Usage of the lightweight version -This package supports a wide range of Custom Tabs customizations, +This package supports a wide range of Custom Tabs customizations, but we have introduced a lightweight URL launch for users who don't need as much in v2.0.0. > [!NOTE] @@ -127,19 +132,21 @@ void _launchURL(BuildContext context) async { | Change visibility of web page title | ✅ | - | ✅
(always shown on Android) | | Change the availability of Reader mode | - | ✅ | Not provided | | Change appearance of close button | ✅
(Icon, position) | ✅
(Predefined button styles) | Not provided | -| Change the availability of [Instant Apps](https://developer.android.com/topic/instant-apps/index.html) | ✅ | - | Not provided | -| Change animation style | ✅ | ✅
(Predefined modal presentation styles) | Not provided | +| Change the availability of [Instant Apps](https://developer.android.com/topic/instant-apps/index.html) | ✅ | - | Not provided | +| Change animation style | ✅ | ✅
(Predefined modal presentation styles) | Not provided | | Prefer the default browser over Chrome | ✅ | - | Not provided | -| Pass HTTP headers | ✅ | - | Not provided | -| Show as a bottom sheet | ✅ | ✅ | Not provided | +| Pass HTTP headers | ✅ | - | Not provided | +| Show as a bottom sheet | ✅ | ✅ | Not provided | Support status in `flutter_custom_tabs`: + - ✅: Supported. - `-`: Option not provided by Custom Tabs implementation. ## Advanced Usage ### Deep Linking + Supports launching a deep link URL. (If a native app that responds to the deep link URL is installed, it will directly launch it. otherwise, it will launch a custom tab.) @@ -167,6 +174,7 @@ Future _launchDeepLinkURL(BuildContext context) async { ``` ## Launch in an external browser + By default, if no mobile platform-specific options are specified, a URL will be launched in an external browser. > [!TIP] @@ -181,11 +189,13 @@ Future _launchInExternalBrowser() async { ``` ### Show as a bottom sheet + You can launch a URL in Custom Tabs as a bottom sheet. Requirements: + - Android: Chrome v107 and above or [other browsers](https://developer.chrome.com/docs/android/custom-tabs/browser-support/#setinitialactivityheightpx) -- iOS: 15.0+ +- iOS: 15.0+ ```dart import 'package:flutter/material.dart'; @@ -223,11 +233,13 @@ Future _launchURLInBottomSheet(BuildContext context) async { ``` ### Prefer the default browser over Chrome -On Android, the plugin defaults to launching Chrome, which supports all Custom Tabs features. + +On Android, the plugin defaults to launching Chrome, which supports all Custom Tabs features. You can prioritize launching the default browser on the device that supports Custom Tabs over Chrome. > [!NOTE] > Some browsers may not support the options specified in `CustomTabsOptions`. +> > - See: [Custom Tabs Browser Support](https://developer.chrome.com/docs/android/custom-tabs/browser-support/). ```dart @@ -256,20 +268,3 @@ Future _closeCustomTabsManually() async { await closeCustomTabs(); } ``` - -## License - - Copyright (C) 2015 The Android Open Source Project - Copyright (C) 2018 Shinya Kumagai - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/flutter_custom_tabs/doc/migration-guides.md b/flutter_custom_tabs/doc/migration-guides.md index eb3110a..6978c42 100644 --- a/flutter_custom_tabs/doc/migration-guides.md +++ b/flutter_custom_tabs/doc/migration-guides.md @@ -1,11 +1,13 @@ # Migration Guides ## Migrate `flutter_custom_tabs` from v1.x to v2.0.0 + The first major update of `flutter_custom_tabs`, v2.0.0, includes a variety of new features and improvements, as well as some breaking changes. ### Breaking Changes #### API Change: `launch` to `launchUrl` + The `launch` method has been renamed to `launchUrl` for better clarity and consistency. Additionally, there are changes in the naming and types of some parameters: ```diff @@ -48,11 +50,13 @@ Future launchUrl( Related changes: + - The method `closeAllIfPossible` has been renamed to `closeCustomTabs`. #### API Changes in `CustomTabsOptions` The `CustomTabsOptions` class has undergone several changes: + - The customization of various colors, including the toolbar color, has been moved to the `CustomTabsColorSchemes` class. @@ -118,7 +122,6 @@ CustomTabsOptions( | `enableDefaultShare: true` | `shareState: CustomTabsShareState.on` | | `enableDefaultShare: false` | `shareState: CustomTabsShareState.off` | - - The method of specifying the close button has been changed from `closeButtonPosition` to the enhanced `closeButton`. To migrate, use the following equivalent options: @@ -155,6 +158,7 @@ CustomTabsOptions(
The following options for customizing the behavior of Custom Tabs as a browser have been consolidated into `CustomTabsBrowserConfiguration`: + - `headers` property - `extraCustomTabs` property @@ -216,6 +220,7 @@ Remaining name changes: The newly introduced `LaunchOptions` provides unified and simple options for Android/iOS. Start by importing the library file: + ```diff -import 'package:flutter_custom_tabs/flutter_custom_tabs.dart'; +import 'package:flutter_custom_tabs/flutter_custom_tabs_lite.dart'; @@ -270,12 +275,14 @@ await launchUrl( ## Migrate `flutter_custom_tabs` to v1.0.0 flutter_custom_tabs v1.0.0 is the first major release and has been updated to include several breaking changes. + - Migrate to federated plugins - Improved customization on iOS - Web support ### API Changes -* `launch` function now accepts two options. + +- `launch` function now accepts two options. - `customTabsOption`: for Android(optional) - `safariVCOption`: for iOS(optional) @@ -288,7 +295,7 @@ await launch( ); ``` -* The built-in animation for CustomTabs `CustomTabsAnimation` is now `CustomTabsSystemAnimation` +- The built-in animation for CustomTabs `CustomTabsAnimation` is now `CustomTabsSystemAnimation` - This clarifies the use of OS-supplied animations via plug-ins. ```diff diff --git a/flutter_custom_tabs/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/flutter_custom_tabs/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725..0000000 --- a/flutter_custom_tabs/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/flutter_custom_tabs/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md b/flutter_custom_tabs/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725..0000000 --- a/flutter_custom_tabs/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/flutter_custom_tabs_android/CHANGELOG.md b/flutter_custom_tabs_android/CHANGELOG.md index ea01ec1..0caf238 100644 --- a/flutter_custom_tabs_android/CHANGELOG.md +++ b/flutter_custom_tabs_android/CHANGELOG.md @@ -14,7 +14,6 @@ - Updates CustomTabsLauncher to [v2.0.0-rc01](https://github.com/droibit/CustomTabsLauncher/releases/tag/2.0.0-rc01)([#160](https://github.com/droibit/flutter_custom_tabs/pull/160)). - Adds unit tests for android platform ([#162](https://github.com/droibit/flutter_custom_tabs/pull/162)). - ## 2.0.0-beta.1 - Adds support for prioritizing the default browser over Chrome on Android([#145](https://github.com/droibit/flutter_custom_tabs/pull/145)). @@ -27,4 +26,4 @@ ## 2.0.0-beta -- Initial release of the `flutter_custom_tabs` Android implementation. \ No newline at end of file +- Initial release of the `flutter_custom_tabs` Android implementation. diff --git a/flutter_custom_tabs_ios/CHANGELOG.md b/flutter_custom_tabs_ios/CHANGELOG.md index f41e5c8..f9c08cb 100644 --- a/flutter_custom_tabs_ios/CHANGELOG.md +++ b/flutter_custom_tabs_ios/CHANGELOG.md @@ -10,7 +10,6 @@ - Adds unit tests for iOS platform ([#162](https://github.com/droibit/flutter_custom_tabs/pull/162)). - Properly callback URL launch results ([#164](https://github.com/droibit/flutter_custom_tabs/pull/164)). - ## 2.0.0-beta - Initial release of the `flutter_custom_tabs` iOS implementation. diff --git a/flutter_custom_tabs_ios/README.md b/flutter_custom_tabs_ios/README.md index dde993b..fa0100e 100644 --- a/flutter_custom_tabs_ios/README.md +++ b/flutter_custom_tabs_ios/README.md @@ -9,4 +9,3 @@ iOS platform implementation of [flutter_custom_tabs][1]. This package has been the endorsed implementation of `flutter_custom_tabs` for the iOS platform since version `2.0.0`. This means it will be automatically included in your app when you add it, so you do not need to include it in your `pubspec.yaml`. [1]: https://pub.dev/packages/flutter_custom_tabs - diff --git a/flutter_custom_tabs_ios/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md b/flutter_custom_tabs_ios/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725..0000000 --- a/flutter_custom_tabs_ios/example/ios/Runner/Resources/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/flutter_custom_tabs_platform_interface/README.md b/flutter_custom_tabs_platform_interface/README.md index a96f6d4..3d13530 100644 --- a/flutter_custom_tabs_platform_interface/README.md +++ b/flutter_custom_tabs_platform_interface/README.md @@ -19,8 +19,8 @@ platform-specific behavior, and when you register your plugin, set the default Strongly prefer non-breaking changes (such as adding a method to the interface) over breaking changes for this package. -See https://flutter.dev/go/platform-interface-breaking-changes for a discussion +See for a discussion on why a less-clean interface is preferable to a breaking change. [1]: ../flutter_custom_tabs -[2]: lib/flutter_custom_tabs_platform_interface.dart \ No newline at end of file +[2]: lib/flutter_custom_tabs_platform_interface.dart diff --git a/flutter_custom_tabs_web/README.md b/flutter_custom_tabs_web/README.md index f05a9f2..2183345 100644 --- a/flutter_custom_tabs_web/README.md +++ b/flutter_custom_tabs_web/README.md @@ -8,4 +8,4 @@ Web platform implementation of [flutter_custom_tabs][1]. This package has been the endorsed implementation of `flutter_custom_tabs` for the web platform since version `1.0.0`. This means it will be automatically included in your app when you add it, so you do not need to include it in your `pubspec.yaml`. -[1]: https://pub.dev/packages/flutter_custom_tabs \ No newline at end of file +[1]: https://pub.dev/packages/flutter_custom_tabs diff --git a/flutter_custom_tabs_web/example/README.md b/flutter_custom_tabs_web/example/README.md index 868ca8f..4e694e0 100644 --- a/flutter_custom_tabs_web/example/README.md +++ b/flutter_custom_tabs_web/example/README.md @@ -9,9 +9,9 @@ See [flutter.dev > Integration testing](https://flutter.dev/docs/testing/integra Make sure you have updated to the latest Flutter master. 1. Check what version of Chrome is running on the machine you're running tests on. -2. Download and install driver for that version from here: - * -3. Start the driver using `chromedriver --port=4444` -4. Run tests: `flutter drive -d web-server --browser-name=chrome --driver=test_driver/integration_test_driver.dart --target=integration_test/TEST_NAME.dart`, or (in Linux): - * Single: `./run_test.sh integration_test/TEST_NAME.dart` - * All: `./run_test.sh` +1. Download and install driver for that version from here: + - +1. Start the driver using `chromedriver --port=4444` +1. Run tests: `flutter drive -d web-server --browser-name=chrome --driver=test_driver/integration_test_driver.dart --target=integration_test/TEST_NAME.dart`, or (in Linux): + - Single: `./run_test.sh integration_test/TEST_NAME.dart` + - All: `./run_test.sh`