expiresIn -> expiresTime

This commit is contained in:
v7lin
2022-07-27 11:32:36 +08:00
parent 1da9e057c7
commit bf6269d741
6 changed files with 20 additions and 23 deletions

View File

@ -2,6 +2,7 @@
* fix
* shareMultiImage/shareVideo
* breake change: expiresIn -> expiresTime
## 4.0.0

View File

@ -140,6 +140,7 @@ iOS 9系统策略更新限制了http协议的访问此外应用需要在
## flutter
* break change
* 4.0.1: expiresIn -> expiresTime
* 4.0.0:
* 3.0.0:
* 2.0.2: iOS Universal Links

View File

@ -205,8 +205,7 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
map.put("userId", token.getUid());
map.put("accessToken", token.getAccessToken());
map.put("refreshToken", token.getRefreshToken());
final long expiresIn = (long) Math.ceil(token.getExpiresTime() / 1000.0);
map.put("expiresIn", expiresIn);// 向上取整
map.put("expiresTime", token.getExpiresTime());
} else {
map.put("errorCode", WeiboErrorCode.UNKNOWN);
}

View File

@ -149,11 +149,11 @@
NSString *userId = authorizeResponse.userID;
NSString *accessToken = authorizeResponse.accessToken;
NSString *refreshToken = authorizeResponse.refreshToken;
long long expiresIn = ceil(authorizeResponse.expirationDate.timeIntervalSinceNow); // 向上取整
long long expiresTime = authorizeResponse.expirationDate.timeIntervalSince1970 * 1000;
[dictionary setValue:userId forKey:@"userId"];
[dictionary setValue:accessToken forKey:@"accessToken"];
[dictionary setValue:refreshToken forKey:@"refreshToken"];
[dictionary setValue:[NSNumber numberWithLongLong:expiresIn] forKey:@"expiresIn"];
[dictionary setValue:[NSNumber numberWithLongLong:expiresTime] forKey:@"expiresTime"];
}
[_channel invokeMethod:@"onAuthResp" arguments:dictionary];
} else if ([response isKindOfClass:[WBSendMessageToWeiboResponse class]]) {

View File

@ -63,7 +63,7 @@ class AuthResp extends BaseResp {
this.userId,
this.accessToken,
this.refreshToken,
this.expiresIn,
this.expiresTime,
});
factory AuthResp.fromJson(Map<String, dynamic> json) =>
@ -72,7 +72,7 @@ class AuthResp extends BaseResp {
final String? userId;
final String? accessToken;
final String? refreshToken;
final int? expiresIn;
final int? expiresTime;
@override
Map<String, dynamic> toJson() => _$AuthRespToJson(this);

View File

@ -6,16 +6,14 @@ part of 'resp.dart';
// JsonSerializableGenerator
// **************************************************************************
AuthResp _$AuthRespFromJson(Map<String, dynamic> json) {
return AuthResp(
errorCode: json['errorCode'] as int? ?? 0,
errorMessage: json['errorMessage'] as String?,
userId: json['userId'] as String?,
accessToken: json['accessToken'] as String?,
refreshToken: json['refreshToken'] as String?,
expiresIn: json['expiresIn'] as int?,
);
}
AuthResp _$AuthRespFromJson(Map<String, dynamic> json) => AuthResp(
errorCode: json['errorCode'] as int? ?? 0,
errorMessage: json['errorMessage'] as String?,
userId: json['userId'] as String?,
accessToken: json['accessToken'] as String?,
refreshToken: json['refreshToken'] as String?,
expiresTime: json['expiresTime'] as int?,
);
Map<String, dynamic> _$AuthRespToJson(AuthResp instance) => <String, dynamic>{
'errorCode': instance.errorCode,
@ -23,15 +21,13 @@ Map<String, dynamic> _$AuthRespToJson(AuthResp instance) => <String, dynamic>{
'userId': instance.userId,
'accessToken': instance.accessToken,
'refreshToken': instance.refreshToken,
'expiresIn': instance.expiresIn,
'expiresTime': instance.expiresTime,
};
ShareMsgResp _$ShareMsgRespFromJson(Map<String, dynamic> json) {
return ShareMsgResp(
errorCode: json['errorCode'] as int? ?? 0,
errorMessage: json['errorMessage'] as String?,
);
}
ShareMsgResp _$ShareMsgRespFromJson(Map<String, dynamic> json) => ShareMsgResp(
errorCode: json['errorCode'] as int? ?? 0,
errorMessage: json['errorMessage'] as String?,
);
Map<String, dynamic> _$ShareMsgRespToJson(ShareMsgResp instance) =>
<String, dynamic>{