升级Flutter 3.0

This commit is contained in:
v7lin 2022-05-19 16:12:25 +08:00
parent 9e9373e48a
commit b1489916c7
60 changed files with 987 additions and 1018 deletions

12
.github/FUNDING.yml vendored
View File

@ -1,12 +0,0 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://v7lin.github.io/docsify/#/navbar/sponsor # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -10,10 +10,12 @@ jobs:
matrix: matrix:
os: [macos-latest] os: [macos-latest]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- uses: actions/setup-java@v1 - uses: actions/setup-java@v2
with: with:
java-version: '8.x' distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- uses: subosito/flutter-action@v1 - uses: subosito/flutter-action@v1
with: with:
channel: 'stable' channel: 'stable'
@ -32,10 +34,12 @@ jobs:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- uses: actions/setup-java@v1 - uses: actions/setup-java@v2
with: with:
java-version: '8.x' distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- uses: subosito/flutter-action@v1 - uses: subosito/flutter-action@v1
with: with:
channel: 'stable' channel: 'stable'
@ -45,5 +49,5 @@ jobs:
- run: flutter format --dry-run --set-exit-if-changed . - run: flutter format --dry-run --set-exit-if-changed .
- run: flutter pub publish --dry-run - run: flutter pub publish --dry-run
- run: flutter analyze lib example/lib - run: flutter analyze lib example/lib
- run: sudo echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "ndk;20.0.5594570" - run: sudo echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.1.6352462"
- run: cd example; flutter build apk --debug - run: cd example; flutter build apk --debug

View File

@ -9,8 +9,8 @@ jobs:
name: Publish name: Publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- uses: sakebook/actions-flutter-pub-publisher@v1.3.0 - uses: sakebook/actions-flutter-pub-publisher@v1.4.0
with: with:
credential: ${{ secrets.CREDENTIAL_JSON }} credential: ${{ secrets.CREDENTIAL_JSON }}
flutter_package: true flutter_package: true

View File

@ -7,8 +7,8 @@ jobs:
name: Publish Manually name: Publish Manually
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- uses: sakebook/actions-flutter-pub-publisher@v1.3.0 - uses: sakebook/actions-flutter-pub-publisher@v1.4.0
with: with:
credential: ${{ secrets.CREDENTIAL_JSON }} credential: ${{ secrets.CREDENTIAL_JSON }}
flutter_package: true flutter_package: true

33
.gitignore vendored
View File

@ -1,11 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store .DS_Store
.dart_tool/ .atom/
.buildlog/
.history
.svn/
migrate_working_dir/
.packages # IntelliJ related
.pub/
build/
#
*.iml *.iml
*.ipr
*.iws
.idea/ .idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/

View File

@ -1,10 +1,33 @@
# This file tracks properties of this Flutter project. # This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc. # Used by Flutter tool to assess capabilities and perform upgrades etc.
# #
# This file should be version controlled and should not be manually edited. # This file should be version controlled.
version: version:
revision: b041144f833e05cf463b8887fa12efdec9493488 revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
channel: stable channel: stable
project_type: plugin project_type: plugin
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: android
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: ios
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'

View File

@ -1,3 +1,8 @@
## 4.0.0
* Flutter 3.0
* break change:
## 3.1.0 ## 3.1.0
* Android SDK * Android SDK

View File

@ -5,39 +5,44 @@
# #
# For a list of lints, see: http://dart-lang.github.io/linter/lints/ # For a list of lints, see: http://dart-lang.github.io/linter/lints/
# See the configuration guide for more # See the configuration guide for more
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer # https://github.com/dart-lang/sdk/tree/main/pkg/analyzer#configuring-the-analyzer
# #
# There are other similar analysis options files in the flutter repos, # There are other similar analysis options files in the flutter repos,
# which should be kept in sync with this file: # which should be kept in sync with this file:
# #
# - analysis_options.yaml (this file) # - analysis_options.yaml (this file)
# - packages/flutter/lib/analysis_options_user.yaml
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml # - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
# - https://github.com/flutter/engine/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 by Flutter tools, such as IntelliJ, # This file contains the analysis options used by Flutter tools, such as IntelliJ,
# Android Studio, and the `flutter analyze` command. # Android Studio, and the `flutter analyze` command.
analyzer: analyzer:
strong-mode: language:
implicit-casts: false strict-raw-types: true
implicit-dynamic: false
errors: errors:
# treat missing required parameters as a warning (not a hint) # treat missing required parameters as a warning (not a hint)
missing_required_param: warning missing_required_param: warning
# treat missing returns as a warning (not a hint) # treat missing returns as a warning (not a hint)
missing_return: warning missing_return: warning
# allow having TODOs in the code # allow having TODO comments in the code
todo: ignore todo: ignore
# allow self-reference to deprecated members (we do this because otherwise we have # 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) # to annotate every member in every test, assert, etc, when we deprecate something)
deprecated_member_use_from_same_package: ignore deprecated_member_use_from_same_package: ignore
# Ignore analyzer hints for updating pubspecs when using Future or # TODO(ianh): https://github.com/flutter/flutter/issues/74381
# Stream and not importing dart:async # Clean up existing unnecessary imports, and remove line to ignore.
# Please see https://github.com/flutter/flutter/pull/24528 for details. unnecessary_import: ignore
sdk_version_async_exported_from_core: ignore # Turned off until null-safe rollout is complete.
unnecessary_null_comparison: ignore
exclude: exclude:
- "bin/cache/**"
# Ignore protoc generated files
- "dev/conductor/lib/proto/*"
#
- "lib/*.g.dart" - "lib/*.g.dart"
- "lib/**/*.g.dart"
linter: linter:
rules: rules:
@ -52,62 +57,68 @@ linter:
- always_use_package_imports # we do this commonly - always_use_package_imports # we do this commonly
- annotate_overrides - annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types # - avoid_annotating_with_dynamic # conflicts with always_specify_types
# - avoid_as # required for implicit-casts: true
- avoid_bool_literals_in_conditional_expressions - avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses # we do this commonly # - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
# - avoid_catching_errors # we do this commonly # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
- avoid_classes_with_only_static_members - avoid_classes_with_only_static_members
# - avoid_double_and_int_checks # only useful when targeting JS runtime - avoid_double_and_int_checks
- avoid_dynamic_calls
- avoid_empty_else - avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes - avoid_equals_and_hash_code_on_mutable_classes
# - avoid_escaping_inner_quotes # not yet tested - avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes - avoid_field_initializers_in_const_classes
# - avoid_final_parameters # incompatible with prefer_final_parameters
- avoid_function_literals_in_foreach_calls - avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types # not yet tested - avoid_implementing_value_types
- avoid_init_to_null - avoid_init_to_null
# - avoid_js_rounded_ints # only useful when targeting JS runtime - 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_null_checks_in_equality_operators
# - avoid_positional_boolean_parameters # not yet tested # - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
# - avoid_print # not yet tested - avoid_print
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
# - avoid_redundant_argument_values # not yet tested # - avoid_redundant_argument_values
- avoid_relative_lib_imports - avoid_relative_lib_imports
- avoid_renaming_method_parameters - avoid_renaming_method_parameters
- avoid_return_types_on_setters - avoid_return_types_on_setters
# - avoid_returning_null # there are plenty of valid reasons to return null # - avoid_returning_null # still violated by some pre-nnbd code that we haven't yet migrated
# - avoid_returning_null_for_future # not yet tested - avoid_returning_null_for_future
- avoid_returning_null_for_void - avoid_returning_null_for_void
# - avoid_returning_this # there are plenty of valid reasons to return this # - 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 # not yet tested - avoid_setters_without_getters
- avoid_shadowing_type_parameters - avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements - avoid_single_cascade_in_expression_statements
- avoid_slow_async_io - avoid_slow_async_io
# - avoid_type_to_string # we do this commonly - avoid_type_to_string
- avoid_types_as_parameter_names - avoid_types_as_parameter_names
# - avoid_types_on_closure_parameters # conflicts with always_specify_types # - avoid_types_on_closure_parameters # conflicts with always_specify_types
# - avoid_unnecessary_containers # not yet tested - avoid_unnecessary_containers
- avoid_unused_constructor_parameters - avoid_unused_constructor_parameters
- avoid_void_async - avoid_void_async
# - avoid_web_libraries_in_flutter # not yet tested # - 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 - await_only_futures
- camel_case_extensions - camel_case_extensions
- camel_case_types - camel_case_types
- cancel_subscriptions - cancel_subscriptions
# - cascade_invocations # not yet tested # - cascade_invocations # doesn't match the typical style of this repo
- cast_nullable_to_non_nullable - cast_nullable_to_non_nullable
# - close_sinks # not reliable enough # - close_sinks # not reliable enough
# - comment_references # blocked on https://github.com/flutter/flutter/issues/20765 # - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
# - conditional_uri_does_not_exist # not yet tested
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally - control_flow_in_finally
# - curly_braces_in_flow_control_structures # not required by flutter style # - curly_braces_in_flow_control_structures # not required by flutter style
# - diagnostic_describe_all_properties # not yet tested - depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
- directives_ordering - directives_ordering
# - do_not_use_environment # we do this commonly # - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
- empty_catches - empty_catches
- empty_constructor_bodies - empty_constructor_bodies
- empty_statements - empty_statements
- eol_at_end_of_file
- exhaustive_cases - exhaustive_cases
- file_names # not yet tested - file_names
- flutter_style_todos - flutter_style_todos
- hash_and_equals - hash_and_equals
- implementation_imports - implementation_imports
@ -117,24 +128,28 @@ linter:
- leading_newlines_in_multiline_strings - leading_newlines_in_multiline_strings
- library_names - library_names
- library_prefixes - library_prefixes
- library_private_types_in_public_api
# - lines_longer_than_80_chars # not required by flutter style # - lines_longer_than_80_chars # not required by flutter style
- list_remove_unrelated_type - list_remove_unrelated_type
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
# - missing_whitespace_between_adjacent_strings # not yet tested - missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list - no_adjacent_strings_in_list
# - no_default_cases # too many false positives - no_default_cases
- no_duplicate_case_values - no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_logic_in_create_state - no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/ # - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names - non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter - null_check_on_nullable_type_parameter
# - null_closures # not required by flutter style - null_closures
# - omit_local_variable_types # opposite of always_specify_types # - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives # - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792 - only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al
- overridden_fields - overridden_fields
- package_api_docs - package_api_docs
# - package_names # non conforming packages in sdk - package_names
- package_prefixed_library_names - package_prefixed_library_names
# - parameter_assignments # we do this commonly # - parameter_assignments # we do this commonly
- prefer_adjacent_string_concatenation - prefer_adjacent_string_concatenation
@ -142,10 +157,10 @@ linter:
# - prefer_asserts_with_message # not required by flutter style # - prefer_asserts_with_message # not required by flutter style
- prefer_collection_literals - prefer_collection_literals
- prefer_conditional_assignment - prefer_conditional_assignment
- prefer_const_constructors # - prefer_const_constructors
- prefer_const_constructors_in_immutables - prefer_const_constructors_in_immutables
- prefer_const_declarations - prefer_const_declarations
- prefer_const_literals_to_create_immutables # - prefer_const_literals_to_create_immutables
# - prefer_constructors_over_static_methods # far too many false positives # - prefer_constructors_over_static_methods # far too many false positives
- prefer_contains - prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes # - prefer_double_quotes # opposite of prefer_single_quotes
@ -154,33 +169,38 @@ linter:
- prefer_final_fields - prefer_final_fields
- prefer_final_in_for_each - prefer_final_in_for_each
- prefer_final_locals - 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_for_elements_to_map_fromIterable
- prefer_foreach - prefer_foreach
# - prefer_function_declarations_over_variables # not yet tested - prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases - prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions - prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators - prefer_if_null_operators
- prefer_initializing_formals - prefer_initializing_formals
- prefer_inlined_adds - prefer_inlined_adds
# - prefer_int_literals # not yet tested # - 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 # not yet tested - prefer_interpolation_to_compose_strings
- prefer_is_empty - prefer_is_empty
- prefer_is_not_empty - prefer_is_not_empty
- prefer_is_not_operator - prefer_is_not_operator
- prefer_iterable_whereType - prefer_iterable_whereType
# - prefer_mixin # https://github.com/dart-lang/language/issues/32 # - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
# - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932 # - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
# - prefer_relative_imports # not yet tested - prefer_null_aware_operators
# - prefer_relative_imports
- prefer_single_quotes - prefer_single_quotes
- prefer_spread_collections - prefer_spread_collections
- prefer_typing_uninitialized_variables - prefer_typing_uninitialized_variables
- prefer_void_to_null - prefer_void_to_null
# - provide_deprecation_message # not yet tested - provide_deprecation_message
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
- recursive_getters - recursive_getters
# - sized_box_for_whitespace # not yet tested # - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
- secure_pubspec_urls
- sized_box_for_whitespace
# - sized_box_shrink_expand # not yet tested
- slash_for_doc_comments - slash_for_doc_comments
# - sort_child_properties_last # not yet tested - sort_child_properties_last
- sort_constructors_first - sort_constructors_first
# - sort_pub_dependencies # prevents separating pinned transitive dependencies # - sort_pub_dependencies # prevents separating pinned transitive dependencies
- sort_unnamed_constructors_first - sort_unnamed_constructors_first
@ -189,36 +209,43 @@ linter:
- tighten_type_of_initializing_formals - tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types # - type_annotate_public_apis # subset of always_specify_types
- type_init_formals - type_init_formals
- unawaited_futures # too many false positives # - unawaited_futures # too many false positives, especially with the way AnimationController works
# - unnecessary_await_in_return # not yet tested - unnecessary_await_in_return
- unnecessary_brace_in_string_interps - unnecessary_brace_in_string_interps
- unnecessary_const - unnecessary_const
- unnecessary_constructor_name
# - unnecessary_final # conflicts with prefer_final_locals # - unnecessary_final # conflicts with prefer_final_locals
- unnecessary_getters_setters - unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_late
- unnecessary_new - unnecessary_new
- unnecessary_null_aware_assignments - unnecessary_null_aware_assignments
# - unnecessary_null_checks # not yet tested - unnecessary_null_checks
- unnecessary_null_in_if_null_operators - unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations - unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides - unnecessary_overrides
- unnecessary_parenthesis - unnecessary_parenthesis
# - unnecessary_raw_strings # not yet tested # - unnecessary_raw_strings # what's "necessary" is a matter of opinion; consistency across strings can help readability more than this lint
- unnecessary_statements - unnecessary_statements
- unnecessary_string_escapes - unnecessary_string_escapes
- unnecessary_string_interpolations - unnecessary_string_interpolations
- unnecessary_this - unnecessary_this
- unrelated_type_equality_checks - unrelated_type_equality_checks
# - unsafe_html # not yet tested - unsafe_html
- use_build_context_synchronously
# - use_decorated_box # not yet tested
- use_full_hex_values_for_flutter_colors - use_full_hex_values_for_flutter_colors
# - use_function_type_syntax_for_parameters # not yet tested - use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo - use_is_even_rather_than_modulo
# - use_key_in_widget_constructors # not yet tested - use_key_in_widget_constructors
- use_late_for_private_fields_and_variables - use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings - use_raw_strings
- use_rethrow_when_possible - use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested - use_setters_to_change_properties
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
- use_test_throws_matchers
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- valid_regexps - valid_regexps
- void_checks - void_checks

1
android/.gitignore vendored
View File

@ -6,3 +6,4 @@
.DS_Store .DS_Store
/build /build
/captures /captures
.cxx

View File

@ -1,5 +1,5 @@
group 'io.github.v7lin.weibo_kit' group 'io.github.v7lin.weibo_kit'
version '3.1.0' version '4.0.0'
buildscript { buildscript {
repositories { repositories {
@ -8,7 +8,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.0' classpath 'com.android.tools.build:gradle:7.1.2'
} }
} }
@ -24,6 +24,11 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion 31 compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
@ -31,10 +36,6 @@ android {
consumerProguardFiles 'consumer-rules.pro' consumerProguardFiles 'consumer-rules.pro'
} }
lintOptions {
disable 'InvalidPackage'
}
flavorDimensions 'vendor' flavorDimensions 'vendor'
productFlavors { productFlavors {

View File

@ -1,4 +0,0 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

View File

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

View File

@ -9,6 +9,7 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.sina.weibo.sdk.api.ImageObject; import com.sina.weibo.sdk.api.ImageObject;
import com.sina.weibo.sdk.api.MultiImageObject; import com.sina.weibo.sdk.api.MultiImageObject;
@ -43,7 +44,6 @@ import io.flutter.plugin.common.PluginRegistry;
* WeiboKitPlugin * WeiboKitPlugin
*/ */
public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegistry.ActivityResultListener, MethodCallHandler { public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegistry.ActivityResultListener, MethodCallHandler {
private static class WeiboErrorCode { private static class WeiboErrorCode {
public static final int SUCCESS = 0;// public static final int SUCCESS = 0;//
public static final int USERCANCEL = -1;// public static final int USERCANCEL = -1;//
@ -56,34 +56,6 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
public static final int UNKNOWN = -100; public static final int UNKNOWN = -100;
} }
private static final String METHOD_REGISTERAPP = "registerApp";
private static final String METHOD_ISINSTALLED = "isInstalled";
private static final String METHOD_AUTH = "auth";
private static final String METHOD_SHARETEXT = "shareText";
private static final String METHOD_SHAREIMAGE = "shareImage";
private static final String METHOD_SHAREWEBPAGE = "shareWebpage";
private static final String METHOD_ONAUTHRESP = "onAuthResp";
private static final String METHOD_ONSHAREMSGRESP = "onShareMsgResp";
private static final String ARGUMENT_KEY_APPKEY = "appKey";
private static final String ARGUMENT_KEY_SCOPE = "scope";
private static final String ARGUMENT_KEY_REDIRECTURL = "redirectUrl";
private static final String ARGUMENT_KEY_TEXT = "text";
private static final String ARGUMENT_KEY_TITLE = "title";
private static final String ARGUMENT_KEY_DESCRIPTION = "description";
private static final String ARGUMENT_KEY_THUMBDATA = "thumbData";
private static final String ARGUMENT_KEY_IMAGEDATA = "imageData";
private static final String ARGUMENT_KEY_IMAGEURI = "imageUri";
private static final String ARGUMENT_KEY_WEBPAGEURL = "webpageUrl";
private static final String ARGUMENT_KEY_RESULT_ERRORCODE = "errorCode";
private static final String ARGUMENT_KEY_RESULT_ERRORMESSAGE = "errorMessage";
private static final String ARGUMENT_KEY_RESULT_USERID = "userId";
private static final String ARGUMENT_KEY_RESULT_ACCESSTOKEN = "accessToken";
private static final String ARGUMENT_KEY_RESULT_REFRESHTOKEN = "refreshToken";
private static final String ARGUMENT_KEY_RESULT_EXPIRESIN = "expiresIn";
/// The MethodChannel that will the communication between Flutter and native Android /// The MethodChannel that will the communication between Flutter and native Android
/// ///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it /// This local reference serves to register the plugin with the Flutter Engine and unregister it
@ -137,7 +109,7 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
// --- ActivityResultListener // --- ActivityResultListener
@Override @Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { public boolean onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
switch (requestCode) { switch (requestCode) {
case 32973: case 32973:
if (iwbapi != null) { if (iwbapi != null) {
@ -149,28 +121,28 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
iwbapi.doResultIntent(data, new WbShareCallback() { iwbapi.doResultIntent(data, new WbShareCallback() {
@Override @Override
public void onComplete() { public void onComplete() {
Map<String, Object> map = new HashMap<>(); final Map<String, Object> map = new HashMap<>();
map.put(ARGUMENT_KEY_RESULT_ERRORCODE, WeiboErrorCode.SUCCESS); map.put("errorCode", WeiboErrorCode.SUCCESS);
if (channel != null) { if (channel != null) {
channel.invokeMethod(METHOD_ONSHAREMSGRESP, map); channel.invokeMethod("onShareMsgResp", map);
} }
} }
@Override @Override
public void onError(UiError uiError) { public void onError(UiError uiError) {
Map<String, Object> map = new HashMap<>(); final Map<String, Object> map = new HashMap<>();
map.put(ARGUMENT_KEY_RESULT_ERRORCODE, WeiboErrorCode.SHARE_IN_SDK_FAILED); map.put("errorCode", WeiboErrorCode.SHARE_IN_SDK_FAILED);
if (channel != null) { if (channel != null) {
channel.invokeMethod(METHOD_ONSHAREMSGRESP, map); channel.invokeMethod("onShareMsgResp", map);
} }
} }
@Override @Override
public void onCancel() { public void onCancel() {
Map<String, Object> map = new HashMap<>(); final Map<String, Object> map = new HashMap<>();
map.put(ARGUMENT_KEY_RESULT_ERRORCODE, WeiboErrorCode.USERCANCEL); map.put("errorCode", WeiboErrorCode.USERCANCEL);
if (channel != null) { if (channel != null) {
channel.invokeMethod(METHOD_ONSHAREMSGRESP, map); channel.invokeMethod("onShareMsgResp", map);
} }
} }
}); });
@ -184,21 +156,21 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
@Override @Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (METHOD_REGISTERAPP.equals(call.method)) { if ("registerApp".equals(call.method)) {
final String appKey = call.argument(ARGUMENT_KEY_APPKEY); final String appKey = call.argument("appKey");
final String scope = call.argument(ARGUMENT_KEY_SCOPE); final String scope = call.argument("scope");
final String redirectUrl = call.argument(ARGUMENT_KEY_REDIRECTURL); final String redirectUrl = call.argument("redirectUrl");
iwbapi = WBAPIFactory.createWBAPI(activityPluginBinding.getActivity()); iwbapi = WBAPIFactory.createWBAPI(activityPluginBinding.getActivity());
iwbapi.registerApp(applicationContext, new AuthInfo(applicationContext, appKey, redirectUrl, scope)); iwbapi.registerApp(applicationContext, new AuthInfo(applicationContext, appKey, redirectUrl, scope));
result.success(null); result.success(null);
} else if (METHOD_ISINSTALLED.equals(call.method)) { } else if ("isInstalled".equals(call.method)) {
result.success(iwbapi.isWBAppInstalled()); result.success(iwbapi.isWBAppInstalled());
} else if (METHOD_AUTH.equals(call.method)) { } else if ("auth".equals(call.method)) {
handleAuthCall(call, result); handleAuthCall(call, result);
} else if (METHOD_SHARETEXT.equals(call.method)) { } else if ("shareText".equals(call.method)) {
handleShareTextCall(call, result); handleShareTextCall(call, result);
} else if (METHOD_SHAREIMAGE.equals(call.method) || } else if ("shareImage".equals(call.method) ||
METHOD_SHAREWEBPAGE.equals(call.method)) { "shareWebpage".equals(call.method)) {
handleShareMediaCall(call, result); handleShareMediaCall(call, result);
} else { } else {
result.notImplemented(); result.notImplemented();
@ -212,35 +184,35 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
public void onComplete(Oauth2AccessToken token) { public void onComplete(Oauth2AccessToken token) {
final Map<String, Object> map = new HashMap<>(); final Map<String, Object> map = new HashMap<>();
if (token.isSessionValid()) { if (token.isSessionValid()) {
map.put(ARGUMENT_KEY_RESULT_ERRORCODE, WeiboErrorCode.SUCCESS); map.put("errorCode", WeiboErrorCode.SUCCESS);
map.put(ARGUMENT_KEY_RESULT_USERID, token.getUid()); map.put("userId", token.getUid());
map.put(ARGUMENT_KEY_RESULT_ACCESSTOKEN, token.getAccessToken()); map.put("accessToken", token.getAccessToken());
map.put(ARGUMENT_KEY_RESULT_REFRESHTOKEN, token.getRefreshToken()); map.put("refreshToken", token.getRefreshToken());
final long expiresIn = (long) Math.ceil((token.getExpiresTime() - System.currentTimeMillis()) / 1000.0); final long expiresIn = (long) Math.ceil((token.getExpiresTime() - System.currentTimeMillis()) / 1000.0);
map.put(ARGUMENT_KEY_RESULT_EXPIRESIN, expiresIn);// map.put("expiresIn", expiresIn);//
} else { } else {
map.put(ARGUMENT_KEY_RESULT_ERRORCODE, WeiboErrorCode.UNKNOWN); map.put("errorCode", WeiboErrorCode.UNKNOWN);
} }
if (channel != null) { if (channel != null) {
channel.invokeMethod(METHOD_ONAUTHRESP, map); channel.invokeMethod("onAuthResp", map);
} }
} }
@Override @Override
public void onError(UiError uiError) { public void onError(UiError uiError) {
final Map<String, Object> map = new HashMap<>(); final Map<String, Object> map = new HashMap<>();
map.put(ARGUMENT_KEY_RESULT_ERRORCODE, WeiboErrorCode.UNKNOWN); map.put("errorCode", WeiboErrorCode.UNKNOWN);
if (channel != null) { if (channel != null) {
channel.invokeMethod(METHOD_ONAUTHRESP, map); channel.invokeMethod("onAuthResp", map);
} }
} }
@Override @Override
public void onCancel() { public void onCancel() {
final Map<String, Object> map = new HashMap<>(); final Map<String, Object> map = new HashMap<>();
map.put(ARGUMENT_KEY_RESULT_ERRORCODE, WeiboErrorCode.USERCANCEL); map.put("errorCode", WeiboErrorCode.USERCANCEL);
if (channel != null) { if (channel != null) {
channel.invokeMethod(METHOD_ONAUTHRESP, map); channel.invokeMethod("onAuthResp", map);
} }
} }
}); });
@ -252,7 +224,7 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
final WeiboMultiMessage message = new WeiboMultiMessage(); final WeiboMultiMessage message = new WeiboMultiMessage();
final TextObject object = new TextObject(); final TextObject object = new TextObject();
object.text = call.argument(ARGUMENT_KEY_TEXT);// 1024 object.text = call.argument("text");// 1024
message.textObject = object; message.textObject = object;
@ -265,18 +237,18 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
private void handleShareMediaCall(@NonNull MethodCall call, @NonNull Result result) { private void handleShareMediaCall(@NonNull MethodCall call, @NonNull Result result) {
final WeiboMultiMessage message = new WeiboMultiMessage(); final WeiboMultiMessage message = new WeiboMultiMessage();
if (METHOD_SHAREIMAGE.equals(call.method)) { if ("shareImage".equals(call.method)) {
if (call.hasArgument(ARGUMENT_KEY_TEXT)) { if (call.hasArgument("text")) {
final TextObject object = new TextObject(); final TextObject object = new TextObject();
object.text = call.argument(ARGUMENT_KEY_TEXT);// 1024 object.text = call.argument("text");// 1024
message.textObject = object; message.textObject = object;
} }
if (iwbapi != null && iwbapi.isWBAppSupportMultipleImage() && call.hasArgument(ARGUMENT_KEY_IMAGEURI)) { if (iwbapi != null && iwbapi.isWBAppSupportMultipleImage() && call.hasArgument("imageUri")) {
final MultiImageObject object = new MultiImageObject(); final MultiImageObject object = new MultiImageObject();
String imageUri = call.argument(ARGUMENT_KEY_IMAGEURI); final String imageUri = call.argument("imageUri");
ArrayList<Uri> images = new ArrayList<>(); final ArrayList<Uri> images = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
try { try {
final ProviderInfo providerInfo = applicationContext.getPackageManager().getProviderInfo(new ComponentName(applicationContext, FileProvider.class), PackageManager.MATCH_DEFAULT_ONLY); final ProviderInfo providerInfo = applicationContext.getPackageManager().getProviderInfo(new ComponentName(applicationContext, FileProvider.class), PackageManager.MATCH_DEFAULT_ONLY);
@ -293,22 +265,22 @@ public class WeiboKitPlugin implements FlutterPlugin, ActivityAware, PluginRegis
message.mediaObject = object; message.mediaObject = object;
} else { } else {
final ImageObject object = new ImageObject(); final ImageObject object = new ImageObject();
if (call.hasArgument(ARGUMENT_KEY_IMAGEDATA)) { if (call.hasArgument("imageData")) {
object.imageData = call.argument(ARGUMENT_KEY_IMAGEDATA);// 2 * 1024 * 1024 object.imageData = call.argument("imageData");// 2 * 1024 * 1024
} else if (call.hasArgument(ARGUMENT_KEY_IMAGEURI)) { } else if (call.hasArgument("imageUri")) {
String imageUri = call.argument(ARGUMENT_KEY_IMAGEURI); final String imageUri = call.argument("imageUri");
object.imagePath = Uri.parse(imageUri).getPath();// 512 - 10 * 1024 * 1024 object.imagePath = Uri.parse(imageUri).getPath();// 512 - 10 * 1024 * 1024
} }
message.mediaObject = object; message.mediaObject = object;
} }
} else if (METHOD_SHAREWEBPAGE.equals(call.method)) { } else if ("shareWebpage".equals(call.method)) {
final WebpageObject object = new WebpageObject(); final WebpageObject object = new WebpageObject();
object.identify = UUID.randomUUID().toString(); object.identify = UUID.randomUUID().toString();
object.title = call.argument(ARGUMENT_KEY_TITLE);// 512 object.title = call.argument("title");// 512
object.description = call.argument(ARGUMENT_KEY_DESCRIPTION);// 1024 object.description = call.argument("description");// 1024
object.thumbData = call.argument(ARGUMENT_KEY_THUMBDATA);// 32 * 1024 object.thumbData = call.argument("thumbData");// 32 * 1024
object.defaultText = call.argument(ARGUMENT_KEY_DESCRIPTION); object.defaultText = call.argument("description");
object.actionUrl = call.argument(ARGUMENT_KEY_WEBPAGEURL);// 512 object.actionUrl = call.argument("webpageUrl");// 512
message.mediaObject = object; message.mediaObject = object;
} }

1
example/.gitignore vendored
View File

@ -8,6 +8,7 @@
.buildlog/ .buildlog/
.history .history
.svn/ .svn/
migrate_working_dir/
# IntelliJ related # IntelliJ related
*.iml *.iml

View File

@ -1,10 +0,0 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: b041144f833e05cf463b8887fa12efdec9493488
channel: stable
project_type: app

View File

@ -8,9 +8,9 @@ This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project: A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter, view our For help getting started with Flutter development, view the
[online documentation](https://flutter.dev/docs), which offers tutorials, [online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference. samples, guidance on mobile development, and a full API reference.

View File

@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore. # Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties key.properties
**/*.keystore
**/*.jks

View File

@ -27,14 +27,18 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
lintOptions { compileOptions {
disable 'InvalidPackage' sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
} }
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.github.v7lin.weibo_kit_example" applicationId "io.github.v7lin.weibo_kit_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.v7lin.weibo_kit_example"> package="io.github.v7lin.weibo_kit_example">
<!-- Flutter needs it to communicate with the running application <!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>

View File

@ -1,12 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.v7lin.weibo_kit_example"> package="io.github.v7lin.weibo_kit_example">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application <application
android:label="weibo_kit_example" android:label="weibo_kit_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Theme applied to the Android Window while the process is starting --> <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when <!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame --> the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item> <item name="android:windowBackground">@drawable/launch_background</item>
</style> </style>
<!-- Theme applied to the Android Window as soon as the process has started. <!-- Theme applied to the Android Window as soon as the process has started.
@ -12,7 +12,7 @@
running. running.
This Theme is only used starting with V2 of Flutter's Android embedding. --> This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item> <item name="android:windowBackground">?android:colorBackground</item>
</style> </style>
</resources> </resources>

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.v7lin.weibo_kit_example"> package="io.github.v7lin.weibo_kit_example">
<!-- Flutter needs it to communicate with the running application <!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>

View File

@ -6,7 +6,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.0' classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }

View File

@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

View File

@ -1,7 +1,3 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
include ':app' include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties") def localPropertiesFile = new File(rootProject.projectDir, "local.properties")

View File

@ -1,3 +1,4 @@
**/dgph
*.mode1v3 *.mode1v3
*.mode2v3 *.mode2v3
*.moved-aside *.moved-aside
@ -18,6 +19,7 @@ Flutter/App.framework
Flutter/Flutter.framework Flutter/Flutter.framework
Flutter/Flutter.podspec Flutter/Flutter.podspec
Flutter/Generated.xcconfig Flutter/Generated.xcconfig
Flutter/ephemeral/
Flutter/app.flx Flutter/app.flx
Flutter/app.zip Flutter/app.zip
Flutter/flutter_assets/ Flutter/flutter_assets/

View File

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>en</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>App</string> <string>App</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>

View File

@ -1,2 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -1,2 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig" #include "Generated.xcconfig"

View File

@ -3,22 +3,22 @@ PODS:
- FMDB (2.7.5): - FMDB (2.7.5):
- FMDB/standard (= 2.7.5) - FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5) - FMDB/standard (2.7.5)
- path_provider (0.0.1): - path_provider_ios (0.0.1):
- Flutter - Flutter
- sqflite (0.0.2): - sqflite (0.0.2):
- Flutter - Flutter
- FMDB (>= 2.7.5) - FMDB (>= 2.7.5)
- weibo_kit (3.1.0): - weibo_kit (4.0.0):
- Flutter - Flutter
- weibo_kit/vendor (= 3.1.0) - weibo_kit/vendor (= 4.0.0)
- weibo_kit/vendor (3.1.0): - weibo_kit/vendor (4.0.0):
- Flutter - Flutter
- Weibo_SDK (~> 3.3.0) - Weibo_SDK (~> 3.3.0)
- Weibo_SDK (3.3.0) - Weibo_SDK (3.3.0)
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- path_provider (from `.symlinks/plugins/path_provider/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- weibo_kit (from `.symlinks/plugins/weibo_kit/ios`) - weibo_kit (from `.symlinks/plugins/weibo_kit/ios`)
@ -30,8 +30,8 @@ SPEC REPOS:
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: Flutter :path: Flutter
path_provider: path_provider_ios:
:path: ".symlinks/plugins/path_provider/ios" :path: ".symlinks/plugins/path_provider_ios/ios"
sqflite: sqflite:
:path: ".symlinks/plugins/sqflite/ios" :path: ".symlinks/plugins/sqflite/ios"
weibo_kit: weibo_kit:
@ -40,9 +40,9 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
weibo_kit: 2b9acdf65bf6effde4231759e53e136db0c01380 weibo_kit: 8064857ffe649258a0e813d94e4690cf4ef4d948
Weibo_SDK: 7478846cccb43c4785ba76b214115fb7ec9dc0d4 Weibo_SDK: 7478846cccb43c4785ba76b214115fb7ec9dc0d4
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d

View File

@ -3,18 +3,18 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 51; objectVersion = 50;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3CDD46DAA37A5371B2A70EC2 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FF490F57C9D1EABC131B9426 /* libPods-Runner.a */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
9D6A641CC2AA3D1DAB1CA737 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D17CA4B716FF2615EC5592DD /* libPods-Runner.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
@ -31,13 +31,14 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
08F4E8DC6CED25389BD315E9 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
148E72EBAA782EE70454F3DD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
8C3451CC4D3C94BCDF014D4C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -46,9 +47,8 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C5C37EFD234544E62872E54A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; AD1CFD40D1E8023F905A8C4C /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
E0BD40F9BEC5B3B35E91E09D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; D17CA4B716FF2615EC5592DD /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
FF490F57C9D1EABC131B9426 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -56,21 +56,19 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
3CDD46DAA37A5371B2A70EC2 /* libPods-Runner.a in Frameworks */, 9D6A641CC2AA3D1DAB1CA737 /* libPods-Runner.a in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
6C41AA3581FC291CB33F9055 /* Pods */ = { 02EA110EDFCF98FC06871CF0 /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
E0BD40F9BEC5B3B35E91E09D /* Pods-Runner.debug.xcconfig */, D17CA4B716FF2615EC5592DD /* libPods-Runner.a */,
C5C37EFD234544E62872E54A /* Pods-Runner.release.xcconfig */,
8C3451CC4D3C94BCDF014D4C /* Pods-Runner.profile.xcconfig */,
); );
path = Pods; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
9740EEB11CF90186004384FC /* Flutter */ = { 9740EEB11CF90186004384FC /* Flutter */ = {
@ -90,8 +88,8 @@
9740EEB11CF90186004384FC /* Flutter */, 9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
6C41AA3581FC291CB33F9055 /* Pods */, D4D0DC52653A5DE40E2C9908 /* Pods */,
97EA60ED8F200E6F573A9890 /* Frameworks */, 02EA110EDFCF98FC06871CF0 /* Frameworks */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@ -127,12 +125,15 @@
name = "Supporting Files"; name = "Supporting Files";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
97EA60ED8F200E6F573A9890 /* Frameworks */ = { D4D0DC52653A5DE40E2C9908 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FF490F57C9D1EABC131B9426 /* libPods-Runner.a */, AD1CFD40D1E8023F905A8C4C /* Pods-Runner.debug.xcconfig */,
08F4E8DC6CED25389BD315E9 /* Pods-Runner.release.xcconfig */,
148E72EBAA782EE70454F3DD /* Pods-Runner.profile.xcconfig */,
); );
name = Frameworks; name = Pods;
path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
/* End PBXGroup section */ /* End PBXGroup section */
@ -142,14 +143,14 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = ( buildPhases = (
631D2F29201BBC63DC66AD43 /* [CP] Check Pods Manifest.lock */, AD4B13FBAB7E2A550C0DD869 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */, 9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */, 97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */, 97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
BEFF80007E7E4E2B2694658C /* [CP] Copy Pods Resources */, 64BE94D785EB23A0C92F017D /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
@ -221,7 +222,38 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
}; };
631D2F29201BBC63DC66AD43 /* [CP] Check Pods Manifest.lock */ = { 64BE94D785EB23A0C92F017D /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
AD4B13FBAB7E2A550C0DD869 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
@ -243,37 +275,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
BEFF80007E7E4E2B2694658C /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
@ -365,21 +366,13 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 78W43A3TE2;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = io.github.v7lin.weiboKitExample; PRODUCT_BUNDLE_IDENTIFIER = io.github.v7lin.weiboKitExample;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
@ -497,21 +490,13 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 78W43A3TE2;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = io.github.v7lin.weiboKitExample; PRODUCT_BUNDLE_IDENTIFIER = io.github.v7lin.weiboKitExample;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
@ -524,21 +509,13 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 78W43A3TE2;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = io.github.v7lin.weiboKitExample; PRODUCT_BUNDLE_IDENTIFIER = io.github.v7lin.weiboKitExample;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
@ -38,8 +36,8 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<AdditionalOptions> <Testables>
</AdditionalOptions> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
@ -61,8 +59,6 @@
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Profile" buildConfiguration = "Profile"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@ -4,6 +4,8 @@
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Weibo Kit</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@ -138,5 +140,7 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict> </dict>
</plist> </plist>

View File

@ -28,9 +28,9 @@ abstract class WeiboApiResp {
) )
class WeiboUserInfoResp extends WeiboApiResp { class WeiboUserInfoResp extends WeiboApiResp {
const WeiboUserInfoResp({ const WeiboUserInfoResp({
required int errorCode, required super.errorCode,
String? error, super.error,
String? request, super.request,
this.id, this.id,
this.idstr, this.idstr,
this.screenName, this.screenName,
@ -41,7 +41,7 @@ class WeiboUserInfoResp extends WeiboApiResp {
this.gender, this.gender,
this.avatarLarge, this.avatarLarge,
this.avatarHd, this.avatarHd,
}) : super(errorCode: errorCode, error: error, request: request); });
factory WeiboUserInfoResp.fromJson(Map<String, dynamic> json) => factory WeiboUserInfoResp.fromJson(Map<String, dynamic> json) =>
_$WeiboUserInfoRespFromJson(json); _$WeiboUserInfoRespFromJson(json);

View File

@ -2,12 +2,13 @@ import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:weibo_kit/weibo_kit.dart'; import 'package:weibo_kit_example/api/model/weibo_api_resp.dart';
import 'package:weibo_kit_example/model/weibo_api_resp.dart';
class WeiboApi {
const WeiboApi._();
extension ApiWeibo on Weibo {
/// ///
Future<WeiboUserInfoResp> getUserInfo({ static Future<WeiboUserInfoResp> getUserInfo({
required String appkey, required String appkey,
required String userId, required String userId,
required String accessToken, required String accessToken,
@ -31,7 +32,7 @@ extension ApiWeibo on Weibo {
}); });
} }
Uri _encodeUrl( static Uri _encodeUrl(
String baseUrl, String baseUrl,
String appkey, String appkey,
String accessToken, String accessToken,

View File

@ -1,13 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
// import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart';
// import 'package:image/image.dart' as image;
import 'package:weibo_kit/weibo_kit.dart'; import 'package:weibo_kit/weibo_kit.dart';
import 'package:weibo_kit_example/model/weibo_api_resp.dart'; import 'package:weibo_kit_example/api/model/weibo_api_resp.dart';
import 'package:weibo_kit_example/weibo.dart'; import 'package:weibo_kit_example/api/weibo_api.dart';
const String _WEIBO_APP_KEY = 'your weibo app key'; const String _WEIBO_APP_KEY = 'your weibo app key';
const String _WEIBO_UNIVERSAL_LINK = 'your weibo universal link'; const String _WEIBO_UNIVERSAL_LINK = 'your weibo universal link';
@ -16,16 +14,14 @@ const List<String> _WEIBO_SCOPE = <String>[
]; ];
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized();
Weibo.instance.registerApp(
appKey: _WEIBO_APP_KEY,
universalLink: _WEIBO_UNIVERSAL_LINK,
scope: _WEIBO_SCOPE,
);
runApp(MyApp()); runApp(MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({
super.key,
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
@ -35,6 +31,9 @@ class MyApp extends StatelessWidget {
} }
class Home extends StatefulWidget { class Home extends StatefulWidget {
const Home({
super.key,
});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _HomeState(); return _HomeState();
@ -73,12 +72,23 @@ class _HomeState extends State<Home> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Weibo Kit Demo'), title: Text('Weibo Kit Demo'),
), ),
body: ListView( body: ListView(
children: <Widget>[ children: <Widget>[
ListTile( ListTile(
title: const Text('环境检查'), title: Text('注册APP'),
onTap: () async {
await Weibo.instance.registerApp(
appKey: _WEIBO_APP_KEY,
universalLink: _WEIBO_UNIVERSAL_LINK,
scope: _WEIBO_SCOPE,
);
_showTips('注册APP', '注册成功');
},
),
ListTile(
title: Text('环境检查'),
onTap: () async { onTap: () async {
final String content = final String content =
'weibo: ${await Weibo.instance.isInstalled()}'; 'weibo: ${await Weibo.instance.isInstalled()}';
@ -86,7 +96,7 @@ class _HomeState extends State<Home> {
}, },
), ),
ListTile( ListTile(
title: const Text('登录'), title: Text('登录'),
onTap: () { onTap: () {
Weibo.instance.auth( Weibo.instance.auth(
appKey: _WEIBO_APP_KEY, appKey: _WEIBO_APP_KEY,
@ -95,11 +105,11 @@ class _HomeState extends State<Home> {
}, },
), ),
ListTile( ListTile(
title: const Text('用户信息'), title: Text('用户信息'),
onTap: () async { onTap: () async {
if (_authResp?.isSuccessful ?? false) { if (_authResp?.isSuccessful ?? false) {
final WeiboUserInfoResp userInfoResp = final WeiboUserInfoResp userInfoResp =
await Weibo.instance.getUserInfo( await WeiboApi.getUserInfo(
appkey: _WEIBO_APP_KEY, appkey: _WEIBO_APP_KEY,
userId: _authResp!.userId!, userId: _authResp!.userId!,
accessToken: _authResp!.accessToken!, accessToken: _authResp!.accessToken!,
@ -115,7 +125,7 @@ class _HomeState extends State<Home> {
}, },
), ),
ListTile( ListTile(
title: const Text('文字分享'), title: Text('文字分享'),
onTap: () { onTap: () {
Weibo.instance.shareText( Weibo.instance.shareText(
text: 'Share Text', text: 'Share Text',
@ -123,7 +133,7 @@ class _HomeState extends State<Home> {
}, },
), ),
ListTile( ListTile(
title: const Text('图片分享'), title: Text('图片分享'),
onTap: () async { onTap: () async {
final File file = await DefaultCacheManager().getSingleFile( final File file = await DefaultCacheManager().getSingleFile(
'https://www.baidu.com/img/bd_logo1.png?where=super'); 'https://www.baidu.com/img/bd_logo1.png?where=super');
@ -134,7 +144,7 @@ class _HomeState extends State<Home> {
}, },
), ),
ListTile( ListTile(
title: const Text('网页分享'), title: Text('网页分享'),
onTap: () async { onTap: () async {
// final File file = await DefaultCacheManager().getSingleFile( // final File file = await DefaultCacheManager().getSingleFile(
// 'https://www.baidu.com/img/bd_logo1.png?where=super'); // 'https://www.baidu.com/img/bd_logo1.png?where=super');

View File

@ -1,34 +1,13 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.flutter-io.cn"
source: hosted
version: "22.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.2"
archive: archive:
dependency: transitive dependency: transitive
description: description:
name: archive name: archive
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.1.2" version: "3.3.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -43,62 +22,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
build:
dependency: transitive
description:
name: build
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.7"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.10"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.4"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.12.2"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.flutter-io.cn"
source: hosted
version: "6.1.12"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.1.0"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.flutter-io.cn"
source: hosted
version: "8.1.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -113,20 +36,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.3"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -134,76 +43,48 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.7.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.2"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.2" version: "1.0.4"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.14"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.3.0"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
name: ffi name: ffi
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.2.1"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.1.0" version: "6.1.2"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -216,88 +97,53 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.3.0" version: "3.3.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
http: http:
dependency: transitive dependency: transitive
description: description:
name: http name: http
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.13.0" version: "0.13.4"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0" version: "4.0.1"
image: image:
dependency: "direct main" dependency: "direct main"
description: description:
name: image name: image
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.1" version: "3.2.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.3"
json_annotation: json_annotation:
dependency: "direct main" dependency: "direct main"
description: description:
name: json_annotation name: json_annotation
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0" version: "4.5.0"
json_serializable: lints:
dependency: "direct dev"
description:
name: json_serializable
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.3"
logging:
dependency: transitive dependency: transitive
description: description:
name: logging name: lints
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.1" version: "2.0.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -311,7 +157,7 @@ packages:
name: material_color_utilities name: material_color_utilities
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.3" version: "0.1.4"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -319,76 +165,76 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.7.0" version: "1.7.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
path_provider: path_provider:
dependency: transitive dependency: transitive
description: description:
name: path_provider name: path_provider
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.10"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.14"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.9"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.1.6"
path_provider_macos: path_provider_macos:
dependency: transitive dependency: transitive
description: description:
name: path_provider_macos name: path_provider_macos
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.6"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.4"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.6"
pedantic: pedantic:
dependency: "direct dev" dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.11.0" version: "1.11.1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: petitparser
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.2" version: "5.0.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -402,89 +248,47 @@ packages:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.1.2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.0"
process: process:
dependency: transitive dependency: transitive
description: description:
name: process name: process
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.1.0" version: "4.2.4"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
rxdart: rxdart:
dependency: transitive dependency: transitive
description: description:
name: rxdart name: rxdart
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.26.0" version: "0.27.3"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.10+4"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
sqflite: sqflite:
dependency: transitive dependency: transitive
description: description:
name: sqflite name: sqflite
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0+3" version: "2.0.2+1"
sqflite_common: sqflite_common:
dependency: transitive dependency: transitive
description: description:
name: sqflite_common name: sqflite_common
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0+2" version: "2.2.1+1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -499,13 +303,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@ -519,7 +316,7 @@ packages:
name: synchronized name: synchronized
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.0+2"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -533,84 +330,56 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.4.8" version: "0.4.9"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
uuid: uuid:
dependency: transitive dependency: transitive
description: description:
name: uuid name: uuid
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.1" version: "3.0.6"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
weibo_kit: weibo_kit:
dependency: "direct main" dependency: "direct main"
description: description:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "3.1.0" version: "4.0.0"
win32: win32:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.4" version: "2.6.1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.0" version: "0.2.0+1"
xml: xml:
dependency: transitive dependency: transitive
description: description:
name: xml name: xml
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.2" version: "6.0.1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0"
sdks: sdks:
dart: ">=2.14.0 <3.0.0" dart: ">=2.17.0 <3.0.0"
flutter: ">=1.24.0-10" flutter: ">=2.8.1"

View File

@ -2,14 +2,20 @@ name: weibo_kit_example
description: Demonstrates how to use the weibo_kit plugin. description: Demonstrates how to use the weibo_kit plugin.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages. # 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 publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
sdk: ">=2.12.0 <3.0.0"
version: 1.0.0+100 version: 1.0.0+100
environment:
sdk: ">=2.17.0 <3.0.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: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
@ -29,13 +35,18 @@ dependencies:
image: ^3.0.1 image: ^3.0.1
flutter_cache_manager: ^3.0.0 flutter_cache_manager: ^3.0.0
json_annotation: ^4.0.0 json_annotation: ^4.5.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pedantic: # 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: build_runner:
json_serializable: json_serializable:
@ -43,7 +54,7 @@ dev_dependencies:
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter. # The following section is specific to Flutter packages.
flutter: flutter:
# The following line ensures that the Material Icons font is # The following line ensures that the Material Icons font is
@ -57,7 +68,7 @@ flutter:
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see # For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages # https://flutter.dev/assets-and-images/#from-packages

View File

@ -1,8 +1,12 @@
// This is a basic Flutter widget test. // This is a basic Flutter widget test.
// //
// To perform an interaction with a widget in your test, use the WidgetTester // To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll // utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget // gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct. // tree, read text, and verify that the values of widget properties are correct.
void main() {} import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('smoke test', (WidgetTester tester) async {});
}

1
ios/.gitignore vendored
View File

@ -34,4 +34,5 @@ Icon?
.tags* .tags*
/Flutter/Generated.xcconfig /Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh /Flutter/flutter_export_environment.sh

View File

@ -10,43 +10,14 @@
} }
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FlutterMethodChannel *channel = FlutterMethodChannel *channel = [FlutterMethodChannel
[FlutterMethodChannel methodChannelWithName:@"v7lin.github.io/weibo_kit" methodChannelWithName:@"v7lin.github.io/weibo_kit"
binaryMessenger:[registrar messenger]]; binaryMessenger:[registrar messenger]];
WeiboKitPlugin *instance = [[WeiboKitPlugin alloc] initWithChannel:channel]; WeiboKitPlugin *instance = [[WeiboKitPlugin alloc] initWithChannel:channel];
[registrar addApplicationDelegate:instance]; [registrar addApplicationDelegate:instance];
[registrar addMethodCallDelegate:instance channel:channel]; [registrar addMethodCallDelegate:instance channel:channel];
} }
static NSString *const METHOD_REGISTERAPP = @"registerApp";
static NSString *const METHOD_ISINSTALLED = @"isInstalled";
static NSString *const METHOD_AUTH = @"auth";
static NSString *const METHOD_SHARETEXT = @"shareText";
static NSString *const METHOD_SHAREIMAGE = @"shareImage";
static NSString *const METHOD_SHAREWEBPAGE = @"shareWebpage";
static NSString *const METHOD_ONAUTHRESP = @"onAuthResp";
static NSString *const METHOD_ONSHAREMSGRESP = @"onShareMsgResp";
static NSString *const ARGUMENT_KEY_APPKEY = @"appKey";
static NSString *const ARGUMENT_KEY_UNIVERSALLINK = @"universalLink";
static NSString *const ARGUMENT_KEY_SCOPE = @"scope";
static NSString *const ARGUMENT_KEY_REDIRECTURL = @"redirectUrl";
static NSString *const ARGUMENT_KEY_TEXT = @"text";
static NSString *const ARGUMENT_KEY_TITLE = @"title";
static NSString *const ARGUMENT_KEY_DESCRIPTION = @"description";
static NSString *const ARGUMENT_KEY_THUMBDATA = @"thumbData";
static NSString *const ARGUMENT_KEY_IMAGEDATA = @"imageData";
static NSString *const ARGUMENT_KEY_IMAGEURI = @"imageUri";
static NSString *const ARGUMENT_KEY_WEBPAGEURL = @"webpageUrl";
static NSString *const ARGUMENT_KEY_RESULT_ERRORCODE = @"errorCode";
static NSString *const ARGUMENT_KEY_RESULT_ERRORMESSAGE = @"errorMessage";
static NSString *const ARGUMENT_KEY_RESULT_USERID = @"userId";
static NSString *const ARGUMENT_KEY_RESULT_ACCESSTOKEN = @"accessToken";
static NSString *const ARGUMENT_KEY_RESULT_REFRESHTOKEN = @"refreshToken";
static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
- (instancetype)initWithChannel:(FlutterMethodChannel *)channel { - (instancetype)initWithChannel:(FlutterMethodChannel *)channel {
self = [super init]; self = [super init];
if (self) { if (self) {
@ -57,19 +28,19 @@ static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
- (void)handleMethodCall:(FlutterMethodCall *)call - (void)handleMethodCall:(FlutterMethodCall *)call
result:(FlutterResult)result { result:(FlutterResult)result {
if ([METHOD_REGISTERAPP isEqualToString:call.method]) { if ([@"registerApp" isEqualToString:call.method]) {
NSString *appKey = call.arguments[ARGUMENT_KEY_APPKEY]; NSString *appKey = call.arguments[@"appKey"];
NSString *universalLink = call.arguments[ARGUMENT_KEY_UNIVERSALLINK]; NSString *universalLink = call.arguments[@"universalLink"];
[WeiboSDK registerApp:appKey universalLink:universalLink]; [WeiboSDK registerApp:appKey universalLink:universalLink];
result(nil); result(nil);
} else if ([METHOD_ISINSTALLED isEqualToString:call.method]) { } else if ([@"isInstalled" isEqualToString:call.method]) {
result([NSNumber numberWithBool:[WeiboSDK isWeiboAppInstalled]]); result([NSNumber numberWithBool:[WeiboSDK isWeiboAppInstalled]]);
} else if ([METHOD_AUTH isEqualToString:call.method]) { } else if ([@"auth" isEqualToString:call.method]) {
[self handleAuthCall:call result:result]; [self handleAuthCall:call result:result];
} else if ([METHOD_SHARETEXT isEqualToString:call.method]) { } else if ([@"shareText" isEqualToString:call.method]) {
[self handleShareTextCall:call result:result]; [self handleShareTextCall:call result:result];
} else if ([METHOD_SHAREIMAGE isEqualToString:call.method] || } else if ([@"shareImage" isEqualToString:call.method] ||
[METHOD_SHAREWEBPAGE isEqualToString:call.method]) { [@"shareWebpage" isEqualToString:call.method]) {
[self handleShareMediaCall:call result:result]; [self handleShareMediaCall:call result:result];
} else { } else {
result(FlutterMethodNotImplemented); result(FlutterMethodNotImplemented);
@ -78,11 +49,12 @@ static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
- (void)handleAuthCall:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)handleAuthCall:(FlutterMethodCall *)call result:(FlutterResult)result {
WBAuthorizeRequest *request = [WBAuthorizeRequest request]; WBAuthorizeRequest *request = [WBAuthorizeRequest request];
request.scope = call.arguments[ARGUMENT_KEY_SCOPE]; request.scope = call.arguments[@"scope"];
request.redirectURI = call.arguments[ARGUMENT_KEY_REDIRECTURL]; request.redirectURI = call.arguments[@"redirectUrl"];
request.shouldShowWebViewForAuthIfCannotSSO = YES; request.shouldShowWebViewForAuthIfCannotSSO = YES;
request.shouldOpenWeiboAppInstallPageIfNotInstalled = NO; request.shouldOpenWeiboAppInstallPageIfNotInstalled = NO;
[WeiboSDK sendRequest:request completion:^(BOOL success) { [WeiboSDK sendRequest:request
completion:^(BOOL success){
// do nothing // do nothing
}]; }];
result(nil); result(nil);
@ -91,9 +63,10 @@ static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
- (void)handleShareTextCall:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)handleShareTextCall:(FlutterMethodCall *)call result:(FlutterResult)result {
WBSendMessageToWeiboRequest *request = [WBSendMessageToWeiboRequest request]; WBSendMessageToWeiboRequest *request = [WBSendMessageToWeiboRequest request];
WBMessageObject *message = [WBMessageObject message]; WBMessageObject *message = [WBMessageObject message];
message.text = call.arguments[ARGUMENT_KEY_TEXT]; message.text = call.arguments[@"text"];
request.message = message; request.message = message;
[WeiboSDK sendRequest:request completion:^(BOOL success) { [WeiboSDK sendRequest:request
completion:^(BOOL success){
// do nothing // do nothing
}]; }];
result(nil); result(nil);
@ -102,32 +75,33 @@ static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
- (void)handleShareMediaCall:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)handleShareMediaCall:(FlutterMethodCall *)call result:(FlutterResult)result {
WBSendMessageToWeiboRequest *request = [WBSendMessageToWeiboRequest request]; WBSendMessageToWeiboRequest *request = [WBSendMessageToWeiboRequest request];
WBMessageObject *message = [WBMessageObject message]; WBMessageObject *message = [WBMessageObject message];
if ([METHOD_SHAREIMAGE isEqualToString:call.method]) { if ([@"shareImage" isEqualToString:call.method]) {
message.text = call.arguments[ARGUMENT_KEY_TEXT]; message.text = call.arguments[@"text"];
WBImageObject *object = [WBImageObject object]; WBImageObject *object = [WBImageObject object];
FlutterStandardTypedData *imageData = call.arguments[ARGUMENT_KEY_IMAGEDATA]; FlutterStandardTypedData *imageData = call.arguments[@"imageData"];
if (imageData != nil) { if (imageData != nil) {
object.imageData = imageData.data; object.imageData = imageData.data;
} else { } else {
NSString *imageUri = call.arguments[ARGUMENT_KEY_IMAGEURI]; NSString *imageUri = call.arguments[@"imageUri"];
NSURL *imageUrl = [NSURL URLWithString:imageUri]; NSURL *imageUrl = [NSURL URLWithString:imageUri];
object.imageData = [NSData dataWithContentsOfFile:imageUrl.path]; object.imageData = [NSData dataWithContentsOfFile:imageUrl.path];
} }
message.imageObject = object; message.imageObject = object;
} else if ([METHOD_SHAREWEBPAGE isEqualToString:call.method]) { } else if ([@"shareWebpage" isEqualToString:call.method]) {
WBWebpageObject *object = [WBWebpageObject object]; WBWebpageObject *object = [WBWebpageObject object];
object.objectID = [[NSUUID UUID].UUIDString stringByReplacingOccurrencesOfString:@"-" withString:@""]; object.objectID = [[NSUUID UUID].UUIDString stringByReplacingOccurrencesOfString:@"-" withString:@""];
object.title = call.arguments[ARGUMENT_KEY_TITLE]; object.title = call.arguments[@"title"];
object.description = call.arguments[ARGUMENT_KEY_DESCRIPTION]; object.description = call.arguments[@"description"];
FlutterStandardTypedData *thumbData = call.arguments[ARGUMENT_KEY_THUMBDATA]; FlutterStandardTypedData *thumbData = call.arguments[@"thumbData"];
if (thumbData != nil) { if (thumbData != nil) {
object.thumbnailData = thumbData.data; object.thumbnailData = thumbData.data;
} }
object.webpageUrl = call.arguments[ARGUMENT_KEY_WEBPAGEURL]; object.webpageUrl = call.arguments[@"webpageUrl"];
message.mediaObject = object; message.mediaObject = object;
} }
request.message = message; request.message = message;
[WeiboSDK sendRequest:request completion:^(BOOL success) { [WeiboSDK sendRequest:request
completion:^(BOOL success){
// do nothing // do nothing
}]; }];
result(nil); result(nil);
@ -148,7 +122,8 @@ static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
} }
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *_Nonnull))restorationHandler { - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *_Nonnull))restorationHandler {
return [WeiboSDK handleOpenUniversalLink:userActivity delegate:self];; return [WeiboSDK handleOpenUniversalLink:userActivity delegate:self];
;
} }
#pragma mark - WeiboSDKDelegate #pragma mark - WeiboSDKDelegate
@ -158,7 +133,7 @@ static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
- (void)didReceiveWeiboResponse:(WBBaseResponse *)response { - (void)didReceiveWeiboResponse:(WBBaseResponse *)response {
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setValue:[NSNumber numberWithInteger:response.statusCode] forKey:ARGUMENT_KEY_RESULT_ERRORCODE]; [dictionary setValue:[NSNumber numberWithInteger:response.statusCode] forKey:@"errorCode"];
if ([response isKindOfClass:[WBAuthorizeResponse class]]) { if ([response isKindOfClass:[WBAuthorizeResponse class]]) {
if (response.statusCode == WeiboSDKResponseStatusCodeSuccess) { if (response.statusCode == WeiboSDKResponseStatusCodeSuccess) {
WBAuthorizeResponse *authorizeResponse = (WBAuthorizeResponse *)response; WBAuthorizeResponse *authorizeResponse = (WBAuthorizeResponse *)response;
@ -166,17 +141,17 @@ static NSString *const ARGUMENT_KEY_RESULT_EXPIRESIN = @"expiresIn";
NSString *accessToken = authorizeResponse.accessToken; NSString *accessToken = authorizeResponse.accessToken;
NSString *refreshToken = authorizeResponse.refreshToken; NSString *refreshToken = authorizeResponse.refreshToken;
long long expiresIn = ceil(authorizeResponse.expirationDate.timeIntervalSinceNow); // long long expiresIn = ceil(authorizeResponse.expirationDate.timeIntervalSinceNow); //
[dictionary setValue:userId forKey:ARGUMENT_KEY_RESULT_USERID]; [dictionary setValue:userId forKey:@"userId"];
[dictionary setValue:accessToken forKey:ARGUMENT_KEY_RESULT_ACCESSTOKEN]; [dictionary setValue:accessToken forKey:@"accessToken"];
[dictionary setValue:refreshToken forKey:ARGUMENT_KEY_RESULT_REFRESHTOKEN]; [dictionary setValue:refreshToken forKey:@"refreshToken"];
[dictionary setValue:[NSNumber numberWithLongLong:expiresIn] forKey:ARGUMENT_KEY_RESULT_EXPIRESIN]; [dictionary setValue:[NSNumber numberWithLongLong:expiresIn] forKey:@"expiresIn"];
} }
[_channel invokeMethod:METHOD_ONAUTHRESP arguments:dictionary]; [_channel invokeMethod:@"onAuthResp" arguments:dictionary];
} else if ([response isKindOfClass:[WBSendMessageToWeiboResponse class]]) { } else if ([response isKindOfClass:[WBSendMessageToWeiboResponse class]]) {
if (response.statusCode == WeiboSDKResponseStatusCodeSuccess) { if (response.statusCode == WeiboSDKResponseStatusCodeSuccess) {
WBSendMessageToWeiboResponse *sendMessageToWeiboResponse = (WBSendMessageToWeiboResponse *)response; WBSendMessageToWeiboResponse *sendMessageToWeiboResponse = (WBSendMessageToWeiboResponse *)response;
} }
[_channel invokeMethod:METHOD_ONSHAREMSGRESP arguments:dictionary]; [_channel invokeMethod:@"onShareMsgResp" arguments:dictionary];
} }
} }

View File

@ -1,10 +1,10 @@
# #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint weibo_kit.podspec' to validate before publishing. # Run `pod lib lint weibo_kit.podspec` to validate before publishing.
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'weibo_kit' s.name = 'weibo_kit'
s.version = '3.1.0' s.version = '4.0.0'
s.summary = 'A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.' s.summary = 'A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.'
s.description = <<-DESC s.description = <<-DESC
A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs. A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.

View File

@ -57,14 +57,14 @@ abstract class BaseResp {
explicitToJson: true, explicitToJson: true,
) )
class AuthResp extends BaseResp { class AuthResp extends BaseResp {
AuthResp({ const AuthResp({
required int errorCode, required super.errorCode,
String? errorMessage, super.errorMessage,
this.userId, this.userId,
this.accessToken, this.accessToken,
this.refreshToken, this.refreshToken,
this.expiresIn, this.expiresIn,
}) : super(errorCode: errorCode, errorMessage: errorMessage); });
factory AuthResp.fromJson(Map<String, dynamic> json) => factory AuthResp.fromJson(Map<String, dynamic> json) =>
_$AuthRespFromJson(json); _$AuthRespFromJson(json);
@ -83,9 +83,9 @@ class AuthResp extends BaseResp {
) )
class ShareMsgResp extends BaseResp { class ShareMsgResp extends BaseResp {
const ShareMsgResp({ const ShareMsgResp({
required int errorCode, required super.errorCode,
String? errorMessage, super.errorMessage,
}) : super(errorCode: errorCode, errorMessage: errorMessage); });
factory ShareMsgResp.fromJson(Map<String, dynamic> json) => factory ShareMsgResp.fromJson(Map<String, dynamic> json) =>
_$ShareMsgRespFromJson(json); _$ShareMsgRespFromJson(json);

View File

@ -1,163 +1,7 @@
import 'dart:async'; import 'package:weibo_kit/src/weibo_kit_platform_interface.dart';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/services.dart';
import 'package:weibo_kit/src/model/resp.dart';
class Weibo { class Weibo {
/// const Weibo._();
Weibo._();
static Weibo get instance => _instance; static WeiboKitPlatform get instance => WeiboKitPlatform.instance;
static final Weibo _instance = Weibo._();
static const String _METHOD_REGISTERAPP = 'registerApp';
static const String _METHOD_ISINSTALLED = 'isInstalled';
static const String _METHOD_AUTH = 'auth';
static const String _METHOD_SHARETEXT = 'shareText';
static const String _METHOD_SHAREIMAGE = 'shareImage';
static const String _METHOD_SHAREWEBPAGE = 'shareWebpage';
static const String _METHOD_ONAUTHRESP = 'onAuthResp';
static const String _METHOD_ONSHAREMSGRESP = 'onShareMsgResp';
static const String _ARGUMENT_KEY_APPKEY = 'appKey';
static const String _ARGUMENT_KEY_UNIVERSALLINK = 'universalLink';
static const String _ARGUMENT_KEY_SCOPE = 'scope';
static const String _ARGUMENT_KEY_REDIRECTURL = 'redirectUrl';
static const String _ARGUMENT_KEY_TEXT = 'text';
static const String _ARGUMENT_KEY_TITLE = 'title';
static const String _ARGUMENT_KEY_DESCRIPTION = 'description';
static const String _ARGUMENT_KEY_THUMBDATA = 'thumbData';
static const String _ARGUMENT_KEY_IMAGEDATA = 'imageData';
static const String _ARGUMENT_KEY_IMAGEURI = 'imageUri';
static const String _ARGUMENT_KEY_WEBPAGEURL = 'webpageUrl';
static const String _SCHEME_FILE = 'file';
static const String _DEFAULT_REDIRECTURL =
'https://api.weibo.com/oauth2/default.html';
late final MethodChannel _channel =
const MethodChannel('v7lin.github.io/weibo_kit')
..setMethodCallHandler(_handleMethod);
final StreamController<BaseResp> _respStreamController =
StreamController<BaseResp>.broadcast();
Future<void> registerApp({
required String appKey,
required String? universalLink,
required List<String> scope,
String redirectUrl =
_DEFAULT_REDIRECTURL, // -> -> -> -> OAuth2.0
}) {
assert(!Platform.isIOS || (universalLink?.isNotEmpty ?? false));
return _channel.invokeMethod<void>(
_METHOD_REGISTERAPP,
<String, dynamic>{
_ARGUMENT_KEY_APPKEY: appKey,
_ARGUMENT_KEY_UNIVERSALLINK: universalLink,
_ARGUMENT_KEY_SCOPE: scope.join(','),
_ARGUMENT_KEY_REDIRECTURL: redirectUrl,
},
);
}
Future<dynamic> _handleMethod(MethodCall call) async {
switch (call.method) {
case _METHOD_ONAUTHRESP:
_respStreamController.add(AuthResp.fromJson(
(call.arguments as Map<dynamic, dynamic>).cast<String, dynamic>()));
break;
case _METHOD_ONSHAREMSGRESP:
_respStreamController.add(ShareMsgResp.fromJson(
(call.arguments as Map<dynamic, dynamic>).cast<String, dynamic>()));
break;
}
}
///
Stream<BaseResp> respStream() {
return _respStreamController.stream;
}
Future<bool> isInstalled() async {
return await _channel.invokeMethod<bool>(_METHOD_ISINSTALLED) ?? false;
}
///
Future<void> auth({
required String appKey,
required List<String> scope,
String redirectUrl = _DEFAULT_REDIRECTURL,
}) {
return _channel.invokeMethod<void>(
_METHOD_AUTH,
<String, dynamic>{
_ARGUMENT_KEY_APPKEY: appKey,
_ARGUMENT_KEY_SCOPE: scope.join(','),
_ARGUMENT_KEY_REDIRECTURL: redirectUrl,
},
);
}
/// -
Future<void> shareText({
required String text,
}) {
return _channel.invokeMethod<void>(
_METHOD_SHARETEXT,
<String, dynamic>{
_ARGUMENT_KEY_TEXT: text,
},
);
}
/// -
Future<void> shareImage({
String? text,
Uint8List? imageData,
Uri? imageUri,
}) {
assert(text == null || text.length <= 1024);
assert((imageData != null && imageData.lengthInBytes <= 2 * 1024 * 1024) ||
(imageUri != null &&
imageUri.isScheme(_SCHEME_FILE) &&
imageUri.toFilePath().length <= 512 &&
File.fromUri(imageUri).lengthSync() <= 10 * 1024 * 1024));
return _channel.invokeMethod<void>(
_METHOD_SHAREIMAGE,
<String, dynamic>{
if (text != null && text.isNotEmpty) _ARGUMENT_KEY_TEXT: text,
if (imageData != null) _ARGUMENT_KEY_IMAGEDATA: imageData,
if (imageUri != null) _ARGUMENT_KEY_IMAGEURI: imageUri.toString(),
},
);
}
/// -
@Deprecated('iOS分享多媒体已经弃用 请不要用相关api')
Future<void> shareWebpage({
required String title,
required String description,
required Uint8List thumbData,
required String webpageUrl,
}) {
assert(title.length <= 512);
assert(description.isNotEmpty && description.length <= 1024);
assert(thumbData.lengthInBytes <= 32 * 1024);
assert(webpageUrl.length <= 255);
return _channel.invokeMethod<void>(
_METHOD_SHAREWEBPAGE,
<String, dynamic>{
_ARGUMENT_KEY_TITLE: title,
_ARGUMENT_KEY_DESCRIPTION: description,
_ARGUMENT_KEY_THUMBDATA: thumbData,
_ARGUMENT_KEY_WEBPAGEURL: webpageUrl,
},
);
}
} }

View File

@ -1,3 +1,10 @@
class WeiboRegister {
const WeiboRegister._();
static const String DEFAULT_REDIRECTURL =
'https://api.weibo.com/oauth2/default.html';
}
class WeiboScope { class WeiboScope {
const WeiboScope._(); const WeiboScope._();

View File

@ -0,0 +1,134 @@
import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:weibo_kit/src/model/resp.dart';
import 'package:weibo_kit/src/weibo_constant.dart';
import 'package:weibo_kit/src/weibo_kit_platform_interface.dart';
/// An implementation of [WeiboKitPlatform] that uses method channels.
class MethodChannelWeiboKit extends WeiboKitPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
late final MethodChannel methodChannel =
const MethodChannel('v7lin.github.io/weibo_kit')
..setMethodCallHandler(_handleMethod);
final StreamController<BaseResp> _respStreamController =
StreamController<BaseResp>.broadcast();
Future<dynamic> _handleMethod(MethodCall call) async {
switch (call.method) {
case 'onAuthResp':
_respStreamController.add(AuthResp.fromJson(
(call.arguments as Map<dynamic, dynamic>).cast<String, dynamic>()));
break;
case 'onShareMsgResp':
_respStreamController.add(ShareMsgResp.fromJson(
(call.arguments as Map<dynamic, dynamic>).cast<String, dynamic>()));
break;
}
}
@override
Future<void> registerApp({
required String appKey,
required String? universalLink,
required List<String> scope,
String redirectUrl = WeiboRegister.DEFAULT_REDIRECTURL,
}) {
assert(!Platform.isIOS || (universalLink?.isNotEmpty ?? false));
return methodChannel.invokeMethod<void>(
'registerApp',
<String, dynamic>{
'appKey': appKey,
'universalLink': universalLink,
'scope': scope.join(','),
'redirectUrl': redirectUrl,
},
);
}
@override
Stream<BaseResp> respStream() {
return _respStreamController.stream;
}
@override
Future<bool> isInstalled() async {
return await methodChannel.invokeMethod<bool>('isInstalled') ?? false;
}
@override
Future<void> auth({
required String appKey,
required List<String> scope,
String redirectUrl = WeiboRegister.DEFAULT_REDIRECTURL,
}) {
return methodChannel.invokeMethod<void>(
'auth',
<String, dynamic>{
'appKey': appKey,
'scope': scope.join(','),
'redirectUrl': redirectUrl,
},
);
}
@override
Future<void> shareText({
required String text,
}) {
return methodChannel.invokeMethod<void>(
'shareText',
<String, dynamic>{
'text': text,
},
);
}
@override
Future<void> shareImage({
String? text,
Uint8List? imageData,
Uri? imageUri,
}) {
assert(text == null || text.length <= 1024);
assert((imageData != null && imageData.lengthInBytes <= 2 * 1024 * 1024) ||
(imageUri != null &&
imageUri.isScheme('file') &&
imageUri.toFilePath().length <= 512 &&
File.fromUri(imageUri).lengthSync() <= 10 * 1024 * 1024));
return methodChannel.invokeMethod<void>(
'shareImage',
<String, dynamic>{
if (text != null && text.isNotEmpty) 'text': text,
if (imageData != null) 'imageData': imageData,
if (imageUri != null) 'imageUri': imageUri.toString(),
},
);
}
@override
Future<void> shareWebpage({
required String title,
required String description,
required Uint8List thumbData,
required String webpageUrl,
}) {
assert(title.length <= 512);
assert(description.isNotEmpty && description.length <= 1024);
assert(thumbData.lengthInBytes <= 32 * 1024);
assert(webpageUrl.length <= 255);
return methodChannel.invokeMethod<void>(
'shareWebpage',
<String, dynamic>{
'title': title,
'description': description,
'thumbData': thumbData,
'webpageUrl': webpageUrl,
},
);
}
}

View File

@ -0,0 +1,90 @@
import 'dart:typed_data';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'package:weibo_kit/src/model/resp.dart';
import 'package:weibo_kit/src/weibo_constant.dart';
import 'package:weibo_kit/src/weibo_kit_method_channel.dart';
abstract class WeiboKitPlatform extends PlatformInterface {
/// Constructs a WeiboKitPlatform.
WeiboKitPlatform() : super(token: _token);
static final Object _token = Object();
static WeiboKitPlatform _instance = MethodChannelWeiboKit();
/// The default instance of [WeiboKitPlatform] to use.
///
/// Defaults to [MethodChannelWeiboKit].
static WeiboKitPlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [WeiboKitPlatform] when
/// they register themselves.
static set instance(WeiboKitPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
///
Future<void> registerApp({
required String appKey,
required String? universalLink,
required List<String> scope,
String redirectUrl = WeiboRegister
.DEFAULT_REDIRECTURL, // -> -> -> -> OAuth2.0
}) {
throw UnimplementedError(
'registerApp({required appKey, required universalLink, required scope, redirectUrl}) has not been implemented.');
}
///
Stream<BaseResp> respStream() {
throw UnimplementedError('respStream() has not been implemented.');
}
///
Future<bool> isInstalled() {
throw UnimplementedError('isInstalled() has not been implemented.');
}
///
Future<void> auth({
required String appKey,
required List<String> scope,
String redirectUrl = WeiboRegister.DEFAULT_REDIRECTURL,
}) {
throw UnimplementedError(
'auth({required appKey, required scope, redirectUrl}) has not been implemented.');
}
/// -
Future<void> shareText({
required String text,
}) {
throw UnimplementedError(
'shareText({required text}) has not been implemented.');
}
/// -
Future<void> shareImage({
String? text,
Uint8List? imageData,
Uri? imageUri,
}) {
throw UnimplementedError(
'shareImage({text, imageData, imageUri}) has not been implemented.');
}
/// -
@Deprecated('iOS分享多媒体已经弃用 请不要用相关api')
Future<void> shareWebpage({
required String title,
required String description,
required Uint8List thumbData,
required String webpageUrl,
}) {
throw UnimplementedError(
'shareWebpage({required title, required description, required thumbData, required webpageUrl}) has not been implemented.');
}
}

View File

@ -0,0 +1,6 @@
library weibo_kit_platform_interface;
export 'src/model/resp.dart';
export 'src/weibo_constant.dart';
export 'src/weibo_kit_method_channel.dart';
export 'src/weibo_kit_platform_interface.dart';

View File

@ -7,21 +7,21 @@ packages:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "18.0.0" version: "40.0.0"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "4.1.0"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.3.1"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -42,56 +42,56 @@ packages:
name: build name: build
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.3.0"
build_config: build_config:
dependency: transitive dependency: transitive
description: description:
name: build_config name: build_config
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.4.7" version: "1.0.0"
build_daemon: build_daemon:
dependency: transitive dependency: transitive
description: description:
name: build_daemon name: build_daemon
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.10" version: "3.1.0"
build_resolvers: build_resolvers:
dependency: transitive dependency: transitive
description: description:
name: build_resolvers name: build_resolvers
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.8"
build_runner: build_runner:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: build_runner name: build_runner
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.12.2" version: "2.1.11"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
name: build_runner_core name: build_runner_core
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.1.12" version: "7.2.3"
built_collection: built_collection:
dependency: transitive dependency: transitive
description: description:
name: built_collection name: built_collection
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.0" version: "5.1.1"
built_value: built_value:
dependency: transitive dependency: transitive
description: description:
name: built_value name: built_value
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "8.0.3" version: "8.3.0"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -113,13 +113,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -133,87 +126,101 @@ packages:
name: code_builder name: code_builder
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.7.0" version: "4.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.15.0" version: "1.16.0"
convert: convert:
dependency: transitive dependency: transitive
description: description:
name: convert name: convert
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.0.2"
dart_style: dart_style:
dependency: transitive dependency: transitive
description: description:
name: dart_style name: dart_style
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.14" version: "2.2.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.2.0" version: "1.3.0"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "6.1.0" version: "6.1.2"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
name: fixnum name: fixnum
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
glob: glob:
dependency: transitive dependency: transitive
description: description:
name: glob name: glob
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.2"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
name: graphs name: graphs
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "2.1.0"
http_multi_server: http_multi_server:
dependency: transitive dependency: transitive
description: description:
name: http_multi_server name: http_multi_server
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.0.0" version: "3.2.0"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -227,35 +234,42 @@ packages:
name: io name: io
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.3"
js: js:
dependency: transitive dependency: transitive
description: description:
name: js name: js
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.6.3" version: "0.6.4"
json_annotation: json_annotation:
dependency: "direct main" dependency: "direct main"
description: description:
name: json_annotation name: json_annotation
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.0" version: "4.5.0"
json_serializable: json_serializable:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: json_serializable name: json_serializable
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "4.0.3" version: "6.2.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
logging: logging:
dependency: transitive dependency: transitive
description: description:
name: logging name: logging
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -263,6 +277,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.11" version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -276,28 +297,28 @@ packages:
name: mime name: mime
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.2"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
name: package_config name: package_config
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.0.2"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
pedantic: plugin_platform_interface:
dependency: "direct dev" dependency: "direct main"
description: description:
name: pedantic name: plugin_platform_interface
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.11.0" version: "2.1.2"
pool: pool:
dependency: transitive dependency: transitive
description: description:
@ -311,21 +332,21 @@ packages:
name: pub_semver name: pub_semver
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.1.1"
pubspec_parse: pubspec_parse:
dependency: transitive dependency: transitive
description: description:
name: pubspec_parse name: pubspec_parse
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.2.0"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
name: shelf name: shelf
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.3.0"
shelf_web_socket: shelf_web_socket:
dependency: transitive dependency: transitive
description: description:
@ -344,14 +365,21 @@ packages:
name: source_gen name: source_gen
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.9.10+4" version: "1.2.2"
source_helper:
dependency: transitive
description:
name: source_helper
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.2"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -393,7 +421,7 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.4.3" version: "0.4.9"
timing: timing:
dependency: transitive dependency: transitive
description: description:
@ -407,35 +435,35 @@ packages:
name: typed_data name: typed_data
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
name: watcher name: watcher
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
web_socket_channel: web_socket_channel:
dependency: transitive dependency: transitive
description: description:
name: web_socket_channel name: web_socket_channel
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0" version: "2.2.0"
yaml: yaml:
dependency: transitive dependency: transitive
description: description:
name: yaml name: yaml
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "3.1.0" version: "3.1.1"
sdks: sdks:
dart: ">=2.14.0 <3.0.0" dart: ">=2.17.0 <3.0.0"
flutter: ">=1.20.0" flutter: ">=2.5.0"

View File

@ -1,24 +1,24 @@
name: weibo_kit name: weibo_kit
description: A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs. description: A powerful Flutter plugin allowing developers to auth/share with natvie Android & iOS Weibo SDKs.
version: 3.1.0 version: 4.0.0
# author: v7lin <v7lin@qq.com> # author: v7lin <v7lin@qq.com>
homepage: https://github.com/rxreader/weibo_kit.git homepage: https://github.com/RxReader/weibo_kit.git
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.17.0 <3.0.0"
flutter: ">=1.20.0" flutter: ">=2.5.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
plugin_platform_interface: ^2.0.2
json_annotation: ^4.0.0 json_annotation: ^4.5.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^2.0.0
pedantic:
build_runner: build_runner:
json_serializable: json_serializable:
@ -26,11 +26,17 @@ dev_dependencies:
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter. # The following section is specific to Flutter packages.
flutter: flutter:
# This section identifies this Flutter project as a plugin project. # This section identifies this Flutter project as a plugin project.
# The 'pluginClass' and Android 'package' identifiers should not ordinarily # The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
# be modified. They are used by the tooling to maintain consistency when # 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. # adding or updating assets for this project.
plugin: plugin:
platforms: platforms:
@ -49,7 +55,7 @@ flutter:
# https://flutter.dev/assets-and-images/#from-packages # https://flutter.dev/assets-and-images/#from-packages
# #
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#resolution-aware
# To add custom fonts to your plugin package, add a fonts section here, # 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 # in this "flutter" section. Each entry in this list should have a

View File

@ -0,0 +1,27 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:weibo_kit/src/weibo_kit_method_channel.dart';
void main() {
final MethodChannelWeiboKit platform = MethodChannelWeiboKit();
const MethodChannel channel = MethodChannel('v7lin.github.io/weibo_kit');
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
switch (methodCall.method) {
case 'isInstalled':
return true;
}
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
});
test('isInstalled', () async {
expect(await platform.isInstalled(), true);
});
}

View File

@ -1,81 +1,83 @@
import 'dart:async'; import 'dart:typed_data';
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pedantic/pedantic.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'package:weibo_kit/weibo_kit.dart'; import 'package:weibo_kit/src/model/resp.dart';
import 'package:weibo_kit/src/weibo.dart';
import 'package:weibo_kit/src/weibo_constant.dart';
import 'package:weibo_kit/src/weibo_kit_method_channel.dart';
import 'package:weibo_kit/src/weibo_kit_platform_interface.dart';
class MockWeiboKitPlatform
with MockPlatformInterfaceMixin
implements WeiboKitPlatform {
@override
Future<void> registerApp({
required String appKey,
required String? universalLink,
required List<String> scope,
String redirectUrl = WeiboRegister.DEFAULT_REDIRECTURL,
}) {
throw UnimplementedError();
}
@override
Stream<BaseResp> respStream() {
throw UnimplementedError();
}
@override
Future<bool> isInstalled() {
throw UnimplementedError();
}
@override
Future<void> auth({
required String appKey,
required List<String> scope,
String redirectUrl = WeiboRegister.DEFAULT_REDIRECTURL,
}) {
throw UnimplementedError();
}
@override
Future<void> shareText({
required String text,
}) {
throw UnimplementedError();
}
@override
Future<void> shareImage({
String? text,
Uint8List? imageData,
Uri? imageUri,
}) {
throw UnimplementedError();
}
@override
Future<void> shareWebpage({
required String title,
required String description,
required Uint8List thumbData,
required String webpageUrl,
}) {
throw UnimplementedError();
}
}
void main() { void main() {
TestWidgetsFlutterBinding.ensureInitialized(); final WeiboKitPlatform initialPlatform = WeiboKitPlatform.instance;
const MethodChannel channel = MethodChannel('v7lin.github.io/weibo_kit'); test('$MethodChannelWeiboKit is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelWeiboKit>());
setUp(() {
channel.setMockMethodCallHandler((MethodCall call) async {
switch (call.method) {
case 'registerApp':
return null;
case 'isInstalled':
return true;
case 'auth':
unawaited(channel.binaryMessenger.handlePlatformMessage(
channel.name,
channel.codec.encodeMethodCall(
MethodCall('onAuthResp', json.decode('{"errorCode":-1}'))),
(ByteData? data) {
// mock success
},
));
return null;
case 'shareText':
case 'shareImage':
case 'shareWebpage':
unawaited(channel.binaryMessenger.handlePlatformMessage(
channel.name,
channel.codec.encodeMethodCall(
MethodCall('onShareMsgResp', json.decode('{"errorCode":-1}'))),
(ByteData? data) {
// mock success
},
));
return null;
}
throw PlatformException(code: '0', message: '想啥呢升级插件不想升级Mock');
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
}); });
test('isInstalled', () async { test('isInstalled', () async {
final MockWeiboKitPlatform fakePlatform = MockWeiboKitPlatform();
WeiboKitPlatform.instance = fakePlatform;
expect(await Weibo.instance.isInstalled(), true); expect(await Weibo.instance.isInstalled(), true);
}); });
test('auth', () async {
final StreamSubscription<BaseResp> subs =
Weibo.instance.respStream().listen((BaseResp resp) {
expect(resp.runtimeType, AuthResp);
expect(resp.errorCode, BaseResp.USERCANCEL);
});
await Weibo.instance.auth(
appKey: 'your weibo app key',
scope: <String>[WeiboScope.ALL],
);
await Future<void>.delayed(const Duration(seconds: 1));
await subs.cancel();
});
test('share', () async {
final StreamSubscription<BaseResp> sub =
Weibo.instance.respStream().listen((BaseResp resp) {
expect(resp.runtimeType, ShareMsgResp);
expect(resp.errorCode, BaseResp.USERCANCEL);
});
await Weibo.instance.shareText(
text: 'share text',
);
await sub.cancel();
});
} }