This commit is contained in:
v7lin
2021-01-31 18:56:10 +08:00
parent e1d73bee1c
commit 7bef3eedf6
20 changed files with 121 additions and 107 deletions

View File

@ -1,3 +1,7 @@
## 2.0.1
*
## 2.0.0
* Android/iOS

16
analysis_options.yaml Executable file → Normal file
View File

@ -29,6 +29,9 @@ analyzer:
missing_return: warning
# allow having TODOs in the code
todo: ignore
# allow self-reference to deprecated members (we do this because otherwise we have
# to annotate every member in every test, assert, etc, when we deprecate something)
deprecated_member_use_from_same_package: ignore
# Ignore analyzer hints for updating pubspecs when using Future or
# Stream and not importing dart:async
# Please see https://github.com/flutter/flutter/pull/24528 for details.
@ -55,7 +58,7 @@ linter:
- avoid_classes_with_only_static_members
# - avoid_double_and_int_checks # only useful when targeting JS runtime
- avoid_empty_else
# - avoid_equals_and_hash_code_on_mutable_classes # not yet tested
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # not yet tested
@ -98,7 +101,7 @@ linter:
- empty_catches
- empty_constructor_bodies
- empty_statements
# - file_names # not yet tested
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
@ -139,14 +142,14 @@ linter:
# - prefer_double_quotes # opposite of prefer_single_quotes
- prefer_equal_for_default_values
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
# - prefer_final_fields
- prefer_final_fields
# - prefer_final_in_for_each
# - prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
# - prefer_foreach
# - prefer_function_declarations_over_variables # not yet tested
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
# - prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
@ -175,7 +178,7 @@ linter:
- throw_in_finally
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
# - unawaited_futures # too many false positives
- unawaited_futures # too many false positives
# - unnecessary_await_in_return # not yet tested
- unnecessary_brace_in_string_interps
- unnecessary_const
@ -195,6 +198,7 @@ linter:
- use_full_hex_values_for_flutter_colors
# - use_function_type_syntax_for_parameters # not yet tested
# - use_key_in_widget_constructors # not yet tested
- use_late_for_private_fields_and_variables
- use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182

View File

@ -1,5 +1,5 @@
group 'io.github.v7lin.tencent_kit'
version '2.0.0'
version '2.0.1'
buildscript {
repositories {

View File

@ -2,10 +2,10 @@ PODS:
- Flutter (1.0.0)
- path_provider (0.0.1):
- Flutter
- tencent_kit (2.0.0):
- tencent_kit (2.0.1):
- Flutter
- tencent_kit/vendor (= 2.0.0)
- tencent_kit/vendor (2.0.0):
- tencent_kit/vendor (= 2.0.1)
- tencent_kit/vendor (2.0.1):
- Flutter
DEPENDENCIES:
@ -24,7 +24,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
tencent_kit: 204825086150a020041a395f3ea6202964dd313f
tencent_kit: 355aba785f79136a1a8800d159ed25a6d776d928
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d

View File

@ -90,14 +90,14 @@ class _HomeState extends State<Home> {
title: const Text('获取用户信息'),
onTap: () async {
if (_loginResp != null &&
_loginResp.isSuccessful() &&
!_loginResp.isExpired()) {
_loginResp.isSuccessful &&
!_loginResp.isExpired) {
TencentUserInfoResp userInfo = await _tencent.getUserInfo(
appId: _TENCENT_APPID,
openid: _loginResp.openid,
accessToken: _loginResp.accessToken,
);
if (userInfo.isSuccessful()) {
if (userInfo.isSuccessful) {
_showTips('用户信息',
'${userInfo.nickname} - ${userInfo.gender} - ${userInfo.genderType}');
} else {
@ -110,12 +110,12 @@ class _HomeState extends State<Home> {
title: const Text('获取UnionID'),
onTap: () async {
if (_loginResp != null &&
_loginResp.isSuccessful() &&
!_loginResp.isExpired()) {
_loginResp.isSuccessful &&
!_loginResp.isExpired) {
TencentUnionidResp unionid = await _tencent.getUnionId(
accessToken: _loginResp.accessToken,
);
if (unionid.isSuccessful()) {
if (unionid.isSuccessful) {
_showTips('UnionID',
'${unionid.clientId} - ${unionid.openid} - ${unionid.unionid}');
} else {

View File

@ -246,7 +246,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0"
version: "2.0.1"
term_glyph:
dependency: transitive
description:

View File

@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'tencent_kit'
s.version = '2.0.0'
s.version = '2.0.1'
s.summary = 'A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Tencent SDKs.'
s.description = <<-DESC
A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Tencent SDKs.

View File

@ -1,7 +1,7 @@
import 'package:json_annotation/json_annotation.dart';
abstract class TencentApiResp {
TencentApiResp({
const TencentApiResp({
this.ret,
this.msg,
});
@ -16,5 +16,5 @@ abstract class TencentApiResp {
final int ret;
final String msg;
bool isSuccessful() => ret == RET_SUCCESS;
bool get isSuccessful => ret == RET_SUCCESS;
}

View File

@ -4,12 +4,11 @@ import 'package:tencent_kit/src/model/api/tencent_api_resp.dart';
part 'tencent_user_info_resp.g.dart';
@JsonSerializable(
anyMap: true,
explicitToJson: true,
fieldRename: FieldRename.snake,
)
class TencentUserInfoResp extends TencentApiResp {
TencentUserInfoResp({
const TencentUserInfoResp({
int ret,
String msg,
this.isLost,
@ -34,7 +33,7 @@ class TencentUserInfoResp extends TencentApiResp {
this.isYellowYearVip,
}) : super(ret: ret, msg: msg);
factory TencentUserInfoResp.fromJson(Map<dynamic, dynamic> json) =>
factory TencentUserInfoResp.fromJson(Map<String, dynamic> json) =>
_$TencentUserInfoRespFromJson(json);
final int isLost;
@ -71,15 +70,11 @@ class TencentUserInfoResp extends TencentApiResp {
final String level;
final String isYellowYearVip;
bool isMale() {
return gender == '';
}
bool get isMale => gender == '';
bool isFemale() {
return gender == '';
}
bool get isFemale => gender == '';
String headImgUrl() {
String get headImgUrl {
if (figureurlQq != null && figureurlQq.isNotEmpty) {
return figureurlQq;
}
@ -98,5 +93,5 @@ class TencentUserInfoResp extends TencentApiResp {
return figureurl;
}
Map<dynamic, dynamic> toJson() => _$TencentUserInfoRespToJson(this);
Map<String, dynamic> toJson() => _$TencentUserInfoRespToJson(this);
}

View File

@ -6,7 +6,7 @@ part of 'tencent_user_info_resp.dart';
// JsonSerializableGenerator
// **************************************************************************
TencentUserInfoResp _$TencentUserInfoRespFromJson(Map json) {
TencentUserInfoResp _$TencentUserInfoRespFromJson(Map<String, dynamic> json) {
return TencentUserInfoResp(
ret: json['ret'] as int ?? 0,
msg: json['msg'] as String,

View File

@ -4,12 +4,11 @@ import 'package:tencent_kit/src/model/sdk/tencent_sdk_resp.dart';
part 'tencent_login_resp.g.dart';
@JsonSerializable(
anyMap: true,
explicitToJson: true,
fieldRename: FieldRename.snake,
)
class TencentLoginResp extends TencentSdkResp {
TencentLoginResp({
const TencentLoginResp({
int ret,
String msg,
this.openid,
@ -18,7 +17,7 @@ class TencentLoginResp extends TencentSdkResp {
this.createAt,
}) : super(ret: ret, msg: msg);
factory TencentLoginResp.fromJson(Map<dynamic, dynamic> json) =>
factory TencentLoginResp.fromJson(Map<String, dynamic> json) =>
_$TencentLoginRespFromJson(json);
final String openid;
@ -26,9 +25,7 @@ class TencentLoginResp extends TencentSdkResp {
final int expiresIn;
final int createAt;
bool isExpired() {
return DateTime.now().millisecondsSinceEpoch - createAt >= expiresIn * 1000;
}
bool get isExpired => DateTime.now().millisecondsSinceEpoch - createAt >= expiresIn * 1000;
Map<dynamic, dynamic> toJson() => _$TencentLoginRespToJson(this);
Map<String, dynamic> toJson() => _$TencentLoginRespToJson(this);
}

View File

@ -6,7 +6,7 @@ part of 'tencent_login_resp.dart';
// JsonSerializableGenerator
// **************************************************************************
TencentLoginResp _$TencentLoginRespFromJson(Map json) {
TencentLoginResp _$TencentLoginRespFromJson(Map<String, dynamic> json) {
return TencentLoginResp(
ret: json['ret'] as int ?? 0,
msg: json['msg'] as String,

View File

@ -1,7 +1,7 @@
import 'package:json_annotation/json_annotation.dart';
abstract class TencentSdkResp {
TencentSdkResp({
const TencentSdkResp({
this.ret,
this.msg,
});
@ -23,5 +23,7 @@ abstract class TencentSdkResp {
final int ret;
final String msg;
bool isSuccessful() => ret == RET_SUCCESS;
bool get isSuccessful => ret == RET_SUCCESS;
bool get isCancelled => ret == RET_USERCANCEL;
}

View File

@ -4,18 +4,17 @@ import 'package:tencent_kit/src/model/sdk/tencent_sdk_resp.dart';
part 'tencent_share_resp.g.dart';
@JsonSerializable(
anyMap: true,
explicitToJson: true,
fieldRename: FieldRename.snake,
)
class TencentShareResp extends TencentSdkResp {
TencentShareResp({
const TencentShareResp({
int ret,
String msg,
}) : super(ret: ret, msg: msg);
factory TencentShareResp.fromJson(Map<dynamic, dynamic> json) =>
factory TencentShareResp.fromJson(Map<String, dynamic> json) =>
_$TencentShareRespFromJson(json);
Map<dynamic, dynamic> toJson() => _$TencentShareRespToJson(this);
Map<String, dynamic> toJson() => _$TencentShareRespToJson(this);
}

View File

@ -6,7 +6,7 @@ part of 'tencent_share_resp.dart';
// JsonSerializableGenerator
// **************************************************************************
TencentShareResp _$TencentShareRespFromJson(Map json) {
TencentShareResp _$TencentShareRespFromJson(Map<String, dynamic> json) {
return TencentShareResp(
ret: json['ret'] as int ?? 0,
msg: json['msg'] as String,

View File

@ -3,12 +3,11 @@ import 'package:json_annotation/json_annotation.dart';
part 'tencent_unionid_resp.g.dart';
@JsonSerializable(
anyMap: true,
explicitToJson: true,
fieldRename: FieldRename.snake,
)
class TencentUnionidResp {
TencentUnionidResp({
const TencentUnionidResp({
this.error,
this.errorDescription,
this.clientId,
@ -16,7 +15,7 @@ class TencentUnionidResp {
this.unionid,
});
factory TencentUnionidResp.fromJson(Map<dynamic, dynamic> json) =>
factory TencentUnionidResp.fromJson(Map<String, dynamic> json) =>
_$TencentUnionidRespFromJson(json);
@JsonKey(
@ -30,7 +29,7 @@ class TencentUnionidResp {
static const int ERROR_SUCCESS = 0;
bool isSuccessful() => error == ERROR_SUCCESS;
bool get isSuccessful => error == ERROR_SUCCESS;
Map<dynamic, dynamic> toJson() => _$TencentUnionidRespToJson(this);
Map<String, dynamic> toJson() => _$TencentUnionidRespToJson(this);
}

View File

@ -6,7 +6,7 @@ part of 'tencent_unionid_resp.dart';
// JsonSerializableGenerator
// **************************************************************************
TencentUnionidResp _$TencentUnionidRespFromJson(Map json) {
TencentUnionidResp _$TencentUnionidRespFromJson(Map<String, dynamic> json) {
return TencentUnionidResp(
error: json['error'] as int ?? 0,
errorDescription: json['error_description'] as String,

View File

@ -60,11 +60,11 @@ class Tencent {
switch (call.method) {
case _METHOD_ONLOGINRESP:
_loginRespStreamController.add(
TencentLoginResp.fromJson(call.arguments as Map<dynamic, dynamic>));
TencentLoginResp.fromJson((call.arguments as Map<dynamic, dynamic>).cast<String, dynamic>()));
break;
case _METHOD_ONSHARERESP:
_shareRespStreamController.add(
TencentShareResp.fromJson(call.arguments as Map<dynamic, dynamic>));
TencentShareResp.fromJson((call.arguments as Map<dynamic, dynamic>).cast<String, dynamic>()));
break;
}
}
@ -144,7 +144,7 @@ class Tencent {
Encoding encoding = Encoding.getByName(contentType?.charset) ?? utf8;
String content = await encoding.decodeStream(response);
return TencentUserInfoResp.fromJson(
json.decode(content) as Map<dynamic, dynamic>);
json.decode(content) as Map<String, dynamic>);
}
throw HttpException(
'HttpResponse statusCode: ${response.statusCode}, reasonPhrase: ${response.reasonPhrase}.');
@ -174,7 +174,7 @@ class Tencent {
if (match.groupCount == 1) {
String content = match.group(1);
return TencentUnionidResp.fromJson(
json.decode(content) as Map<dynamic, dynamic>);
json.decode(content) as Map<String, dynamic>);
}
}
throw HttpException(

View File

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
version: "14.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.39.10"
version: "0.41.2"
args:
dependency: transitive
description:
@ -42,42 +42,42 @@ packages:
name: build
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.6.1"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.2"
version: "0.4.5"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
version: "2.1.6"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.9"
version: "1.5.2"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0"
version: "1.11.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.0"
version: "6.1.6"
built_collection:
dependency: transitive
description:
@ -112,7 +112,14 @@ packages:
name: checked_yaml
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
version: "1.0.4"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
clock:
dependency: transitive
description:
@ -126,7 +133,7 @@ packages:
name: code_builder
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.3.0"
version: "3.6.0"
collection:
dependency: transitive
description:
@ -147,21 +154,14 @@ packages:
name: crypto
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
version: "2.1.5"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.6"
version: "1.3.11"
fake_async:
dependency: transitive
description:
@ -169,13 +169,20 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
file:
dependency: transitive
description:
name: file
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.2.0"
version: "5.2.1"
fixnum:
dependency: transitive
description:
@ -207,13 +214,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.14.0+3"
http_multi_server:
dependency: transitive
description:
@ -255,14 +255,14 @@ packages:
name: json_annotation
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.1"
version: "3.1.1"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.3.0"
version: "3.5.1"
logging:
dependency: transitive
description:
@ -290,21 +290,21 @@ packages:
name: mime
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.6+3"
version: "0.9.7"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
version: "1.2.1"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
version: "1.2.0"
okhttp_kit:
dependency: "direct dev"
description:
@ -332,35 +332,42 @@ packages:
name: path_provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.10"
version: "1.6.27"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+1"
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4+3"
version: "0.0.4+8"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
version: "1.0.4"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4+3"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.0"
version: "1.9.2"
platform:
dependency: transitive
description:
@ -374,7 +381,7 @@ packages:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
version: "1.0.3"
pool:
dependency: transitive
description:
@ -402,28 +409,28 @@ packages:
name: pubspec_parse
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5"
version: "0.1.7"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
version: "2.1.5"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.5"
version: "0.7.9"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.3"
version: "0.2.4"
sky_engine:
dependency: transitive
description: flutter
@ -435,7 +442,7 @@ packages:
name: source_gen
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.5"
version: "0.9.10+1"
source_span:
dependency: transitive
description:
@ -491,7 +498,7 @@ packages:
name: timing
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1+2"
version: "0.1.1+3"
typed_data:
dependency: transitive
description:
@ -519,14 +526,21 @@ packages:
name: web_socket_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.2.0"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.4+1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.0"
version: "0.1.2"
yaml:
dependency: transitive
description:
@ -535,5 +549,5 @@ packages:
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.10.0-110 <2.11.0"
dart: ">=2.10.0 <2.11.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"

View File

@ -1,6 +1,6 @@
name: tencent_kit
description: A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Tencent SDKs.
version: 2.0.0
version: 2.0.1
# author: v7lin <v7lin@qq.com>
homepage: https://github.com/v7lin/fake_tencent