Skip to content

Commit

Permalink
更新readme
Browse files Browse the repository at this point in the history
  • Loading branch information
吴丹 committed Jun 27, 2022
1 parent be45258 commit bb96816
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 26 deletions.
81 changes: 56 additions & 25 deletions sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,70 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
#### 引入SDK

```
fair_pushy:
git:
url: https://github.com/wuba/FairPushy.git
path: sdk
```

#### 初始化SDK

```dart
FairPushy.init(
appID: '1001',
updateUrl: "https://fangfe.58.com/fairapp/module_patch_bundle",
debug: true);
```

<!--appid:web可视化平台中的项目id-->

<!--updateUrl:接入方更新获取补丁config文件的服务器地址-->

<!--debug:运行环境-->


For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).

For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
#### 调用模块更新api

```
FairPushy.updateBundle(bundleid: "6005")
```

<!--bundleid可视化平台中模块对应的补丁唯一标识-->

该方法内部实现补丁更新逻辑,包括补丁配置文件的获取,判断是否更新,补丁的下载,解压,缓存逻辑。



#### 使用loading中间件

```dart
FairPushyWidget(
bundleid: BundleConst.car,
// targetPageName: "car_cate"
targetWidgetBuilder: (context) => CarCatePage());
```

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
<!--targetPageName:module间跳转时的目标界面pagename,传入pagename需要在FairPushy中进行界面的注册,详见example示例工程-->

## Features
<!--targetWidgetBuilder:module间跳转时的目标界面widget-->

TODO: List what your package can do. Maybe include images, gifs, or videos.
在module间跳转的时候,可以先跳SDK中提供的中间件,中间件中实现了补丁的更新逻辑,走完更新补丁逻辑,会把目标页替换成传入的targetWidget。

## Getting started

TODO: List prerequisites and provide or point to information on how to
start using the package.

## Usage
#### getConfigs接口

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
如果接入方在多module的工程结构下,想进app就下载所有的补丁文件,可以调用该接口获取appid对应项目下的所有补丁config信息,然后调用downloadConfig方法进行下载。

```dart
const like = 'sample';
FairPushy.getConfigs("https://fangfe.58.com/fairapp/module_patch_app").then((value) {
if (null != value && value.isNotEmpty) {
for (var i = 0; i < value.length; i++) {
FairPushy.downloadConfig(value[i]);
}
}
});
```

## Additional information

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
4 changes: 3 additions & 1 deletion sdk/test/fair_pushy_sdk_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ void main() {
.then((value) {
if (null != value && value.isNotEmpty) {
Logger.log("first of configs: " + value[0].patchUrl!);
updateBundle(value[0].bundleId!);
for (var i = 0; i < value.length; i++) {
updateBundle(value[i].bundleId ?? "");
}
}
});
}
Expand Down

0 comments on commit bb96816

Please sign in to comment.