修正适配 Android Q 本地分享 & TIM/QQLite

This commit is contained in:
v7lin
2019-12-16 11:14:23 +08:00
parent 87fe109f56
commit e1ecd003d4
5 changed files with 33 additions and 11 deletions

View File

@ -1,3 +1,7 @@
## 1.0.4 - 2019.12.16
* Android Q
## 1.0.3 - 2019.12.05
* Android SDK

View File

@ -47,6 +47,15 @@ android {
# Library Library apk
```
```
<!-- SDK里居然写死 android:authorities com.tencent.tauth.fileprovider android:authorities -->
<manifest>
<!-- targetSdkVersion >= 29, Android Q -->
<application android:requestLegacyExternalStorage="true">
</application>
</manifest>
```
## ios
```

View File

@ -33,8 +33,8 @@
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- Android Q -->
<!-- -->
<provider
<!-- SDK里居然写死 android:authorities com.tencent.tauth.fileprovider android:authorities -->
<!-- <provider
android:name=".content.TencentKitFileProvider"
android:authorities="com.tencent.tauth.fileprovider"
android:exported="false"
@ -43,6 +43,6 @@
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/tencent_kit_file_paths" />
</provider>
</provider> -->
</application>
</manifest>

View File

@ -114,14 +114,21 @@ public class TencentKitPlugin implements MethodCallHandler, PluginRegistry.Activ
tencent = Tencent.createInstance(appId, registrar.context().getApplicationContext());
result.success(null);
} else if (METHOD_ISINSTALLED.equals(call.method)) {
boolean isQQInstalled = false;
try {
final PackageManager packageManager = registrar.context().getPackageManager();
PackageInfo info = packageManager.getPackageInfo("com.tencent.mobileqq", 0);
isQQInstalled = info != null;
} catch (PackageManager.NameNotFoundException ignore) {
boolean isInstalled = false;
PackageManager packageManager = registrar.context().getPackageManager();
List<PackageInfo> infos = packageManager.getInstalledPackages(0);
if (infos != null && !infos.isEmpty()) {
for (PackageInfo info : infos) {
// 普通大众版 > 办公简洁版 > 急速轻聊版
if ("com.tencent.mobileqq".equals(info.packageName)
|| "com.tencent.tim".equals(info.packageName)
|| "com.tencent.qqlite".equals(info.packageName)) {
isInstalled = true;
break;
}
result.success(isQQInstalled);
}
}
result.success(isInstalled);
} else if (METHOD_LOGIN.equals(call.method)) {
login(call, result);
} else if (METHOD_LOGOUT.equals(call.method)) {

View File

@ -93,7 +93,9 @@ static NSString *const SCHEME_FILE = @"file";
}
result(nil);
} else if ([METHOD_ISINSTALLED isEqualToString:call.method]) {
result([NSNumber numberWithBool:[TencentOAuth iphoneQQInstalled]]);
// 普通大众版 > 办公简洁版
BOOL isInstalled = [TencentOAuth iphoneQQInstalled] || [TencentOAuth iphoneTIMInstalled];
result([NSNumber numberWithBool:isInstalled]);
} else if ([METHOD_LOGIN isEqualToString:call.method]) {
[self login:call result:result];
} else if ([METHOD_LOGOUT isEqualToString:call.method]) {