Skip to content

Commit

Permalink
升级 Android SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
droplet-js committed Jan 31, 2021
1 parent af4fb9c commit bd79219
Show file tree
Hide file tree
Showing 16 changed files with 130 additions and 349 deletions.
12 changes: 4 additions & 8 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'io.github.v7lin.tencent_kit'
version '1.1.2'
version '2.0.0'

buildscript {
repositories {
Expand All @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.4'
}
}

Expand All @@ -20,7 +20,6 @@ rootProject.allprojects {
}

apply plugin: 'com.android.library'
apply from: './quality.gradle'

android {
compileSdkVersion 28
Expand Down Expand Up @@ -51,9 +50,6 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.0.0'

// v3.3.9
vendorImplementation fileTree(include: ['*.jar'], dir: 'libs')
vendorImplementation 'androidx.legacy:legacy-support-v4:1.0.0'
//
vendorImplementation 'com.tencent.tauth:qqopensdk:3.52.0'
}
135 changes: 0 additions & 135 deletions android/checkstyle.xml

This file was deleted.

Binary file removed android/libs/open_sdk_r8353806_lite.jar
Binary file not shown.
17 changes: 0 additions & 17 deletions android/quality.gradle

This file was deleted.

1 change: 0 additions & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
package="io.github.v7lin.tencent_kit">

<application>
<!-- Android Q 的外部存储沙箱限制 -->
<provider
android:name=".content.TencentKitFileProvider"
android:authorities="${applicationId}.content.TencentKitFileProvider"
Expand Down
12 changes: 12 additions & 0 deletions android/src/main/java/io/github/v7lin/tencent_kit/TencentKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result
ProviderInfo providerInfo = applicationContext.getPackageManager().getProviderInfo(new ComponentName(applicationContext, TencentKitFileProvider.class), PackageManager.MATCH_DEFAULT_ONLY);
authority = providerInfo.authority;
} catch (PackageManager.NameNotFoundException e) {
// ignore
}
if (!TextUtils.isEmpty(authority)) {
tencent = Tencent.createInstance(appId, applicationContext, authority);
Expand Down Expand Up @@ -238,6 +239,10 @@ public void onCancel() {
channel.invokeMethod(METHOD_ONLOGINRESP, map);
}
}

@Override
public void onWarning(int code) {
}
};

private void logout(MethodCall call, MethodChannel.Result result) {
Expand Down Expand Up @@ -471,6 +476,13 @@ public void onCancel() {
channel.invokeMethod(METHOD_ONSHARERESP, map);
}
}

@Override
public void onWarning(int code) {
if (code == Constants.ERROR_NO_AUTHORITY) {
// 如果authorities为空,sdk会回调这个接口,提醒开发者适配FileProvider
}
}
};

// --- ActivityResultListener
Expand Down
12 changes: 9 additions & 3 deletions android/src/main/res/xml/tencent_kit_file_paths.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-files-path name="opensdk_external" path="Images/tmp"/>
<root-path name="opensdk_root" path=""/>
<!--suppress AndroidDomInspection -->
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<root-path name="root" path="" />
<files-path name="files" path="" />
<cache-path name="cache" path="" />
<external-path name="external" path="" />
<external-files-path name="external_files" path="" />
<external-cache-path name="external_cache" path="" />
<external-media-path name="external_media" path="" />
</paths>
9 changes: 9 additions & 0 deletions android/src/vendor/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />-->
<!--<uses-permission android:name="android.permission.WRITE_APN_SETTINGS"/>-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<queries>
<!-- targetSdkVersion>=30 -> Android 11 软件包可见性 -->
<package android:name="com.tencent.mobileqq" />
<package android:name="com.tencent.tim" />
<package android:name="com.tencent.qqlite" />
</queries>

<application
android:usesCleartextTraffic="true"
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:3.5.4'
}
}

Expand Down
74 changes: 14 additions & 60 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,75 +10,29 @@ project 'Runner', {
'Release' => :release,
}

def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end

target 'Runner' do
# Flutter Pod

copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

# Plugin Pods
flutter_ios_podfile_setup

# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
flutter_additional_ios_build_settings(target)
end
end
Loading

0 comments on commit bd79219

Please sign in to comment.