Skip to content

Commit 56faa8c

Browse files
author
Jasper
committed
更新目录
1 parent b2361e6 commit 56faa8c

File tree

8 files changed

+1035
-0
lines changed

8 files changed

+1035
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// CYShareBaseUtil.h
3+
// CYUtilProject
4+
//
5+
// Created by HuangQiSheng on 3/22/16.
6+
// Copyright © 2016 Charry. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@class CYShareModel;
12+
13+
typedef void (^CYThirdPartyLoginCallback)(NSInteger code, NSString *msg, NSDictionary *resultDic);
14+
typedef void (^CYShareCallback)(NSInteger code, NSString *msg);
15+
16+
@interface CYBaseShare : NSObject
17+
18+
@property (nonatomic, strong, readonly) NSString *appId;
19+
//@property (nonatomic, strong, readonly) NSString *appKey;
20+
21+
@property (nonatomic, copy) CYShareCallback shareCallback;
22+
23+
#pragma mark - share
24+
// Subclass should implements this method to implement the share action
25+
- (void)share:(CYShareModel *)model
26+
callback:(CYShareCallback)callback;
27+
28+
#pragma mark - app info
29+
// 注册appid和appKey
30+
- (void)registerWithAppId:(NSString *)appId;
31+
32+
#pragma mark - api
33+
/**
34+
* 打开App
35+
*
36+
* @return YES打开成功,NO打开失败
37+
*/
38+
+ (BOOL)openApp;
39+
40+
/*! @brief 检查App是否已被用户安装
41+
*
42+
* @return 已安装返回YES,未安装返回NO。
43+
*/
44+
+ (BOOL)appInstalled;
45+
46+
@end
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// CYShareBaseUtil.m
3+
// CYUtilProject
4+
//
5+
// Created by HuangQiSheng on 3/22/16.
6+
// Copyright © 2016 Charry. All rights reserved.
7+
//
8+
9+
#import "CYBaseShare.h"
10+
11+
@implementation CYBaseShare
12+
13+
#pragma mark - app info
14+
- (void)registerWithAppId:(NSString *)appId {
15+
_appId = appId;
16+
}
17+
18+
#pragma mark - share
19+
- (void)share:(CYShareModel *)model
20+
callback:(CYShareCallback)callback {
21+
22+
self.shareCallback = callback;
23+
}
24+
25+
#pragma mark - api
26+
+ (BOOL)openApp {
27+
28+
return NO;
29+
}
30+
31+
+ (BOOL)appInstalled {
32+
33+
return NO;
34+
}
35+
36+
@end
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
//
2+
// CYQQUtils.h
3+
// CYUtilProject
4+
//
5+
// Created by HuangQiSheng on 11/10/15.
6+
// Copyright © 2015 Charry. All rights reserved.
7+
//
8+
9+
#import "CYShareCtrlFlag.h"
10+
11+
#if CY_SHARE_QQ_ENABLED
12+
#import "CYBaseShare.h"
13+
14+
@class CYShareModel;
15+
@class UIViewController;
16+
17+
typedef NS_ENUM(uint64_t, CYQQAPICtrlFlag) {
18+
CYQQAPICtrlFlagQZoneShareOnStart = 0x01, // QZone
19+
CYQQAPICtrlFlagQZoneShareForbid = 0x02,
20+
CYQQAPICtrlFlagQQShare = 0x04, // qq好友
21+
CYQQAPICtrlFlagQQShareFavorites = 0x08, //收藏
22+
CYQQAPICtrlFlagQQShareDataline = 0x10 //数据线
23+
};
24+
25+
// 此类采用单例模式,请直接使用sharedInstance,不要创建新实例
26+
@interface CYQQ : CYBaseShare
27+
28+
extern NSString *const CYQQAPICtrlFlagKey;
29+
30+
#pragma mark - share url
31+
/**
32+
* 如果使用此方法分享,model的userInfo属性可以包含key 为CYWechatSceneKey,值为CYWechatScene中的一个,
33+
* 用于标识分享的目标,如果未包含,则调用share:presentActionSheetFrom:callback:进行分享
34+
*/
35+
- (void)share:(CYShareModel *)model
36+
callback:(CYShareCallback)callback;
37+
38+
/**
39+
* 分享到QQ
40+
* 弹出ActionSheet,让用户选择分享到QQ好友或者QQ空间
41+
*
42+
*/
43+
- (void)share:(CYShareModel *)model
44+
presentActionSheetFrom:(UIViewController *)viewController
45+
callback:(CYShareCallback)callback;
46+
47+
/**
48+
* 分享给QQ好友
49+
*
50+
*/
51+
- (void)shareToQQ:(CYShareModel *)model
52+
callback:(CYShareCallback)callback;
53+
54+
/**
55+
* 分享到QQ空间
56+
*
57+
*/
58+
- (void)shareToQZone:(CYShareModel *)model
59+
callback:(CYShareCallback)callback;
60+
61+
62+
/**
63+
* 分享到制定的QQ目标
64+
*
65+
*/
66+
- (void)share:(CYShareModel *)model
67+
to:(CYQQAPICtrlFlag)flag
68+
callback:(CYShareCallback)callback;
69+
70+
71+
#pragma mark - handle open
72+
/**
73+
* 需要在AppDelegate的- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation 方法中调用此方法,来处理结果
74+
*/
75+
- (BOOL)handleOpenURL:(NSURL *)url;
76+
77+
#pragma mark - sharedInstance
78+
+ (instancetype)sharedInstance;
79+
80+
@end
81+
#endif

0 commit comments

Comments
 (0)