Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ohos/src/libs/QQOpenSdk.har
Binary file not shown.
12 changes: 9 additions & 3 deletions ohos/src/main/ets/components/plugin/TencentKitPlugin.ets
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class TencentKitPlugin implements FlutterPlugin, MethodCallHandle
}

onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void {
this.tencent?.handleAuthResult(want)
this.tencent?.handleResult(want)
}

authListener: ApiCallback<AuthResponse> = {
Expand All @@ -66,7 +66,7 @@ export default class TencentKitPlugin implements FlutterPlugin, MethodCallHandle
try {
if (response.ret == TencentRetCode.RET_SUCCESS) {
// 服务端模式时, access_token 设置为为 authCode, 当前 SDK 不支持客户端模式(因此 null)
const accessToken: string | null = this.modeServerSide ? response.authCode : null;
const accessToken: string = response.authCode;
resp.set(KEY_RET_CODE, TencentRetCode.RET_SUCCESS);
resp.set("openid", response.openId);
resp.set("access_token", accessToken);
Expand Down Expand Up @@ -141,14 +141,20 @@ export default class TencentKitPlugin implements FlutterPlugin, MethodCallHandle
private login(call: MethodCall, result: MethodResult) {
// this.modeServerSide = false; // 客户端授权
// 当前 SDK 仅支持 ServerSide 授权,暂时不处理
this.tencent?.login({
scope: "all",
useQrCode: false,
networkTimeout: 0,
forceWebLogin: false
}, this.authListener);
result.success(null);
}

private loginServerSide(call: MethodCall, result: MethodResult) {
this.modeServerSide = true; // 服务端授权
const scope: string = call.argument("scope");
const qrcode: boolean = call.argument("qrcode");
this.tencent?.login(this.getUIContext(), {
this.tencent?.login({
scope: scope,
useQrCode: qrcode,
forceWebLogin: qrcode || !this.tencent!.isQQInstalled(), // H5 授权, 二维码登录或 QQ 未安装时强制启用
Expand Down