修正适配 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 ## 1.0.3 - 2019.12.05
* Android SDK * Android SDK

View File

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

View File

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

View File

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

View File

@ -93,7 +93,9 @@ static NSString *const SCHEME_FILE = @"file";
} }
result(nil); result(nil);
} else if ([METHOD_ISINSTALLED isEqualToString:call.method]) { } 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]) { } else if ([METHOD_LOGIN isEqualToString:call.method]) {
[self login:call result:result]; [self login:call result:result];
} else if ([METHOD_LOGOUT isEqualToString:call.method]) { } else if ([METHOD_LOGOUT isEqualToString:call.method]) {