diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dec404..63023bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,61 @@ name: build +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + on: push: + branches: + - main + - master paths-ignore: - - '.github/workflows/**' - - 'README.md' + - '**.md' pull_request: + branches: + - main + - master + paths-ignore: + - '**.md' jobs: + analyze: + name: Analyze on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + - uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + - name: Log Dart/Flutter versions + run: | + dart --version + flutter --version + - run: flutter doctor -v + - name: Prepare dependencies + run: flutter pub get + - name: Check Dart code formatting + run: dart format . -o none --set-exit-if-changed + - name: Analyze lib & test + run: flutter analyze lib test + - name: Analyze example + run: flutter analyze example + - name: Run tests + run: flutter test + - name: Dry run docs generate + run: dart doc --dry-run . + continue-on-error: true + build_ios: + needs: analyze name: Build iOS on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -19,27 +66,29 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: 'stable' + cache: true - name: Run llvm/clang-format@shell + if: matrix.os == 'macos-latest' run: | brew install clang-format - name: Run ruby/plist@shell + if: matrix.os == 'macos-latest' run: | gem install plist - - run: clang-format -style=file -i ios/Classes/*.h ios/Classes/*.m --dry-run --Werror - - run: flutter --version + - name: Run clang-format + if: matrix.os == 'macos-latest' + run: clang-format -style=file -i ios/Classes/*.h ios/Classes/*.m --dry-run --Werror - run: flutter pub get - - run: dart format --set-exit-if-changed . - - run: flutter pub publish --dry-run - - run: flutter analyze lib example/lib - - run: cd example; flutter build ios --no-codesign + - run: cd example; flutter test; flutter build ios --no-codesign build_android: + needs: analyze name: Build Android on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-latest, macos-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v2 @@ -49,9 +98,6 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: 'stable' - - run: flutter --version + cache: true - run: flutter pub get - - run: dart format --set-exit-if-changed . - - run: flutter pub publish --dry-run - - run: flutter analyze lib example/lib - - run: cd example; flutter build apk --debug + - run: cd example; flutter test; flutter build apk --debug diff --git a/analysis_options.yaml b/analysis_options.yaml index 234b7f3..96e7b07 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,244 +1,39 @@ -# Specify analysis options. -# -# For a list of lints, see: http://dart-lang.github.io/linter/lints/ -# See the configuration guide for more -# https://github.com/dart-lang/sdk/tree/main/pkg/analyzer#configuring-the-analyzer -# -# There are other similar analysis options files in the flutter repos, -# which should be kept in sync with this file: -# -# - analysis_options.yaml (this file) -# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml -# - https://github.com/flutter/engine/blob/master/analysis_options.yaml -# - https://github.com/flutter/packages/blob/master/analysis_options.yaml -# -# This file contains the analysis options used for code in the flutter/flutter -# repository. +include: package:flutter_lints/flutter.yaml analyzer: - language: - strict-casts: true - strict-raw-types: true errors: - # 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 exclude: - - "lib/*.g.dart" - "lib/**/*.g.dart" +formatter: + trailing_commas: preserve + linter: rules: - # This list is derived from the list of all available lints located at - # https://github.com/dart-lang/linter/blob/master/example/all.yaml - - always_declare_return_types - - always_put_control_body_on_new_line - # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 - - always_specify_types - # - always_use_package_imports # we do this commonly - - annotate_overrides - # - avoid_annotating_with_dynamic # conflicts with always_specify_types - - avoid_bool_literals_in_conditional_expressions - # - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023 - # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023 - # avoid_classes_with_only_static_members # # we do this commonly for `abstract final class`es - - avoid_double_and_int_checks - - avoid_dynamic_calls - - avoid_empty_else - - avoid_equals_and_hash_code_on_mutable_classes - - avoid_escaping_inner_quotes - - avoid_field_initializers_in_const_classes - # - avoid_final_parameters # incompatible with prefer_final_parameters - - avoid_function_literals_in_foreach_calls - - avoid_implementing_value_types - - avoid_init_to_null - - avoid_js_rounded_ints - # - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to - - avoid_null_checks_in_equality_operators - # - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it - - avoid_print - # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) - - avoid_redundant_argument_values - - avoid_relative_lib_imports - - avoid_renaming_method_parameters - - avoid_return_types_on_setters - - avoid_returning_null_for_void - # - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives - - avoid_setters_without_getters - - avoid_shadowing_type_parameters - - avoid_single_cascade_in_expression_statements - - avoid_slow_async_io - - avoid_type_to_string - - avoid_types_as_parameter_names - # - avoid_types_on_closure_parameters # conflicts with always_specify_types - - avoid_unnecessary_containers - - avoid_unused_constructor_parameters - - avoid_void_async - # - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere - - await_only_futures - - camel_case_extensions - - camel_case_types - - cancel_subscriptions - # - cascade_invocations # doesn't match the typical style of this repo - - cast_nullable_to_non_nullable - # - close_sinks # not reliable enough - - collection_methods_unrelated_type - - combinators_ordering - # - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142 - - conditional_uri_does_not_exist - # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 - - control_flow_in_finally - - curly_braces_in_flow_control_structures - - dangling_library_doc_comments - - depend_on_referenced_packages - - deprecated_consistency - # - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib) - - directives_ordering - # - discarded_futures # too many false positives, similar to unawaited_futures - # - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic - - empty_catches - - empty_constructor_bodies - - empty_statements - - eol_at_end_of_file - - exhaustive_cases - - file_names - - flutter_style_todos - - hash_and_equals - - implementation_imports - - implicit_call_tearoffs - - invalid_case_patterns - - iterable_contains_unrelated_type - # - join_return_with_assignment # not required by flutter style - - leading_newlines_in_multiline_strings - - library_annotations - - library_names - - library_prefixes - - library_private_types_in_public_api - # - lines_longer_than_80_chars # not required by flutter style - - list_remove_unrelated_type - # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453 - - missing_whitespace_between_adjacent_strings - - no_adjacent_strings_in_list - - no_default_cases - - no_duplicate_case_values - - no_leading_underscores_for_library_prefixes - - no_leading_underscores_for_local_identifiers - - no_logic_in_create_state - # - no_runtimeType_toString # ok in tests; we enable this only in packages/ - - non_constant_identifier_names - - noop_primitive_operations - - null_check_on_nullable_type_parameter - - null_closures - # - omit_local_variable_types # opposite of always_specify_types - # - one_member_abstracts # too many false positives - - only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al - - overridden_fields - - package_api_docs - - package_names - - package_prefixed_library_names - # - parameter_assignments # we do this commonly - - prefer_adjacent_string_concatenation - - prefer_asserts_in_initializer_lists - # - prefer_asserts_with_message # not required by flutter style - - prefer_collection_literals - - prefer_conditional_assignment - # - prefer_const_constructors - - prefer_const_constructors_in_immutables - - prefer_const_declarations - - prefer_const_literals_to_create_immutables - # - prefer_constructors_over_static_methods # far too many false positives - - prefer_contains - # - prefer_double_quotes # opposite of prefer_single_quotes - # - 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_in_for_each - - prefer_final_locals - # - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments - - prefer_for_elements_to_map_fromIterable - - prefer_foreach - - prefer_function_declarations_over_variables - - prefer_generic_function_type_aliases - - prefer_if_elements_to_conditional_expressions - - prefer_if_null_operators - - prefer_initializing_formals - - prefer_inlined_adds - # - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants - - prefer_interpolation_to_compose_strings - - prefer_is_empty - - prefer_is_not_empty - - prefer_is_not_operator - - prefer_iterable_whereType - # - prefer_mixin - # - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere - - prefer_null_aware_operators - # - prefer_relative_imports - - prefer_single_quotes - - prefer_spread_collections - - prefer_typing_uninitialized_variables - - prefer_void_to_null - - provide_deprecation_message - # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml - - recursive_getters - # - require_trailing_commas # would be nice, but requires a lot of manual work: 10,000+ code locations would need to be reformatted by hand after bulk fix is applied - - secure_pubspec_urls - - sized_box_for_whitespace - - sized_box_shrink_expand - - slash_for_doc_comments - - sort_child_properties_last - - sort_constructors_first - # - sort_pub_dependencies # prevents separating pinned transitive dependencies - - sort_unnamed_constructors_first - - test_types_in_equals - - throw_in_finally - - tighten_type_of_initializing_formals - # - type_annotate_public_apis # subset of always_specify_types - - type_init_formals - # - unawaited_futures # too many false positives, especially with the way AnimationController works - - unnecessary_await_in_return - - unnecessary_brace_in_string_interps - - unnecessary_breaks - - unnecessary_const - - unnecessary_constructor_name - # - unnecessary_final # conflicts with prefer_final_locals - - unnecessary_getters_setters - # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 - - unnecessary_late - - unnecessary_library_directive - - unnecessary_new - - unnecessary_null_aware_assignments - - unnecessary_null_aware_operator_on_extension_on_nullable - - unnecessary_null_checks - - unnecessary_null_in_if_null_operators - - unnecessary_nullable_for_final_variable_declarations - - unnecessary_overrides - - unnecessary_parenthesis - # - unnecessary_raw_strings # what's "necessary" is a matter of opinion; consistency across strings can help readability more than this lint - - unnecessary_statements - - unnecessary_string_escapes - - unnecessary_string_interpolations - - unnecessary_this - - unnecessary_to_list_in_spreads - # - unreachable_from_main # Do not enable this rule until it is un-marked as "experimental" and carefully re-evaluated. - - unrelated_type_equality_checks - - unsafe_html - - use_build_context_synchronously - - use_colored_box - # - use_decorated_box # leads to bugs: DecoratedBox and Container are not equivalent (Container inserts extra padding) - - use_enums - - use_full_hex_values_for_flutter_colors - - use_function_type_syntax_for_parameters - - use_if_null_to_convert_nulls_to_bools - - use_is_even_rather_than_modulo - - use_key_in_widget_constructors - - use_late_for_private_fields_and_variables - - use_named_constants - - use_raw_strings - - use_rethrow_when_possible - - use_setters_to_change_properties - # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 - - use_string_in_part_of_directives - - use_super_parameters - - use_test_throws_matchers - # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review - - valid_regexps - - void_checks + always_declare_return_types: true + always_put_control_body_on_new_line: true + avoid_print: true + avoid_renaming_method_parameters: true + avoid_unnecessary_containers: true + avoid_void_async: true + curly_braces_in_flow_control_structures: true + directives_ordering: true + flutter_style_todos: true + library_private_types_in_public_api: false + overridden_fields: false + prefer_const_constructors: true + prefer_const_constructors_in_immutables: false + prefer_final_fields: true + prefer_final_in_for_each: true + prefer_final_locals: true + prefer_single_quotes: true + sort_child_properties_last: true + sort_constructors_first: true + sort_unnamed_constructors_first: true + unnecessary_await_in_return: true + unnecessary_breaks: true + unnecessary_late: true + unnecessary_parenthesis: true + use_build_context_synchronously: false + void_checks: true diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..8493228 --- /dev/null +++ b/build.yaml @@ -0,0 +1,11 @@ +targets: + $default: + builders: + json_serializable: + options: + any_map: true + explicit_to_json: true + field_rename: snake + generate_for: + exclude: + - lib/**/*.g.dart diff --git a/example/.gitignore b/example/.gitignore index 24476c5..065dc2c 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -31,6 +31,7 @@ migrate_working_dir/ .pub-cache/ .pub/ /build/ +pubspec.lock # Symbolication related app.*.symbols diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 94adc3a..2597170 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/example/build.yaml b/example/build.yaml new file mode 100644 index 0000000..8493228 --- /dev/null +++ b/example/build.yaml @@ -0,0 +1,11 @@ +targets: + $default: + builders: + json_serializable: + options: + any_map: true + explicit_to_json: true + field_rename: snake + generate_for: + exclude: + - lib/**/*.g.dart diff --git a/example/lib/api/model/tencent_api_resp.g.dart b/example/lib/api/model/tencent_api_resp.g.dart index ecb63ab..91d5aa3 100644 --- a/example/lib/api/model/tencent_api_resp.g.dart +++ b/example/lib/api/model/tencent_api_resp.g.dart @@ -6,14 +6,14 @@ part of 'tencent_api_resp.dart'; // JsonSerializableGenerator // ************************************************************************** -TencentUserInfoResp _$TencentUserInfoRespFromJson(Map json) => +TencentUserInfoResp _$TencentUserInfoRespFromJson(Map json) => TencentUserInfoResp( - ret: json['ret'] as int? ?? 0, + ret: (json['ret'] as num?)?.toInt() ?? 0, msg: json['msg'] as String?, - isLost: json['is_lost'] as int?, + isLost: (json['is_lost'] as num?)?.toInt(), nickname: json['nickname'] as String?, gender: json['gender'] as String?, - genderType: json['gender_type'] as int?, + genderType: (json['gender_type'] as num?)?.toInt(), province: json['province'] as String?, city: json['city'] as String?, year: json['year'] as String?, diff --git a/example/lib/api/model/tencent_unionid_resp.g.dart b/example/lib/api/model/tencent_unionid_resp.g.dart index 01b1682..d5d7714 100644 --- a/example/lib/api/model/tencent_unionid_resp.g.dart +++ b/example/lib/api/model/tencent_unionid_resp.g.dart @@ -6,9 +6,8 @@ part of 'tencent_unionid_resp.dart'; // JsonSerializableGenerator // ************************************************************************** -TencentUnionidResp _$TencentUnionidRespFromJson(Map json) => - TencentUnionidResp( - error: json['error'] as int? ?? 0, +TencentUnionidResp _$TencentUnionidRespFromJson(Map json) => TencentUnionidResp( + error: (json['error'] as num?)?.toInt() ?? 0, errorDescription: json['error_description'] as String?, clientId: json['client_id'] as String?, openid: json['openid'] as String?, diff --git a/example/lib/main.dart b/example/lib/main.dart index 855325f..efa38a3 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -12,7 +12,7 @@ const String _kTencentAppID = 'your tencent app id'; const String _kUniversalLink = 'your tencent universal link'; // 可选项目 void main() { - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { @@ -22,7 +22,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return MaterialApp( + return const MaterialApp( home: Home(), ); } @@ -71,12 +71,12 @@ class _HomeState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Tencent Kit Demo'), + title: const Text('Tencent Kit Demo'), ), body: ListView( children: [ ListTile( - title: Text('3.1.0 之后的版本请先获取权限'), + title: const Text('3.1.0 之后的版本请先获取权限'), onTap: () async { await TencentKitPlatform.instance .setIsPermissionGranted(granted: true); @@ -84,7 +84,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('注册APP'), + title: const Text('注册APP'), onTap: () async { await TencentKitPlatform.instance.registerApp( appId: _kTencentAppID, universalLink: _kUniversalLink); @@ -92,7 +92,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('环境检查'), + title: const Text('环境检查'), onTap: () async { final String content = 'QQ install: ${await TencentKitPlatform.instance.isQQInstalled()}\nTIM install: ${await TencentKitPlatform.instance.isTIMInstalled()}'; @@ -100,7 +100,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('登录'), + title: const Text('登录'), onTap: () { TencentKitPlatform.instance.login( scope: [TencentScope.kGetSimpleUserInfo], @@ -108,7 +108,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('登录(Server-Side)'), + title: const Text('登录(Server-Side)'), onTap: () { TencentKitPlatform.instance.loginServerSide( scope: [TencentScope.kGetUserInfo], @@ -116,7 +116,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('获取用户信息'), + title: const Text('获取用户信息'), onTap: () async { if ((_loginResp?.isSuccessful ?? false) && !(_loginResp!.isExpired ?? true)) { @@ -136,7 +136,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('获取UnionID'), + title: const Text('获取UnionID'), onTap: () async { if ((_loginResp?.isSuccessful ?? false) && !(_loginResp!.isExpired ?? true)) { @@ -154,7 +154,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('分享说说'), + title: const Text('分享说说'), onTap: () { TencentKitPlatform.instance.shareMood( scene: TencentScene.kScene_QZone, @@ -163,7 +163,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('文本分享'), + title: const Text('文本分享'), onTap: () { TencentKitPlatform.instance.shareText( scene: TencentScene.kScene_QQ, @@ -172,7 +172,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('图片分享'), + title: const Text('图片分享'), onTap: () async { final File file = await DefaultCacheManager().getSingleFile( 'https://www.baidu.com/img/bd_logo1.png?where=super'); @@ -183,7 +183,7 @@ class _HomeState extends State { }, ), ListTile( - title: Text('网页分享'), + title: const Text('网页分享'), onTap: () { TencentKitPlatform.instance.shareWebpage( scene: TencentScene.kScene_QQ, diff --git a/example/pubspec.lock b/example/pubspec.lock deleted file mode 100644 index 40e3833..0000000 --- a/example/pubspec.lock +++ /dev/null @@ -1,731 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a - url: "https://pub.dev" - source: hosted - version: "61.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 - url: "https://pub.dev" - source: hosted - version: "5.13.0" - args: - dependency: transitive - description: - name: args - sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a - url: "https://pub.dev" - source: hosted - version: "2.4.1" - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - build: - dependency: transitive - description: - name: build - sha256: "43865b79fbb78532e4bff7c33087aa43b1d488c4fdef014eaef568af6d8016dc" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - build_config: - dependency: transitive - description: - name: build_config - sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 - url: "https://pub.dev" - source: hosted - version: "1.1.1" - build_daemon: - dependency: transitive - description: - name: build_daemon - sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" - url: "https://pub.dev" - source: hosted - version: "4.0.0" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95 - url: "https://pub.dev" - source: hosted - version: "2.2.0" - build_runner: - dependency: "direct dev" - description: - name: build_runner - sha256: "220ae4553e50d7c21a17c051afc7b183d28a24a420502e842f303f8e4e6edced" - url: "https://pub.dev" - source: hosted - version: "2.4.4" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - sha256: "88a57f2ac99849362e73878334caa9f06ee25f31d2adced882b8337838c84e1e" - url: "https://pub.dev" - source: hosted - version: "7.2.9" - built_collection: - dependency: transitive - description: - name: built_collection - sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" - url: "https://pub.dev" - source: hosted - version: "5.1.1" - built_value: - dependency: transitive - description: - name: built_value - sha256: "7dd62d9faf105c434f3d829bbe9c4be02ec67f5ed94832222116122df67c5452" - url: "https://pub.dev" - source: hosted - version: "8.6.0" - characters: - dependency: transitive - description: - name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" - source: hosted - version: "1.3.0" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff - url: "https://pub.dev" - source: hosted - version: "2.0.3" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - code_builder: - dependency: transitive - description: - name: code_builder - sha256: "4ad01d6e56db961d29661561effde45e519939fdaeb46c351275b182eac70189" - url: "https://pub.dev" - source: hosted - version: "4.5.0" - collection: - dependency: transitive - description: - name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" - url: "https://pub.dev" - source: hosted - version: "1.17.1" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - crypto: - dependency: transitive - description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: f4f1f73ab3fd2afcbcca165ee601fe980d966af6a21b5970c6c9376955c528ad - url: "https://pub.dev" - source: hosted - version: "2.3.1" - fake_async: - dependency: transitive - description: - name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - ffi: - dependency: transitive - description: - name: ffi - sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 - url: "https://pub.dev" - source: hosted - version: "2.0.2" - file: - dependency: transitive - description: - name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" - url: "https://pub.dev" - source: hosted - version: "6.1.4" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_cache_manager: - dependency: "direct main" - description: - name: flutter_cache_manager - sha256: "32cd900555219333326a2d0653aaaf8671264c29befa65bbd9856d204a4c9fb3" - url: "https://pub.dev" - source: hosted - version: "3.3.0" - flutter_driver: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c - url: "https://pub.dev" - source: hosted - version: "2.0.1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" - url: "https://pub.dev" - source: hosted - version: "3.2.0" - fuchsia_remote_debug_protocol: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - glob: - dependency: transitive - description: - name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - graphs: - dependency: transitive - description: - name: graphs - sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 - url: "https://pub.dev" - source: hosted - version: "2.3.1" - http: - dependency: transitive - description: - name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" - url: "https://pub.dev" - source: hosted - version: "0.13.6" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - integration_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - io: - dependency: transitive - description: - name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" - json_annotation: - dependency: "direct main" - description: - name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 - url: "https://pub.dev" - source: hosted - version: "4.8.1" - json_serializable: - dependency: "direct dev" - description: - name: json_serializable - sha256: "61a60716544392a82726dd0fa1dd6f5f1fd32aec66422b6e229e7b90d52325c4" - url: "https://pub.dev" - source: hosted - version: "6.7.0" - lints: - dependency: transitive - description: - name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - logging: - dependency: transitive - description: - name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - matcher: - dependency: transitive - description: - name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" - url: "https://pub.dev" - source: hosted - version: "0.12.15" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 - url: "https://pub.dev" - source: hosted - version: "0.2.0" - meta: - dependency: transitive - description: - name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" - url: "https://pub.dev" - source: hosted - version: "1.9.1" - mime: - dependency: transitive - description: - name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e - url: "https://pub.dev" - source: hosted - version: "1.0.4" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - path: - dependency: transitive - description: - name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" - source: hosted - version: "1.8.3" - path_provider: - dependency: transitive - description: - name: path_provider - sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" - url: "https://pub.dev" - source: hosted - version: "2.0.15" - path_provider_android: - dependency: transitive - description: - name: path_provider_android - sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86" - url: "https://pub.dev" - source: hosted - version: "2.0.27" - path_provider_foundation: - dependency: transitive - description: - name: path_provider_foundation - sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3" - url: "https://pub.dev" - source: hosted - version: "2.2.3" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57 - url: "https://pub.dev" - source: hosted - version: "2.1.11" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" - url: "https://pub.dev" - source: hosted - version: "2.0.6" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6 - url: "https://pub.dev" - source: hosted - version: "2.1.6" - pedantic: - dependency: transitive - description: - name: pedantic - sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" - url: "https://pub.dev" - source: hosted - version: "1.11.1" - platform: - dependency: transitive - description: - name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" - source: hosted - version: "4.2.4" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 - url: "https://pub.dev" - source: hosted - version: "1.2.3" - rxdart: - dependency: transitive - description: - name: rxdart - sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" - url: "https://pub.dev" - source: hosted - version: "0.27.7" - shelf: - dependency: transitive - description: - name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" - source: hosted - version: "1.4.1" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: "373f96cf5a8744bc9816c1ff41cf5391bbdbe3d7a96fe98c622b6738a8a7bd33" - url: "https://pub.dev" - source: hosted - version: "1.3.2" - source_helper: - dependency: transitive - description: - name: source_helper - sha256: "3b67aade1d52416149c633ba1bb36df44d97c6b51830c2198e934e3fca87ca1f" - url: "https://pub.dev" - source: hosted - version: "1.3.3" - source_span: - dependency: transitive - description: - name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" - source: hosted - version: "1.9.1" - sqflite: - dependency: transitive - description: - name: sqflite - sha256: b4d6710e1200e96845747e37338ea8a819a12b51689a3bcf31eff0003b37a0b9 - url: "https://pub.dev" - source: hosted - version: "2.2.8+4" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - sha256: e77abf6ff961d69dfef41daccbb66b51e9983cdd5cb35bf30733598057401555 - url: "https://pub.dev" - source: hosted - version: "2.4.5" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 - url: "https://pub.dev" - source: hosted - version: "1.11.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - stream_transform: - dependency: transitive - description: - name: stream_transform - sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - sync_http: - dependency: transitive - description: - name: sync_http - sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" - url: "https://pub.dev" - source: hosted - version: "0.3.1" - synchronized: - dependency: transitive - description: - name: synchronized - sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" - url: "https://pub.dev" - source: hosted - version: "3.1.0" - tencent_kit: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "6.0.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test_api: - dependency: transitive - description: - name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb - url: "https://pub.dev" - source: hosted - version: "0.5.1" - timing: - dependency: transitive - description: - name: timing - sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - uuid: - dependency: transitive - description: - name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" - url: "https://pub.dev" - source: hosted - version: "3.0.7" - vector_math: - dependency: transitive - description: - name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: f6deed8ed625c52864792459709183da231ebf66ff0cf09e69b573227c377efe - url: "https://pub.dev" - source: hosted - version: "11.3.0" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b - url: "https://pub.dev" - source: hosted - version: "2.4.0" - webdriver: - dependency: transitive - description: - name: webdriver - sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - win32: - dependency: transitive - description: - name: win32 - sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" - url: "https://pub.dev" - source: hosted - version: "4.1.4" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 - url: "https://pub.dev" - source: hosted - version: "1.0.0" - yaml: - dependency: transitive - description: - name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" - source: hosted - version: "3.1.2" -sdks: - dart: ">=3.0.2 <4.0.0" - flutter: ">=3.3.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index e6a7a9e..b933834 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,38 +1,20 @@ name: tencent_kit_example description: Demonstrates how to use the tencent_kit plugin. -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -version: 1.0.0+1 +publish_to: 'none' environment: sdk: '>=3.0.2 <4.0.0' + flutter: ">=3.3.0" -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter tencent_kit: - # When depending on this package from a real application you should use: - # tencent_kit: ^x.y.z - # See https://dart.dev/tools/pub/dependencies#version-constraints - # The example app is bundled with the plugin so we use a path dependency on - # the parent directory to use the current plugin's version. path: ../ - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 - flutter_cache_manager: ^3.3.0 - json_annotation: ^4.8.1 dev_dependencies: @@ -40,59 +22,14 @@ dev_dependencies: sdk: flutter flutter_test: sdk: flutter + flutter_lints: any - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. - flutter_lints: ^2.0.0 + build_runner: ^2.0.0 + json_serializable: ^6.7.0 - build_runner: - json_serializable: - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages - tencent_kit: app_id: 123456789 universal_link: https://www.yourdomain.com/universal_link/example_app/qq_conn/123456789/ # 可选项目 diff --git a/ios/Classes/UIApplication+Hook.m b/ios/Classes/UIApplication+Hook.m index 1ed682c..5edba57 100644 --- a/ios/Classes/UIApplication+Hook.m +++ b/ios/Classes/UIApplication+Hook.m @@ -25,9 +25,12 @@ // 注意:由于方法交换,调用 g_openURL: 实际上会调用原 openURL: 实现 // 这里我们调用新版 API if ([UIApplication.sharedApplication respondsToSelector:@selector(openURL:options:completionHandler:)]) { - [UIApplication.sharedApplication openURL:url options:@{} completionHandler:^(BOOL success) { - NSLog(@"openURL:options:completionHandler: 返回 %d", success); - }]; + [UIApplication.sharedApplication + openURL:url + options:@{} + completionHandler:^(BOOL success) { + NSLog(@"openURL:options:completionHandler: 返回 %d", success); + }]; } else { // 如果低于 iOS 10,调用原始实现 return [self g_openURL:url]; // 注意:由于方法交换,这里 g_openURL: 实际上是原 openURL: diff --git a/lib/src/constant.dart b/lib/src/constant.dart index 1ccd33d..8d9ad15 100644 --- a/lib/src/constant.dart +++ b/lib/src/constant.dart @@ -1,6 +1,4 @@ -class TencentScope { - const TencentScope._(); - +abstract final class TencentScope { /// 发表一条说说到QQ空间(需要申请权限) static const String kAddTopic = 'add_topic'; @@ -44,19 +42,17 @@ class TencentScope { static const String kAll = 'all'; } -class TencentScene { - const TencentScene._(); - +abstract final class TencentScene { /// QQ + // ignore: constant_identifier_names static const int kScene_QQ = 0; /// QZone + // ignore: constant_identifier_names static const int kScene_QZone = 1; } -class TencentQZoneFlag { - const TencentQZoneFlag._(); - +abstract final class TencentQZoneFlag { /// 默认是不隐藏分享到QZone按钮且不自动打开分享到QZone的对话框 static const int kDefault = 0; diff --git a/lib/src/model/resp.dart b/lib/src/model/resp.dart index 6326aaf..366b522 100644 --- a/lib/src/model/resp.dart +++ b/lib/src/model/resp.dart @@ -37,10 +37,7 @@ abstract class TencentResp { String toString() => const JsonEncoder.withIndent(' ').convert(toJson()); } -@JsonSerializable( - explicitToJson: true, - fieldRename: FieldRename.snake, -) +@JsonSerializable() class TencentLoginResp extends TencentResp { const TencentLoginResp({ required super.ret, @@ -67,10 +64,7 @@ class TencentLoginResp extends TencentResp { Map toJson() => _$TencentLoginRespToJson(this); } -@JsonSerializable( - explicitToJson: true, - fieldRename: FieldRename.snake, -) +@JsonSerializable() class TencentShareMsgResp extends TencentResp { const TencentShareMsgResp({ required super.ret, diff --git a/lib/src/model/resp.g.dart b/lib/src/model/resp.g.dart index af83bb7..1946ce7 100644 --- a/lib/src/model/resp.g.dart +++ b/lib/src/model/resp.g.dart @@ -6,14 +6,13 @@ part of 'resp.dart'; // JsonSerializableGenerator // ************************************************************************** -TencentLoginResp _$TencentLoginRespFromJson(Map json) => - TencentLoginResp( - ret: json['ret'] as int? ?? 0, +TencentLoginResp _$TencentLoginRespFromJson(Map json) => TencentLoginResp( + ret: (json['ret'] as num?)?.toInt() ?? 0, msg: json['msg'] as String?, openid: json['openid'] as String?, accessToken: json['access_token'] as String?, - expiresIn: json['expires_in'] as int?, - createAt: json['create_at'] as int?, + expiresIn: (json['expires_in'] as num?)?.toInt(), + createAt: (json['create_at'] as num?)?.toInt(), ); Map _$TencentLoginRespToJson(TencentLoginResp instance) => @@ -26,9 +25,9 @@ Map _$TencentLoginRespToJson(TencentLoginResp instance) => 'create_at': instance.createAt, }; -TencentShareMsgResp _$TencentShareMsgRespFromJson(Map json) => +TencentShareMsgResp _$TencentShareMsgRespFromJson(Map json) => TencentShareMsgResp( - ret: json['ret'] as int? ?? 0, + ret: (json['ret'] as num?)?.toInt() ?? 0, msg: json['msg'] as String?, ); diff --git a/lib/tencent_kit.dart b/lib/tencent_kit.dart index dbaf36a..d104b11 100644 --- a/lib/tencent_kit.dart +++ b/lib/tencent_kit.dart @@ -1,4 +1,5 @@ /// tencent_kit +// ignore: unnecessary_library_name library tencent_kit; export 'src/constant.dart'; diff --git a/lib/tencent_kit_platform_interface.dart b/lib/tencent_kit_platform_interface.dart index 6c38b46..0d58957 100644 --- a/lib/tencent_kit_platform_interface.dart +++ b/lib/tencent_kit_platform_interface.dart @@ -1,4 +1,5 @@ /// tencent_kit_platform_interface +// ignore: unnecessary_library_name library tencent_kit_platform_interface; export 'src/constant.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index e40f738..13cb5bd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: tencent_kit description: A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS & HarmonyOS Tencent SDKs. version: 6.2.0 homepage: https://github.com/RxReader/tencent_kit -repository: https://github.com/RxReader/tencent_kit.git +repository: https://github.com/RxReader/tencent_kit issue_tracker: https://github.com/RxReader/tencent_kit/issues environment: @@ -12,33 +12,19 @@ environment: dependencies: flutter: sdk: flutter - plugin_platform_interface: ^2.0.2 + plugin_platform_interface: ^2.0.2 json_annotation: ^4.8.1 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.0 + flutter_lints: - build_runner: - json_serializable: + build_runner: ^2.0.0 + json_serializable: ^6.7.0 -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. flutter: - # This section identifies this Flutter project as a plugin project. - # The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.) - # which should be registered in the plugin registry. This is required for - # using method channels. - # The Android 'package' specifies package in which the registered class is. - # This is required for using method channels on Android. - # The 'ffiPlugin' specifies that native code should be built and bundled. - # This is required for using `dart:ffi`. - # All these are used by the tooling to maintain consistency when - # adding or updating assets for this project. plugin: platforms: android: @@ -48,34 +34,3 @@ flutter: pluginClass: TencentKitPlugin ohos: pluginClass: TencentKitPlugin - - # To add assets to your plugin package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # To add custom fonts to your plugin package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages diff --git a/test/tencent_kit_test.dart b/test/tencent_kit_test.dart index 8d3fd8e..0a23d6c 100644 --- a/test/tencent_kit_test.dart +++ b/test/tencent_kit_test.dart @@ -42,6 +42,7 @@ class MockTencentKitPlatform @override Future login({ required List scope, + bool qrcode = false, }) { throw UnimplementedError(); } @@ -49,6 +50,7 @@ class MockTencentKitPlatform @override Future loginServerSide({ required List scope, + bool qrcode = false, }) { throw UnimplementedError(); }