优化
This commit is contained in:
parent
0bff40f92a
commit
eddbe9d4aa
96
.drone.yml
96
.drone.yml
@ -63,6 +63,17 @@ steps:
|
||||
files:
|
||||
- ./coverage/lcov.info
|
||||
|
||||
volumes:
|
||||
- name: pub-cache
|
||||
temp: {}
|
||||
- name: gradle
|
||||
temp: {}
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: publish
|
||||
|
||||
steps:
|
||||
- name: publish-check
|
||||
image: v7lin/flutter:1.5.4-hotfix.2-stable
|
||||
volumes:
|
||||
@ -70,12 +81,87 @@ steps:
|
||||
path: /opt/flutter/.pub-cache
|
||||
commands:
|
||||
- flutter packages pub publish --dry-run
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: restore-cache
|
||||
image: alpine:3.9.3
|
||||
volumes:
|
||||
- name: pub-cache
|
||||
path: /opt/flutter/.pub-cache
|
||||
commands:
|
||||
- FLUTTER_HOME=/opt/flutter/.pub-cache
|
||||
- wget -P $FLUTTER_HOME https://raw.githubusercontent.com/v7lin/pub_credentials/master/credentials.json.enc
|
||||
|
||||
- name: restore-cache-openssl
|
||||
image: v7lin/openssl:1.1.1b
|
||||
volumes:
|
||||
- name: pub-cache
|
||||
path: /opt/flutter/.pub-cache
|
||||
environment:
|
||||
ENC_METHOD:
|
||||
from_secret: ENC_METHOD
|
||||
ENC_PASSWORD:
|
||||
from_secret: ENC_PASSWORD
|
||||
commands:
|
||||
- FLUTTER_HOME=/opt/flutter/.pub-cache
|
||||
- openssl enc -d -$ENC_METHOD -k $ENC_PASSWORD -in $FLUTTER_HOME/credentials.json.enc -out $FLUTTER_HOME/credentials.json
|
||||
- rm $FLUTTER_HOME/credentials.json.enc
|
||||
|
||||
- name: publish
|
||||
image: v7lin/flutter:1.5.4-hotfix.2-stable
|
||||
volumes:
|
||||
- name: pub-cache
|
||||
path: /opt/flutter/.pub-cache
|
||||
commands:
|
||||
- echo "y" | flutter packages pub publish
|
||||
|
||||
- name: save-cache-openssl
|
||||
image: v7lin/openssl:1.1.1b
|
||||
volumes:
|
||||
- name: pub-cache
|
||||
path: /opt/flutter/.pub-cache
|
||||
environment:
|
||||
ENC_METHOD:
|
||||
from_secret: ENC_METHOD
|
||||
ENC_PASSWORD:
|
||||
from_secret: ENC_PASSWORD
|
||||
commands:
|
||||
- FLUTTER_HOME=/opt/flutter/.pub-cache
|
||||
- openssl enc -e -$ENC_METHOD -k $ENC_PASSWORD -in $FLUTTER_HOME/credentials.json -out $FLUTTER_HOME/credentials.json.enc
|
||||
- rm /opt/flutter/.pub-cache/credentials.json
|
||||
|
||||
- name: save-cache
|
||||
image: docker:git
|
||||
volumes:
|
||||
- name: pub-cache
|
||||
path: /opt/flutter/.pub-cache
|
||||
environment:
|
||||
GIT_USER_EMAIL:
|
||||
from_secret: GIT_USER_EMAIL
|
||||
GIT_USER_NAME:
|
||||
from_secret: GIT_USER_NAME
|
||||
GIT_USER_PASSWORD:
|
||||
from_secret: GIT_USER_PASSWORD # 密码含'@',用'%40'替换 -> URLEncoder.encode("@","utf-8");
|
||||
commands:
|
||||
- FLUTTER_HOME=/opt/flutter/.pub-cache
|
||||
- git config --global user.email $GIT_USER_EMAIL
|
||||
- git config --global user.name $GIT_USER_NAME
|
||||
- git config --global credential.helper store
|
||||
- git clone -b master https://$GIT_USER_NAME:$GIT_USER_PASSWORD@github.com/v7lin/pub_credentials.git $FLUTTER_HOME/pub_credentials
|
||||
- rm $FLUTTER_HOME/pub_credentials/credentials.json.enc
|
||||
- mv $FLUTTER_HOME/credentials.json.enc $FLUTTER_HOME/pub_credentials/credentials.json.enc
|
||||
- cd $FLUTTER_HOME/pub_credentials
|
||||
- git commit -am "update credentials by ci/cd tools"
|
||||
- git push
|
||||
|
||||
volumes:
|
||||
- name: pub-cache
|
||||
temp: {}
|
||||
- name: gradle
|
||||
temp: {}
|
||||
|
||||
trigger:
|
||||
status:
|
||||
- success
|
||||
event:
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- default
|
||||
|
@ -1,3 +1,8 @@
|
||||
## [0.2.0] - 2019.5.24
|
||||
|
||||
* 优化
|
||||
* 自动化发布
|
||||
|
||||
## [0.1.0] - 2019.3.19
|
||||
|
||||
* 规范 library 代码
|
||||
|
@ -10,7 +10,6 @@ flutter版新浪微博SDK
|
||||
|
||||
## fake 系列 libraries
|
||||
|
||||
* [flutter版okhttp3](https://github.com/v7lin/fake_http)
|
||||
* [flutter版微信SDK](https://github.com/v7lin/fake_wechat)
|
||||
* [flutter版腾讯(QQ)SDK](https://github.com/v7lin/fake_tencent)
|
||||
* [flutter版新浪微博SDK](https://github.com/v7lin/fake_weibo)
|
||||
|
@ -42,7 +42,11 @@ class _HomeState extends State<Home> {
|
||||
WeiboScope.ALL,
|
||||
];
|
||||
|
||||
Weibo _weibo = Weibo();
|
||||
Weibo _weibo = Weibo()
|
||||
..registerApp(
|
||||
appKey: _WEIBO_APP_KEY,
|
||||
scope: _WEIBO_SCOPE,
|
||||
);
|
||||
|
||||
StreamSubscription<WeiboAuthResp> _auth;
|
||||
StreamSubscription<WeiboSdkResp> _share;
|
||||
@ -52,10 +56,6 @@ class _HomeState extends State<Home> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_weibo.registerApp(
|
||||
appKey: _WEIBO_APP_KEY,
|
||||
scope: _WEIBO_SCOPE,
|
||||
);
|
||||
_auth = _weibo.authResp().listen(_listenAuth);
|
||||
_share = _weibo.shareMsgResp().listen(_listenShareMsg);
|
||||
}
|
||||
|
@ -74,10 +74,12 @@ class Weibo {
|
||||
}
|
||||
}
|
||||
|
||||
/// 登录
|
||||
Stream<WeiboAuthResp> authResp() {
|
||||
return _authRespStreamController.stream;
|
||||
}
|
||||
|
||||
/// 分享
|
||||
Stream<WeiboSdkResp> shareMsgResp() {
|
||||
return _shareMsgRespStreamController.stream;
|
||||
}
|
||||
@ -86,6 +88,7 @@ class Weibo {
|
||||
return (await _channel.invokeMethod(_METHOD_ISWEIBOINSTALLED)) as bool;
|
||||
}
|
||||
|
||||
/// 登录
|
||||
Future<void> auth({
|
||||
@required String appKey,
|
||||
@required List<String> scope,
|
||||
@ -103,6 +106,7 @@ class Weibo {
|
||||
);
|
||||
}
|
||||
|
||||
/// 用户信息
|
||||
Future<WeiboUserInfoResp> getUserInfo({
|
||||
@required String appkey,
|
||||
@required String userId,
|
||||
@ -137,7 +141,6 @@ class Weibo {
|
||||
) {
|
||||
params.putIfAbsent('source', () => appkey);
|
||||
params.putIfAbsent('access_token', () => accessToken);
|
||||
|
||||
Uri baseUri = Uri.parse(baseUrl);
|
||||
Map<String, List<String>> queryParametersAll =
|
||||
Map<String, List<String>>.of(baseUri.queryParametersAll);
|
||||
@ -145,10 +148,10 @@ class Weibo {
|
||||
queryParametersAll.remove(key);
|
||||
queryParametersAll.putIfAbsent(key, () => <String>[value]);
|
||||
});
|
||||
|
||||
return baseUri.replace(queryParameters: queryParametersAll);
|
||||
}
|
||||
|
||||
/// 分享 - 文本
|
||||
Future<void> shareText({
|
||||
@required String text,
|
||||
}) {
|
||||
@ -161,6 +164,7 @@ class Weibo {
|
||||
);
|
||||
}
|
||||
|
||||
/// 分享 - 图片
|
||||
Future<void> shareImage({
|
||||
@required Uint8List imageData,
|
||||
}) {
|
||||
@ -173,6 +177,7 @@ class Weibo {
|
||||
);
|
||||
}
|
||||
|
||||
/// 分享 - 网页
|
||||
Future<void> shareWebpage({
|
||||
@required String title,
|
||||
@required String description,
|
||||
|
Loading…
Reference in New Issue
Block a user