mirror of
https://github.com/RxReader/tencent_kit.git
synced 2025-05-17 15:26:37 +08:00
feature 5.0.0
This commit is contained in:
@ -101,7 +101,7 @@ class _HomeState extends State<Home> {
|
||||
title: Text('登录'),
|
||||
onTap: () {
|
||||
TencentKitPlatform.instance.login(
|
||||
scope: <String>[TencentScope.GET_SIMPLE_USERINFO],
|
||||
scope: <String>[TencentScope.kGetSimpleUserInfo],
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -147,7 +147,7 @@ class _HomeState extends State<Home> {
|
||||
title: Text('分享说说'),
|
||||
onTap: () {
|
||||
TencentKitPlatform.instance.shareMood(
|
||||
scene: TencentScene.SCENE_QZONE,
|
||||
scene: TencentScene.kScene_QZone,
|
||||
summary: '分享测试',
|
||||
);
|
||||
},
|
||||
@ -156,7 +156,7 @@ class _HomeState extends State<Home> {
|
||||
title: Text('文本分享'),
|
||||
onTap: () {
|
||||
TencentKitPlatform.instance.shareText(
|
||||
scene: TencentScene.SCENE_QQ,
|
||||
scene: TencentScene.kScene_QQ,
|
||||
summary: '分享测试',
|
||||
);
|
||||
},
|
||||
@ -167,7 +167,7 @@ class _HomeState extends State<Home> {
|
||||
final File file = await DefaultCacheManager().getSingleFile(
|
||||
'https://www.baidu.com/img/bd_logo1.png?where=super');
|
||||
await TencentKitPlatform.instance.shareImage(
|
||||
scene: TencentScene.SCENE_QQ,
|
||||
scene: TencentScene.kScene_QQ,
|
||||
imageUri: Uri.file(file.path),
|
||||
);
|
||||
},
|
||||
@ -176,7 +176,7 @@ class _HomeState extends State<Home> {
|
||||
title: Text('网页分享'),
|
||||
onTap: () {
|
||||
TencentKitPlatform.instance.shareWebpage(
|
||||
scene: TencentScene.SCENE_QQ,
|
||||
scene: TencentScene.kScene_QQ,
|
||||
title: 'title',
|
||||
targetUrl: 'https://www.baidu.com/',
|
||||
);
|
||||
|
@ -2,67 +2,67 @@ class TencentScope {
|
||||
const TencentScope._();
|
||||
|
||||
/// 发表一条说说到QQ空间(需要申请权限)
|
||||
static const String OPEN_PERMISSION_ADD_TOPIC = 'add_topic';
|
||||
static const String kAddTopic = 'add_topic';
|
||||
|
||||
/// 发表一篇日志到QQ空间(需要申请权限)
|
||||
static const String OPEN_PERMISSION_ADD_ONE_BLOG = 'add_one_blog';
|
||||
static const String kAddOneBlog = 'add_one_blog';
|
||||
|
||||
/// 创建一个QQ空间相册(需要申请权限)
|
||||
static const String OPEN_PERMISSION_ADD_ALBUM = 'add_album';
|
||||
static const String kAddAlbum = 'add_album';
|
||||
|
||||
/// 上传一张照片到QQ空间相册(需要申请权限)
|
||||
static const String OPEN_PERMISSION_UPLOAD_PIC = 'upload_pic';
|
||||
static const String kUploadPic = 'upload_pic';
|
||||
|
||||
/// 获取用户QQ空间相册列表(需要申请权限)
|
||||
static const String OPEN_PERMISSION_LIST_ALBUM = 'list_album';
|
||||
static const String kListAlbum = 'list_album';
|
||||
|
||||
/// 同步分享到QQ空间、腾讯微博
|
||||
static const String OPEN_PERMISSION_ADD_SHARE = 'add_share';
|
||||
static const String kAddShare = 'add_share';
|
||||
|
||||
/// 验证是否认证空间粉丝
|
||||
static const String OPEN_PERMISSION_CHECK_PAGE_FANS = 'check_page_fans';
|
||||
static const String kCheckPageFans = 'check_page_fans';
|
||||
|
||||
/// 获取登录用户自己的详细信息
|
||||
static const String OPEN_PERMISSION_GET_INFO = 'get_info';
|
||||
static const String kGetInfo = 'get_info';
|
||||
|
||||
/// 获取其他用户的详细信息
|
||||
static const String OPEN_PERMISSION_GET_OTHER_INFO = 'get_other_info';
|
||||
static const String kGetOtherInfo = 'get_other_info';
|
||||
|
||||
/// 获取会员用户基本信息
|
||||
static const String OPEN_PERMISSION_GET_VIP_INFO = 'get_vip_info';
|
||||
static const String kGetVipInfo = 'get_vip_info';
|
||||
|
||||
/// 获取会员用户详细信息
|
||||
static const String OPEN_PERMISSION_GET_VIP_RICH_INFO = 'get_vip_rich_info';
|
||||
static const String kGetVipRichInfo = 'get_vip_rich_info';
|
||||
|
||||
/// 获取用户信息
|
||||
static const String GET_USER_INFO = 'get_user_info';
|
||||
static const String kGetUserInfo = 'get_user_info';
|
||||
|
||||
/// 移动端获取用户信息
|
||||
static const String GET_SIMPLE_USERINFO = 'get_simple_userinfo';
|
||||
static const String kGetSimpleUserInfo = 'get_simple_userinfo';
|
||||
|
||||
/// 所有权限
|
||||
static const String ALL = 'all';
|
||||
static const String kAll = 'all';
|
||||
}
|
||||
|
||||
class TencentScene {
|
||||
const TencentScene._();
|
||||
|
||||
/// QQ
|
||||
static const int SCENE_QQ = 0;
|
||||
static const int kScene_QQ = 0;
|
||||
|
||||
/// QZone
|
||||
static const int SCENE_QZONE = 1;
|
||||
static const int kScene_QZone = 1;
|
||||
}
|
||||
|
||||
class TencentQZoneFlag {
|
||||
const TencentQZoneFlag._();
|
||||
|
||||
/// 默认是不隐藏分享到QZone按钮且不自动打开分享到QZone的对话框
|
||||
static const int DEFAULT = 0;
|
||||
static const int kDefault = 0;
|
||||
|
||||
/// 分享时自动打开分享到QZone的对话框
|
||||
static const int AUTO_OPEN = 1;
|
||||
static const int kAutoOpen = 1;
|
||||
|
||||
/// 分享时隐藏分享到QZone按钮
|
||||
static const int ITEM_HIDE = 2;
|
||||
static const int kItemHide = 2;
|
||||
}
|
||||
|
@ -12,24 +12,24 @@ abstract class TencentResp {
|
||||
|
||||
/// 网络请求成功发送至服务器,并且服务器返回数据格式正确
|
||||
/// 这里包括所请求业务操作失败的情况,例如没有授权等原因导致
|
||||
static const int RET_SUCCESS = 0;
|
||||
static const int kRetSuccess = 0;
|
||||
|
||||
/// 网络异常,或服务器返回的数据格式不正确导致无法解析
|
||||
static const int RET_FAILED = 1;
|
||||
static const int kRetFailed = 1;
|
||||
|
||||
static const int RET_COMMON = -1;
|
||||
static const int kRetCommon = -1;
|
||||
|
||||
static const int RET_USERCANCEL = -2;
|
||||
static const int kRetUserCancel = -2;
|
||||
|
||||
@JsonKey(
|
||||
defaultValue: RET_SUCCESS,
|
||||
defaultValue: kRetSuccess,
|
||||
)
|
||||
final int ret;
|
||||
final String? msg;
|
||||
|
||||
bool get isSuccessful => ret == RET_SUCCESS;
|
||||
bool get isSuccessful => ret == kRetSuccess;
|
||||
|
||||
bool get isCancelled => ret == RET_USERCANCEL;
|
||||
bool get isCancelled => ret == kRetUserCancel;
|
||||
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
@ -97,7 +97,7 @@ class MethodChannelTencentKit extends TencentKitPlatform {
|
||||
List<Uri>? imageUris,
|
||||
Uri? videoUri,
|
||||
}) {
|
||||
assert(scene == TencentScene.SCENE_QZONE);
|
||||
assert(scene == TencentScene.kScene_QZone);
|
||||
assert((summary?.isNotEmpty ?? false) ||
|
||||
((imageUris?.isNotEmpty ?? false) &&
|
||||
imageUris!.every((Uri element) => element.isScheme('file'))) ||
|
||||
@ -120,7 +120,7 @@ class MethodChannelTencentKit extends TencentKitPlatform {
|
||||
required int scene,
|
||||
required String summary,
|
||||
}) {
|
||||
assert(scene == TencentScene.SCENE_QQ);
|
||||
assert(scene == TencentScene.kScene_QQ);
|
||||
return methodChannel.invokeMethod<void>(
|
||||
'shareText',
|
||||
<String, dynamic>{
|
||||
@ -135,9 +135,9 @@ class MethodChannelTencentKit extends TencentKitPlatform {
|
||||
required int scene,
|
||||
required Uri imageUri,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
assert(scene == TencentScene.SCENE_QQ);
|
||||
assert(scene == TencentScene.kScene_QQ);
|
||||
assert(imageUri.isScheme('file'));
|
||||
return methodChannel.invokeMethod<void>(
|
||||
'shareImage',
|
||||
@ -159,9 +159,9 @@ class MethodChannelTencentKit extends TencentKitPlatform {
|
||||
required String musicUrl,
|
||||
required String targetUrl,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
assert(scene == TencentScene.SCENE_QQ);
|
||||
assert(scene == TencentScene.kScene_QQ);
|
||||
return methodChannel.invokeMethod<void>(
|
||||
'shareMusic',
|
||||
<String, dynamic>{
|
||||
@ -185,7 +185,7 @@ class MethodChannelTencentKit extends TencentKitPlatform {
|
||||
Uri? imageUri,
|
||||
required String targetUrl,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
return methodChannel.invokeMethod<void>(
|
||||
'shareWebpage',
|
||||
|
@ -95,7 +95,7 @@ abstract class TencentKitPlatform extends PlatformInterface {
|
||||
required int scene,
|
||||
required Uri imageUri,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
throw UnimplementedError(
|
||||
'shareImage({required scene, required imageUri, appName, extInt}) has not been implemented.');
|
||||
@ -110,7 +110,7 @@ abstract class TencentKitPlatform extends PlatformInterface {
|
||||
required String musicUrl,
|
||||
required String targetUrl,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
throw UnimplementedError(
|
||||
'shareMusic({required scene, required title, summary, imageUri, required musicUrl, required targetUrl, appName, extInt}) has not been implemented.');
|
||||
@ -124,7 +124,7 @@ abstract class TencentKitPlatform extends PlatformInterface {
|
||||
Uri? imageUri,
|
||||
required String targetUrl,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
throw UnimplementedError(
|
||||
'shareWebpage({required scene, required title, summary, imageUri, required targetUrl, appName, extInt}) has not been implemented.');
|
||||
|
@ -58,7 +58,7 @@ class MockTencentKitPlatform
|
||||
required int scene,
|
||||
required Uri imageUri,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
@ -82,7 +82,7 @@ class MockTencentKitPlatform
|
||||
required String musicUrl,
|
||||
required String targetUrl,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
@ -103,7 +103,7 @@ class MockTencentKitPlatform
|
||||
Uri? imageUri,
|
||||
required String targetUrl,
|
||||
String? appName,
|
||||
int extInt = TencentQZoneFlag.DEFAULT,
|
||||
int extInt = TencentQZoneFlag.kDefault,
|
||||
}) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
Reference in New Issue
Block a user