Skip to content

Commit b06da21

Browse files
committed
0.1.2
1 parent 6432605 commit b06da21

File tree

3 files changed

+244
-5
lines changed

3 files changed

+244
-5
lines changed

README-ZH.md

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[discord-image]: https://img.shields.io/discord/884679008049037342.svg
99
[discord-url]: https://discord.gg/zPa6EZ2jqb
1010

11-
这个插件允许 Flutter **桌面** 应用注册及处理自定义协议(即深度链接)。
11+
这个插件允许 Flutter 应用注册及处理自定义协议(即深度链接)。
1212

1313
---
1414

@@ -26,6 +26,8 @@
2626
- [快速开始](#快速开始)
2727
- [安装](#安装)
2828
- [用法](#用法)
29+
- [Android](#android)
30+
- [iOS](#ios)
2931
- [macOS](#macos)
3032
- [Windows](#windows)
3133
- [监听事件](#监听事件)
@@ -55,7 +57,7 @@
5557

5658
```yaml
5759
dependencies:
58-
protocol_handler: ^0.1.1
60+
protocol_handler: ^0.1.2
5961
```
6062
6163
@@ -69,6 +71,123 @@ dependencies:
6971
```
7072
7173
### 用法
74+
##### Android
75+
76+
更改文件 `android/app/src/main/AndroidManifest.xml` 如下:
77+
78+
```diff
79+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
80+
package="org.leanflutter.plugins.protocol_handler_example">
81+
82+
<application
83+
android:name="${applicationName}"
84+
android:icon="@mipmap/ic_launcher"
85+
android:label="protocol_handler_example">
86+
<activity
87+
android:name=".MainActivity"
88+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
89+
android:exported="true"
90+
android:hardwareAccelerated="true"
91+
android:launchMode="singleTop"
92+
android:theme="@style/LaunchTheme"
93+
android:windowSoftInputMode="adjustResize">
94+
<!-- Specifies an Android theme to apply to this Activity as soon as
95+
the Android process has started. This theme is visible to the user
96+
while the Flutter UI initializes. After that, this theme continues
97+
to determine the Window background behind the Flutter UI. -->
98+
<meta-data
99+
android:name="io.flutter.embedding.android.NormalTheme"
100+
android:resource="@style/NormalTheme" />
101+
102+
<intent-filter>
103+
<action android:name="android.intent.action.MAIN" />
104+
<category android:name="android.intent.category.LAUNCHER" />
105+
</intent-filter>
106+
+ <intent-filter>
107+
+ <action android:name="android.intent.action.VIEW" />
108+
+
109+
+ <category android:name="android.intent.category.DEFAULT" />
110+
+ <category android:name="android.intent.category.BROWSABLE" />
111+
+ <!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
112+
+ <data android:scheme="myprotocol" />
113+
+ </intent-filter>
114+
</activity>
115+
<!-- Don't delete the meta-data below.
116+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
117+
<meta-data
118+
android:name="flutterEmbedding"
119+
android:value="2" />
120+
</application>
121+
</manifest>
122+
```
123+
124+
##### iOS
125+
126+
更改文件 `ios/Runner/Info.plist` 如下:
127+
128+
```diff
129+
<?xml version="1.0" encoding="UTF-8"?>
130+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
131+
<plist version="1.0">
132+
<dict>
133+
<key>CFBundleDevelopmentRegion</key>
134+
<string>$(DEVELOPMENT_LANGUAGE)</string>
135+
<key>CFBundleDisplayName</key>
136+
<string>Protocol Handler</string>
137+
<key>CFBundleExecutable</key>
138+
<string>$(EXECUTABLE_NAME)</string>
139+
<key>CFBundleIdentifier</key>
140+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
141+
<key>CFBundleInfoDictionaryVersion</key>
142+
<string>6.0</string>
143+
<key>CFBundleName</key>
144+
<string>protocol_handler_example</string>
145+
<key>CFBundlePackageType</key>
146+
<string>APPL</string>
147+
<key>CFBundleShortVersionString</key>
148+
<string>$(FLUTTER_BUILD_NAME)</string>
149+
<key>CFBundleSignature</key>
150+
<string>????</string>
151+
<key>CFBundleVersion</key>
152+
<string>$(FLUTTER_BUILD_NUMBER)</string>
153+
<key>LSRequiresIPhoneOS</key>
154+
<true/>
155+
<key>UILaunchStoryboardName</key>
156+
<string>LaunchScreen</string>
157+
<key>UIMainStoryboardFile</key>
158+
<string>Main</string>
159+
+ <key>CFBundleURLTypes</key>
160+
+ <array>
161+
+ <dict>
162+
+ <key>CFBundleTypeRole</key>
163+
+ <string>Editor</string>
164+
+ <key>CFBundleURLName</key>
165+
+ <string></string>
166+
+ <key>CFBundleURLSchemes</key>
167+
+ <array>
168+
+ <string>myprotocol</string>
169+
+ </array>
170+
+ </dict>
171+
+ </array>
172+
<key>UISupportedInterfaceOrientations</key>
173+
<array>
174+
<string>UIInterfaceOrientationPortrait</string>
175+
<string>UIInterfaceOrientationLandscapeLeft</string>
176+
<string>UIInterfaceOrientationLandscapeRight</string>
177+
</array>
178+
<key>UISupportedInterfaceOrientations~ipad</key>
179+
<array>
180+
<string>UIInterfaceOrientationPortrait</string>
181+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
182+
<string>UIInterfaceOrientationLandscapeLeft</string>
183+
<string>UIInterfaceOrientationLandscapeRight</string>
184+
</array>
185+
<key>UIViewControllerBasedStatusBarAppearance</key>
186+
<false/>
187+
</dict>
188+
</plist>
189+
190+
```
72191

73192
##### macOS
74193

README.md

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[discord-image]: https://img.shields.io/discord/884679008049037342.svg
99
[discord-url]: https://discord.gg/zPa6EZ2jqb
1010

11-
This plugin allows Flutter **desktop** apps to register and handle custom protocols (i.e. deep linking).
11+
This plugin allows Flutter apps to register and handle custom protocols (i.e. deep linking).
1212

1313
---
1414

@@ -26,6 +26,8 @@ English | [简体中文](./README-ZH.md)
2626
- [Quick Start](#quick-start)
2727
- [Installation](#installation)
2828
- [Usage](#usage)
29+
- [Android](#android)
30+
- [iOS](#ios)
2931
- [macOS](#macos)
3032
- [Windows](#windows)
3133
- [Listening events](#listening-events)
@@ -56,7 +58,7 @@ Add this to your package's pubspec.yaml file:
5658

5759
```yaml
5860
dependencies:
59-
protocol_handler: ^0.1.1
61+
protocol_handler: ^0.1.2
6062
```
6163
6264
Or
@@ -71,6 +73,124 @@ dependencies:
7173
7274
### Usage
7375
76+
##### Android
77+
78+
Change the file `android/app/src/main/AndroidManifest.xml` as follows:
79+
80+
```diff
81+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
82+
package="org.leanflutter.plugins.protocol_handler_example">
83+
84+
<application
85+
android:name="${applicationName}"
86+
android:icon="@mipmap/ic_launcher"
87+
android:label="protocol_handler_example">
88+
<activity
89+
android:name=".MainActivity"
90+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
91+
android:exported="true"
92+
android:hardwareAccelerated="true"
93+
android:launchMode="singleTop"
94+
android:theme="@style/LaunchTheme"
95+
android:windowSoftInputMode="adjustResize">
96+
<!-- Specifies an Android theme to apply to this Activity as soon as
97+
the Android process has started. This theme is visible to the user
98+
while the Flutter UI initializes. After that, this theme continues
99+
to determine the Window background behind the Flutter UI. -->
100+
<meta-data
101+
android:name="io.flutter.embedding.android.NormalTheme"
102+
android:resource="@style/NormalTheme" />
103+
104+
<intent-filter>
105+
<action android:name="android.intent.action.MAIN" />
106+
<category android:name="android.intent.category.LAUNCHER" />
107+
</intent-filter>
108+
+ <intent-filter>
109+
+ <action android:name="android.intent.action.VIEW" />
110+
+
111+
+ <category android:name="android.intent.category.DEFAULT" />
112+
+ <category android:name="android.intent.category.BROWSABLE" />
113+
+ <!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
114+
+ <data android:scheme="myprotocol" />
115+
+ </intent-filter>
116+
</activity>
117+
<!-- Don't delete the meta-data below.
118+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
119+
<meta-data
120+
android:name="flutterEmbedding"
121+
android:value="2" />
122+
</application>
123+
</manifest>
124+
```
125+
126+
##### iOS
127+
128+
Change the file `ios/Runner/Info.plist` as follows:
129+
130+
```diff
131+
<?xml version="1.0" encoding="UTF-8"?>
132+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
133+
<plist version="1.0">
134+
<dict>
135+
<key>CFBundleDevelopmentRegion</key>
136+
<string>$(DEVELOPMENT_LANGUAGE)</string>
137+
<key>CFBundleDisplayName</key>
138+
<string>Protocol Handler</string>
139+
<key>CFBundleExecutable</key>
140+
<string>$(EXECUTABLE_NAME)</string>
141+
<key>CFBundleIdentifier</key>
142+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
143+
<key>CFBundleInfoDictionaryVersion</key>
144+
<string>6.0</string>
145+
<key>CFBundleName</key>
146+
<string>protocol_handler_example</string>
147+
<key>CFBundlePackageType</key>
148+
<string>APPL</string>
149+
<key>CFBundleShortVersionString</key>
150+
<string>$(FLUTTER_BUILD_NAME)</string>
151+
<key>CFBundleSignature</key>
152+
<string>????</string>
153+
<key>CFBundleVersion</key>
154+
<string>$(FLUTTER_BUILD_NUMBER)</string>
155+
<key>LSRequiresIPhoneOS</key>
156+
<true/>
157+
<key>UILaunchStoryboardName</key>
158+
<string>LaunchScreen</string>
159+
<key>UIMainStoryboardFile</key>
160+
<string>Main</string>
161+
+ <key>CFBundleURLTypes</key>
162+
+ <array>
163+
+ <dict>
164+
+ <key>CFBundleTypeRole</key>
165+
+ <string>Editor</string>
166+
+ <key>CFBundleURLName</key>
167+
+ <string></string>
168+
+ <key>CFBundleURLSchemes</key>
169+
+ <array>
170+
+ <string>myprotocol</string>
171+
+ </array>
172+
+ </dict>
173+
+ </array>
174+
<key>UISupportedInterfaceOrientations</key>
175+
<array>
176+
<string>UIInterfaceOrientationPortrait</string>
177+
<string>UIInterfaceOrientationLandscapeLeft</string>
178+
<string>UIInterfaceOrientationLandscapeRight</string>
179+
</array>
180+
<key>UISupportedInterfaceOrientations~ipad</key>
181+
<array>
182+
<string>UIInterfaceOrientationPortrait</string>
183+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
184+
<string>UIInterfaceOrientationLandscapeLeft</string>
185+
<string>UIInterfaceOrientationLandscapeRight</string>
186+
</array>
187+
<key>UIViewControllerBasedStatusBarAppearance</key>
188+
<false/>
189+
</dict>
190+
</plist>
191+
192+
```
193+
74194
##### macOS
75195

76196
Change the file `macos/Runner/Info.plist` as follows:

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: protocol_handler
2-
description: This plugin allows Flutter desktop apps to register and handle custom protocols (i.e. deep linking).
2+
description: This plugin allows Flutter apps to register and handle custom protocols (i.e. deep linking).
33
version: 0.1.2
44
homepage: https://github.com/leanflutter/protocol_handler
55

0 commit comments

Comments
 (0)