Skip to content

Commit

Permalink
Merge pull request #195 from droibit/feature/introduce_markdownlint
Browse files Browse the repository at this point in the history
Enable documentation linting with markdownlint
  • Loading branch information
droibit committed Jul 1, 2024
2 parents 233d589 + fbcf71a commit 0f9eced
Show file tree
Hide file tree
Showing 15 changed files with 104 additions and 74 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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'
42 changes: 42 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -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/**"
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 2 additions & 2 deletions flutter_custom_tabs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)).
Expand Down Expand Up @@ -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)).
Expand Down
43 changes: 19 additions & 24 deletions flutter_custom_tabs/README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand All @@ -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.

Expand All @@ -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 |
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -127,19 +132,21 @@ void _launchURL(BuildContext context) async {
| Change visibility of web page title || - | ✅<br>(always shown on Android) |
| Change the availability of Reader mode | - || Not provided |
| Change appearance of close button | ✅<br>(Icon, position) | ✅<br>(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 || ✅<br>(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 || ✅<br>(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.)

Expand Down Expand Up @@ -167,6 +174,7 @@ Future<void> _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]
Expand All @@ -181,11 +189,13 @@ Future<void> _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';
Expand Down Expand Up @@ -223,11 +233,13 @@ Future<void> _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
Expand Down Expand Up @@ -256,20 +268,3 @@ Future<void> _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.
13 changes: 10 additions & 3 deletions flutter_custom_tabs/doc/migration-guides.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -48,11 +50,13 @@ Future<void> launchUrl(
</table>

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.

<table>
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -155,6 +158,7 @@ CustomTabsOptions(
</table>

The following options for customizing the behavior of Custom Tabs as a browser have been consolidated into `CustomTabsBrowserConfiguration`:

- `headers` property
- `extraCustomTabs` property

Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions flutter_custom_tabs_android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand All @@ -27,4 +26,4 @@

## 2.0.0-beta

- Initial release of the `flutter_custom_tabs` Android implementation.
- Initial release of the `flutter_custom_tabs` Android implementation.
1 change: 0 additions & 1 deletion flutter_custom_tabs_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
1 change: 0 additions & 1 deletion flutter_custom_tabs_ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

This file was deleted.

4 changes: 2 additions & 2 deletions flutter_custom_tabs_platform_interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://flutter.dev/go/platform-interface-breaking-changes> 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
[2]: lib/flutter_custom_tabs_platform_interface.dart
2 changes: 1 addition & 1 deletion flutter_custom_tabs_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[1]: https://pub.dev/packages/flutter_custom_tabs
Loading

0 comments on commit 0f9eced

Please sign in to comment.