Skip to content

Commit 71c7eb3

Browse files
committed
feat: 优化 Universal Link 拼接方式
pathKey 使用与否决定了 Universal Link 拼接规则,不使用更加标准 close #60
1 parent 3045983 commit 71c7eb3

12 files changed

+36021
-22088
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ node_modules
22
.DS_Store
33
.eslintcache
44

5+
package-lock.json
6+
57
dist

Diff for: README.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,23 @@ callapp-lib 2.0.0 版本已移除,原先的 protocol 移入到新增的 scheme
144144

145145
- pathKey
146146

147-
pathKey 就和前面 Intent 的 key 属性一样,只是这里的 pathKey 是客户端用来提取 path 信息的,以便知道调用的是 APP 的哪个页面。这个值也是需要你和 ios 童鞋协商定下来的。
147+
`3.5.0` 版本以后 `pathKey` 非必填项,`pathkey` 填写与不填写代表了 Universal Link 拼接的两种方式。不建议使用 `pathKey` ,因为使用它拼接的 Universal Link 不贴合 URL 设计思想。
148+
149+
- 不使用 pathKey:客户端提起 path 信息将会从 url 中获取,而不是从 queryString 中获取
150+
151+
Universal Link 拼接规则:
152+
153+
```js
154+
const universalLink = `https://${host}/${open方法中的path}?${open方法中param转换的queryString}`;
155+
```
156+
157+
- 使用 pathKey:pathKey 就和前面 Intent 的 key 属性一样,只是这里的 pathKey 是客户端用来提取 path 信息的,以便知道调用的是 APP 的哪个页面。这个值也是需要你和 ios 童鞋协商定下来的。
158+
159+
Universal Link 拼接规则:
160+
161+
```js
162+
const universalLink = `https://${host}?${pathKey}=${open方法中的path}&${open方法中param转换的queryString}`;
163+
```
148164

149165
### appstore
150166

@@ -243,10 +259,8 @@ url scheme 自定义拼接函数,内置的 buildScheme 函数是按照 uri 规
243259

244260
生成 Universal Link,接收参数同 `generateScheme` 方法参数。
245261

246-
247262
## 打赏
248263

249264
如果刚好解决了你的问题,如果你心情还不错,如果尚有余粮,可以给作者打赏一杯咖啡哦,爱宁~
250265

251266
<img src="https://gw.alicdn.com/imgextra/i3/O1CN01Mqk09Q1HOAWBMvUt2_!!6000000000747-0-tps-1152-1152.jpg" width="240" />
252-

0 commit comments

Comments
 (0)