|
//
// shareUtil.h
// ThePaperDemo
//
// Created by scar1900 on 14/12/3.
// Copyright (c) 2014年 scar1900. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <TencentOpenAPI/TencentOAuth.h>
#import <TencentOpenAPI/QQApiInterface.h>
typedef enum
{
weChatLoginType = 1, //微信登陆类型
sinaWeiBoLoginType = 2, //新浪微博登陆类型
weChatSessionShareType = 3, //微信好友分享类型
weChatTimeLineShareType = 4, //微信朋友圈分享类型
sinaWeiBoShareType = 5, //新浪微博分享类型
renrenLoginType = 6, //人人登陆类型
renrenShareType = 7, //人人分享
emailShareType = 8, //邮件分享
QQLoginType = 9, //QQ登陆
QQFriendShareType = 10, //QQ好友分享
QQZoneShareType = 11, //QQ空间分享
TencentWeboShareType = 12, // 腾讯微博分享
evernoteShareType = 13, //印象笔记分享
youdaoShareType = 14, //有道云笔记分享
evernoteLoginType = 15, //印象笔记登录
youdaoLoginType = 16, //有道登录
pocketLoginType = 17, //pocket登录
pocketShareType = 18, //pocket分享
copyType = 19, //复制分享链接
doubanLoginType = 20,//豆瓣登录
doubanShareType = 21,//豆瓣分享
systemShareType = 22 //系统分享
}
shareAndLoginType;
typedef enum {
shareNewsStyle,
shareLiveStyle,
shareSpecicalTopicStyle, //专题
shareTopicStyle
}
shareStyle;
@interface shareUtil : NSObject<QQApiInterfaceDelegate>
/**
* 初始化分享单例
*
* @return 主要用于QQ互联,其余使用shareSDK
*/
+ (shareUtil *)instance;
@property(nonatomic, strong)TencentOAuth *tencentOAuth;
@property(nonatomic, strong)contentObjectBO *contentBO; //给系统分享用
@property(nonatomic, strong)UIViewController *baseSharedController;
@property(nonatomic, assign)CGRect systemShareSourceRect;
//ios7下iPad系统分享popover载体
@property(nonatomic, strong)UIPopoverController *popController;
/**
* 微信登陆
*
* @param completion 成功后的回调,回传是否成功以及用户信息
*/
+ (void) weChatLogin:(void (^)(BOOL isSuccess,NSDictionary* dic))completion;
/**
* 新浪微博登陆
*
* @param completion 成功后的回调,回传是否成功以及用户信息
*/
+ (void) sinaLogin:(void (^)(BOOL isSuccess,NSDictionary *dic))completion;
/**
* 人人网登陆
*
* @param completion 成功后的回调,回传是否成功以及用户信息
*/
+ (void) renrenLogin:(void (^)(BOOL isSuccess,NSDictionary *dic))completion;
/**
* 豆瓣登陆
*
* @param completion 成功后的回调,回传是否成功以及用户信息
*/
+ (void) doubanLogin:(void (^)(BOOL isSuccess,NSDictionary *dic))completion;
/**
* QQ登陆
*
* @param completion 成功后的回调,回传是否成功以及用户信息
*/
+ (void) qqLogin:(void (^)(BOOL isSuccess,NSDictionary *dic))completion;
/**
* 印象笔记登录
*
* @param completion 成功后的回调,回传是否成功以及用户信息
*/
+ (void) evernoteLogin:(void (^)(BOOL isSuccess,NSDictionary *dic))completion;
/**
* 有道登录
*/
+ (void) youdaoLogin:(void (^)(BOOL isSuccess,NSDictionary *dic))completion;
/**
* pocket登录
*
*/
+ (void) pocketLogin:(void (^)(BOOL isSuccess,id userInfo))completion;
/**
* 第三方登出
*
* @param type 第三方登陆类型(shareAndLoginType)
*re
* @return 是否登出成功
*/
+ (BOOL) thirdPartyOutLogin:(shareAndLoginType)type; //注销第三方登陆
/**
* 绑定社交账号
*
* @param type 社交操作类型
* @param completion 回调操作
*/
+ (void)bindSocietyAccountWithType:(shareAndLoginType)type
completion:(void (^)(BOOL isSuccess))completion;
/**
* 解除绑定
*
* @param type 操作类型
* @param completion 回调
*/
+ (void)bindOutWithType:(shareAndLoginType)type
completion:(void (^)(BOOL isSuccess))completion;
/**
* 分享内容
*
* @param shareUrl 分享的URL
* @param imageUrl 分享配图的URL
* @param title 文章标题
* @param type 分享类型(shareAndLoginType)
* @param summary 文章摘要
* @param completion 分享后的回调
*/
+ (void) shareNews:(NSString*)shareUrl
imageUrl:(NSString*)imageUrl
title:(NSString*)title
summary:(NSString*)summary
shareType:(shareAndLoginType)type
shareStyle:(shareStyle)style
completion:(void (^)(BOOL isSuccess))completion; //分享内容
/**
* 互动分享
*
* @param image 分享图片
* @param type 分享类型
* @param completion 分享后的回调
*/
+ (void) interactionShareWithImage:(UIImage*)image
title:(NSString*)title
comment:(NSString*)commentString
shareUrl:(NSString*)shareUrl
shareStyle:(shareStyle)style
shareType:(shareAndLoginType)type
completion:(void (^)(BOOL isSuccess))completion;
+ (BOOL) isHaveWeChatClient; //检查是否有微信客户端
+ (BOOL) isHaveQQClient; //检查是否安装QQ客户端
+ (NSString*) getTokenWithType:(shareAndLoginType)type; //获取第三方登陆token
+ (void)connectTecent:(NSString*)appId; //初始化QQ互联
@end
|