Commit 0d5cb74d8afb3282db69aca523bca6c531f601a7

Authored by zhangxiaowen
1 parent 37e7bcee

no message

CNLiveIntegralModule/Classes/Controller/CNLiveTaskListController.m
... ... @@ -50,8 +50,6 @@
50 50 @property (nonatomic, strong) UIButton *backButton;
51 51 @property (nonatomic, strong) UILabel *titleLabel;
52 52  
53   -//@property (nonatomic, strong) CNTouristsLoginTipsView *fuzzyView;//游客登录弹框
54   -
55 53 @end
56 54  
57 55 @implementation CNLiveTaskListController
... ... @@ -63,7 +61,7 @@
63 61  
64 62 }
65 63 else if ([type isEqualToString:@"publish_witness"]){//发布目击者
66   - [self selectChannelId:@"1" classifyId:@"101"];
  64 +// [self selectChannelId:@"1" classifyId:@"101"];
67 65  
68 66 }
69 67 else if ([type isEqualToString:@"add_friend"]){//添加好友
... ... @@ -77,19 +75,19 @@
77 75  
78 76 }
79 77 else if ([type isEqualToString:@"share_video"]){//分享目击者视频
80   - [self selectChannelId:@"1" classifyId:@"101"];
  78 +// [self selectChannelId:@"1" classifyId:@"101"];
81 79  
82 80 }
83 81 else if ([type isEqualToString:@"share_article"]){//分享文章
84   - [self selectChannelId:@"1" classifyId:@"102"];
  82 +// [self selectChannelId:@"1" classifyId:@"102"];
85 83  
86 84 }
87 85 else if ([type isEqualToString:@"publish_comment"]){//评论
88   - [self selectChannelId:@"1" classifyId:@"101"];
  86 +// [self selectChannelId:@"1" classifyId:@"101"];
89 87  
90 88 }
91 89 else if ([type isEqualToString:@"read_article"]){//看文章-> 视讯中国 -> 今日要闻
92   - [self selectChannelId:@"1" classifyId:@"102"];
  90 +// [self selectChannelId:@"1" classifyId:@"102"];
93 91  
94 92 }
95 93 else if ([type isEqualToString:@"customer_feedback"]){//帮助与反馈
... ... @@ -104,7 +102,7 @@
104 102 // [[AppDelegate sharedAppDelegate] pushViewController:webVC withBackTitle:@" "];
105 103 }
106 104 else if ([type isEqualToString:@"watch_video"]){//看视频 -> 视讯中国 -> 目击者
107   - [self selectChannelId:@"1" classifyId:@"101"];
  105 +// [self selectChannelId:@"1" classifyId:@"101"];
108 106  
109 107 }
110 108 else if ([type isEqualToString:@"check_in"]){//签到
... ... @@ -115,100 +113,14 @@
115 113 // [self.navigationController popViewControllerAnimated:YES];
116 114 }
117 115 else if ([type isEqualToString:@"listen_novel"]){//听小说
118   - [self selectChannelId:@"219" classifyId:@"215"];
  116 +// [self selectChannelId:@"219" classifyId:@"215"];
119 117  
120 118 }
121 119  
122 120  
123 121 }
124   -- (void)selectChannelId:(NSString *)channelId classifyId:(NSString *)classifyId{
125   - NSInteger channel = [self containsWithChannelId:channelId];
126   - if(channel == -1){
127   -// [[UIApplication sharedApplication].keyWindow addSubview:self.fuzzyView];
128   -
129   - }else{
130   - NSInteger classify = [self containsWithChannelIndex:channel classifyId:classifyId];
131   - if(classify == -1){
132   - [self selectTabbarControllerItem:1 channelId:channel classifyId:0];
133 122  
134   - }else{
135   - [self selectTabbarControllerItem:1 channelId:channel classifyId:classify];
136 123  
137   - }
138   -
139   - }
140   -}
141   -- (void)selectTabbarControllerItem:(NSInteger)item channelId:(NSInteger)channelId classifyId:(NSInteger)classifyId{
142   -// CNTabBarViewController *tabbarController = (CNTabBarViewController *)[AppDelegate sharedAppDelegate].window.rootViewController;
143   -// tabbarController.selectedIndex = item;
144   -// if([self.isFrom isEqualToString:@"Classify"]){
145   -// [self.navigationController popViewControllerAnimated:YES];
146   -// }
147   -//
148   -// if (![CNWebRedirectHandle manager].isSelectedClassify) {
149   -// [CNWebRedirectHandle manager].isClickedIntegral = YES;
150   -// [CNWebRedirectHandle manager].channelId = channelId;
151   -// [CNWebRedirectHandle manager].classifyId = classifyId;
152   -// return;
153   -// }
154   -//
155   -// //分类
156   -// CNNavigationController *nav = tabbarController.childViewControllers[item];
157   -// CNClassifySegmentController *vc = nav.childViewControllers[0];
158   -//
159   -// if([vc isKindOfClass:[CNClassifySegmentController class]]){
160   -// //视讯中国 - 听见中国
161   -// [vc categoryView:vc.titleImageCategoryView didSelectedItemAtIndex:channelId];
162   -//
163   -// CNSubClassifySegmentController *svc = [vc.vcArrayM safetyObjectAtIndex:channelId];
164   -// if([svc isKindOfClass:[CNSubClassifySegmentController class]]){
165   -// //目击者 - 今日要闻 - 中国冰雪
166   -// [svc categoryView:svc.categoryView didSelectedItemAtIndex:classifyId];
167   -//
168   -// }
169   -// }
170   -}
171   -//判断是否有这个频道 -- 一级
172   -- (NSInteger)containsWithChannelId:(NSString *)channelId {
173   -// NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
174   -// NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
175   -//
176   -// NSInteger i = 0;
177   -// for (NSString *str in channelArray) {
178   -// NSDictionary *dic = CNLiveStringJsonToDictionary(str);
179   -// CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
180   -// if ([model.id isEqualToString:channelId]) {
181   -// return i;
182   -// }
183   -// i++;
184   -// }
185   - return -1;
186   -
187   -}
188   -//判断有这个频道的分类在第几个 -- 二级
189   -- (NSInteger)containsWithChannelIndex:(NSInteger)index classifyId:(NSString *)classifyId {
190   -// NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
191   -// NSMutableArray *channelArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
192   -// NSInteger i = 0;
193   -//
194   -// if(channelArray.count > index){
195   -// NSString *modelStr = channelArray[index];
196   -// NSDictionary *dic = CNLiveStringJsonToDictionary(modelStr);
197   -// CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
198   -// for (CNCategoryGetChannelModel *subModel in model.pageStyleList) {
199   -// if ([subModel.id isEqualToString:classifyId]) {
200   -// return i;
201   -// }
202   -// if (CNLiveStringIsEmpty(subModel.pageType)) {
203   -// continue;
204   -// }else{
205   -// i++;
206   -// }
207   -// }
208   -// }
209   - return -1;
210   -
211   -}
212 124 #pragma mark - Data
213 125 - (void)loadData{
214 126 // NSDictionary *params = @{@"sid":CNUserShareModel.uid};
... ... @@ -266,7 +178,8 @@
266 178  
267 179 [self loadData];
268 180 [self createUI];
269   -
  181 + [CNLiveGoldWhereaboutsView showWithDesc:@"asd" delegate:self];
  182 +
270 183 }
271 184 - (void)dealloc{
272 185 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"AddScoreRequestSuccess" object:nil];
... ...
CNLiveIntegralModule/Classes/Module/CNLiveIntegralService.m
... ... @@ -14,19 +14,16 @@
14 14  
15 15 // 任务列表
16 16 #import "CNLiveTaskListController.h"
17   -// 积分明细
18   -#import "CNLiveIntegralDetailsController.h"
19 17  
20 18 // 增加积分
21 19 #import "CNLiveAddScoreManager.h"
22 20 #import "CNLiveAddScoreView.h"
23   -
24 21 // 金币下落
25 22 #import "CNLiveGoldWhereaboutsView.h"
26   -
27 23 // 签到
28 24 #import "CNLiveSignInView.h"
29 25  
  26 +#import "CNLiveScoreModel.h"
30 27  
31 28 @BeeHiveService(CNLiveIntegralServiceProtocol,CNLiveIntegralService)
32 29 @interface CNLiveIntegralService ()<CNLiveIntegralServiceProtocol>
... ... @@ -51,17 +48,6 @@
51 48 // [CNLivePageJumpManager pushViewController:vc];
52 49 }
53 50  
54   -#pragma mark - 积分明细
55   -// 积分明细
56   -- (UIViewController *)getIntegralDetailsViewController {
57   - return [CNLiveIntegralDetailsController new];
58   -}
59   -
60   -- (void)pushToIntegralDetailsViewController {
61   - CNLiveIntegralDetailsController *vc = [[CNLiveIntegralDetailsController alloc]init];
62   -// [CNLivePageJumpManager pushViewController:vc];
63   -}
64   -
65 51 #pragma mark - 增加积分
66 52 // 请求
67 53 //延时调用
... ... @@ -83,49 +69,48 @@
83 69 [CNLiveAddScoreManager requestTaskId:taskId contentId:contentId block:block];
84 70 }
85 71  
86   -- (BOOL)judgeIsAddScoreJson:(NSString *)name taskType:(NSString *)taskType taskId:(NSString *)taskId{
87   - return [CNLiveAddScoreManager judgeIsAddScoreJson:name taskType:taskType taskId:taskId];
88   -}
89   -
90   -- (BOOL)writeJsonName:(NSString *)name dic:(NSDictionary *)dic{
91   - return [CNLiveAddScoreManager writeJsonName:name dic:dic];
92   -}
93   -
94 72 // 视图
95   -+ (void)showAddScoreViewWithDesc:(NSString *)desc score:(NSString *)score{
  73 +- (void)showAddScoreViewWithDesc:(NSString *)desc score:(NSString *)score{
96 74 [CNLiveAddScoreView showWithDesc:desc score:score];
97 75 }
98   -+ (void)showAddScoreViewWithDesc:(NSString *)desc score:(NSString *)score delegate:(id<CNLiveAddScoreViewDelegate>)delegate{
  76 +- (void)showAddScoreViewWithDesc:(NSString *)desc score:(NSString *)score delegate:(id<CNLiveAddScoreViewDelegate>)delegate{
99 77 [CNLiveAddScoreView showWithDesc:desc score:score delegate:delegate];
100 78 }
101 79  
102   -+ (void)hideAddScoreView{
  80 +- (void)hideAddScoreView{
103 81 [CNLiveAddScoreView hide];
104 82 }
105 83  
106 84 #pragma mark - 金币下落
107   -// 游客模式浏览加积分
108   -+ (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc delegate:(id)delegate{
109   - [CNLiveGoldWhereaboutsView showWithDesc:desc delegate:delegate];
  85 +// 默认签到
  86 +- (void)showGoldWhereaboutsViewWithModel:(CNLiveScoreModel *)model{
  87 + [CNLiveGoldWhereaboutsView showWithModel:model];
  88 +
  89 +}
  90 +
  91 +- (void)showGoldWhereaboutsViewWithDic:(NSDictionary *)dic{
  92 + CNLiveScoreModel * model = [CNLiveScoreModel mj_objectWithKeyValues:dic];
  93 + [CNLiveGoldWhereaboutsView showWithModel:model];
  94 +
110 95 }
111 96  
112 97 // 默认展示添加积分视图
113   -+ (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc score:(NSString *)score{
  98 +- (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc score:(NSString *)score{
114 99 [CNLiveGoldWhereaboutsView showWithDesc:desc score:score];
115 100  
116 101 }
117 102  
118   -// 默认签到
119   -+ (void)showGoldWhereaboutsViewModel:(CNLiveScoreModel *)model{
120   - [CNLiveGoldWhereaboutsView show:model];
121   -
  103 +// 游客模式浏览加积分
  104 +- (void)showGoldWhereaboutsViewWithDesc:(NSString *)desc delegate:(id)delegate{
  105 + [CNLiveGoldWhereaboutsView showWithDesc:desc delegate:delegate];
122 106 }
123   -+ (void)hideGoldWhereaboutsView{
  107 +
  108 +- (void)hideGoldWhereaboutsView{
124 109 [CNLiveGoldWhereaboutsView hide];
125 110 }
126 111  
127 112 #pragma mark - 签到
128   -+ (void)showSignInView:(NSString *)score scores:(NSString *)scores day:(NSInteger)day url:(NSString *)url{
  113 +- (void)showSignInViewWithScore:(NSString *)score scores:(NSString *)scores day:(NSInteger)day url:(NSString *)url{
129 114 [CNLiveSignInView showWithScore:score scores:scores day:day url:url];
130 115 }
131 116  
... ...
CNLiveIntegralModule/Classes/Tools/CNLiveGoldWhereaboutsView.h
... ... @@ -25,7 +25,7 @@ typedef NS_ENUM(NSUInteger, CNLiveGoldWhereaboutsViewType) {
25 25 @interface CNLiveGoldWhereaboutsView : CAEmitterLayerView
26 26  
27 27 // 默认签到
28   -+ (void)show:(CNLiveScoreModel *)model;
  28 ++ (void)showWithModel:(CNLiveScoreModel *)model;
29 29  
30 30 // 默认展示添加积分视图
31 31 + (void)showWithDesc:(NSString *)desc score:(NSString *)score;
... ...
CNLiveIntegralModule/Classes/Tools/CNLiveGoldWhereaboutsView.m
... ... @@ -47,7 +47,7 @@
47 47  
48 48 }
49 49  
50   -+ (void)show:(CNLiveScoreModel *)model {
  50 ++ (void)showWithModel:(CNLiveScoreModel *)model {
51 51 CNLiveGoldWhereaboutsView *sView = [[CNLiveGoldWhereaboutsView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
52 52 sView.model = model;
53 53 [[UIApplication sharedApplication].keyWindow addSubview:sView];
... ... @@ -87,7 +87,9 @@
87 87 snowFlake.yAcceleration = 2500.f;
88 88 snowFlake.emissionRange = 0.5 * M_PI;
89 89 snowFlake.spinRange = 0.25 * M_PI;
90   - snowFlake.contents = (__bridge id _Nullable)([UIImage imageNamed:[NSString stringWithFormat:@"gold_whereabouts%d",i]].CGImage);
  90 +
  91 + UIImage *image = [self xw_getImageName:[NSString stringWithFormat:@"gold_whereabouts%d",i] bundleName:@"CNLiveIntegralModule" targetClass:[self class]];
  92 + snowFlake.contents = (__bridge id _Nullable)(image.CGImage);
91 93 snowFlake.lifetime = 100.f;
92 94  
93 95 snowFlake.scale = 0.08;
... ... @@ -246,4 +248,20 @@
246 248 [self hide];
247 249 }
248 250  
  251 +/**
  252 + * 创建图片
  253 + *
  254 + * @param imageName 图片名字
  255 + * @param bundleName 图片所在的bundle名字
  256 + * @param targetClass 类和bundle的同级目录
  257 + * @return 返回UIImage
  258 + */
  259 +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{
  260 + NSBundle *bundle = [NSBundle bundleForClass:targetClass];
  261 + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];
  262 + NSBundle *targetBundle = [NSBundle bundleWithURL:url];
  263 + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];
  264 + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
  265 +}
  266 +
249 267 @end
... ...
CNLiveIntegralModule/Classes/Tools/CNLiveRewardRulesView.h
... ... @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
12 12  
13 13 @interface CNLiveRewardRulesView : UIView
14 14  
15   -+ (void)show:(NSString *)url;
  15 ++ (void)showWithUrl:(NSString *)url;
16 16  
17 17 @end
18 18  
... ...
CNLiveIntegralModule/Classes/Tools/CNLiveRewardRulesView.m
... ... @@ -25,7 +25,7 @@
25 25 static const NSInteger margin = 0;
26 26  
27 27 #pragma mark - Using Method
28   -+ (void)show:(NSString *)url{
  28 ++ (void)showWithUrl:(NSString *)url{
29 29 CNLiveRewardRulesView *view = [[CNLiveRewardRulesView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
30 30 view.backgroundColor = [UIColor colorWithWhite:0.2f alpha:0.4f];
31 31 [view.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
... ...
CNLiveIntegralModule/Classes/Tools/CNLiveSignInView.m
... ... @@ -183,7 +183,7 @@ static const NSInteger margin = 15;
183 183 #pragma mark - Action
184 184 - (void)clickRulesBtn:(UIButton *)btn{
185 185 [self removeFromSuperview];
186   - [CNLiveRewardRulesView show:self.url];
  186 + [CNLiveRewardRulesView showWithUrl:self.url];
187 187  
188 188 }
189 189 - (void)clickCloseBtn:(UIButton *)btn{
... ...
Example/CNLiveIntegralModule.xcodeproj/project.pbxproj
... ... @@ -207,7 +207,7 @@
207 207 6003F586195388D20070C39A /* Sources */,
208 208 6003F587195388D20070C39A /* Frameworks */,
209 209 6003F588195388D20070C39A /* Resources */,
210   - 4C2E5425FBAFD3161FA4DFD3 /* [CP] Embed Pods Frameworks */,
  210 + 9A8784A7A4161CC30484D821 /* [CP] Embed Pods Frameworks */,
211 211 );
212 212 buildRules = (
213 213 );
... ... @@ -320,7 +320,7 @@
320 320 shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
321 321 showEnvVarsInLog = 0;
322 322 };
323   - 4C2E5425FBAFD3161FA4DFD3 /* [CP] Embed Pods Frameworks */ = {
  323 + 9A8784A7A4161CC30484D821 /* [CP] Embed Pods Frameworks */ = {
324 324 isa = PBXShellScriptBuildPhase;
325 325 buildActionMask = 2147483647;
326 326 files = (
... ...
Example/CNLiveIntegralModule/CNLIVEAppDelegate.m
... ... @@ -38,7 +38,7 @@
38 38  
39 39  
40 40 [self.window makeKeyAndVisible];
41   - [CNLiveGoldWhereaboutsView showWithDesc:@"asd" delegate:self];
  41 +// [CNLiveGoldWhereaboutsView showWithDesc:@"asd" delegate:self];
42 42  
43 43 // [CNLiveAddScoreView showAddScoreViewWithDesc:@"asd" login:@"asdasd" delegate:self];
44 44  
... ...