| | |
| | | |
| | | #pragma mark - ç½ç»ç¶æåçååéç¥æ¹æ³ |
| | | -(void)NetWorkStatesChange:(NSNotification *)sender{ |
| | | |
| | | |
| | | int networkState = [[sender object] intValue]; |
| | | switch (networkState) { |
| | | case -1: |
| | |
| | | |
| | | case 0: |
| | | //没æç½ç» |
| | | self.anomalyView.hidden = YES; |
| | | self.noNetworkViews.hidden = NO; |
| | | if (self.dataSource.count == 0) { |
| | | |
| | | self.anomalyView.hidden = YES; |
| | | self.noNetworkViews.hidden = NO; |
| | | } |
| | | |
| | | break; |
| | | |
| | | case 1: { |
| | | //3Gæè
4Gï¼åæ£ç¨çæ¯æµé |
| | | |
| | | |
| | | |
| | | if (self.dataSource.count == 0 || !self.dataSource) { |
| | | |
| | | [self getRecommendActivity]; |
| | | } |
| | | self.anomalyView.hidden = YES; |
| | | self.noNetworkViews.hidden = YES; |
| | | self.anomalyView.hidden = YES; |
| | | self.noNetworkViews.hidden = YES; |
| | | |
| | | } |
| | | break; |
| | |
| | | case 2: { |
| | | //WIFIç½ç» |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if (self.dataSource.count == 0 || !self.dataSource) { |
| | | |
| | | [self getRecommendActivity]; |
| | | } |
| | | self.anomalyView.hidden = YES; |
| | | self.noNetworkViews.hidden = YES; |
| | | self.anomalyView.hidden = YES; |
| | | self.noNetworkViews.hidden = YES; |
| | | |
| | | } |
| | | break; |
| | |
| | | return; |
| | | } |
| | | } |
| | | [SVProgressHUD show]; |
| | | |
| | | [self activityAddShareCountWithID:dic[@"id"]]; |
| | | NSMutableArray *picArray = @[].mutableCopy; |
| | | |
| | | if ([dic[@"type"]integerValue] == 1) { |
| | | if ([dic[@"type"] integerValue] == 1) { |
| | | |
| | | [self shareGoods:dic[@"id"]]; |
| | | return; |
| | | }else{ |
| | | |
| | | } else { |
| | | |
| | | if ([dic[@"type"]integerValue] == 3) { |
| | | |
| | | NSArray *arr = dic[@"imageList"]; |
| | | |
| | | if (arr.count > 0) { |
| | | NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:arr[0]]]; |
| | | UIImage *image = [UIImage imageWithData:data]; |
| | | [picArray addObject:image]; |
| | | } |
| | | }else |
| | | { |
| | | |
| | | } else { |
| | | |
| | | [self activityinviteImgWirh:dic[@"id"]]; |
| | | return; |
| | | } |
| | | } |
| | | NSString *shareString =[NSString stringWithFormat:@"%@",dic[@"title"]]; |
| | | NSString *shareString = [NSString stringWithFormat:@"%@",dic[@"title"]]; |
| | | UIPasteboard*pasteboard = [UIPasteboard generalPasteboard]; |
| | | pasteboard.string=shareString; |
| | | pasteboard.string = shareString; |
| | | [self wxShareWithArray:picArray]; |
| | | } |
| | | |
| | |
| | | |
| | | @param activityId å享项çID |
| | | */ |
| | | - (void)shareGoods:(NSString *)activityId{ |
| | | - (void)shareGoods:(NSString *)activityId { |
| | | |
| | | [SVProgressHUD setContainerView:[UIApplication sharedApplication].delegate.window]; |
| | | [SVProgressHUD show]; |
| | | |
| | | NSMutableDictionary *dic = @{}.mutableCopy; |
| | | [dic setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"] forKey:@"uid"]; |
| | | [dic setValue:activityId forKey:@"activityId"]; |
| | | NSDictionary *dictionary = [SJNetwork CommonDictionarywithDic:dic]; |
| | | [YTHsharedManger startManger].isMainOrDynamic = YES; |
| | | |
| | | [JYNetWorking Post:[NSString stringWithFormat:@"%@/%@",domainHTTP,@"activity/shareGoods"] param:dictionary isMainOrDynamic:YES success:^(NSDictionary *object) { |
| | | // NSLog(@"%@",object); |
| | | if ([object[@"code"]integerValue] == 0) { |
| | | [SVProgressHUD show]; |
| | | |
| | | NSDictionary *dic = object[@"data"]; |
| | | NSString *shareString =[NSString stringWithFormat:@"%@",dic[@"shareTitle"]]; |
| | | UIPasteboard*pasteboard = [UIPasteboard generalPasteboard]; |
| | | pasteboard.string=shareString; |
| | | NSMutableArray *array = @[].mutableCopy; |
| | | NSArray *arr = dic[@"shareImgs"]; |
| | | |
| | | self.flag = 0; |
| | | |
| | | for (NSInteger index = 0; index < arr.count; index++) { |
| | | |
| | | [[SDWebImageManager sharedManager]loadImageWithURL:[NSURL URLWithString:arr[index]] |
| | | options:0 |
| | | progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { |
| | | |
| | | } completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { |
| | | |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | |
| | | if (image && finished) { |
| | | |
| | | self.flag ++; |
| | | |
| | | [array addObject:image]; |
| | | |
| | | if (self.flag == arr.count ) { |
| | | |
| | | [self wxShareWithArray:array]; |
| | | } |
| | | } |
| | | |
| | | }); |
| | | }]; |
| | | } |
| | | |
| | | }else{ |
| | | [SVProgressHUD setContainerView:[UIApplication sharedApplication].delegate.window]; |
| | | [SVProgressHUD showErrorWithStatus:object[@"msg"]]; |
| | | } |
| | | |
| | | } fail:^(id object) { |
| | | [SVProgressHUD dismiss]; |
| | | }]; |
| | | [JYNetWorking Post:[NSString stringWithFormat:@"%@/%@",domainHTTP,@"activity/shareGoods"] |
| | | param:dictionary |
| | | isMainOrDynamic:YES success:^(NSDictionary *object) { |
| | | |
| | | if ([object[@"code"]integerValue] == 0) { |
| | | |
| | | |
| | | NSDictionary *dic = object[@"data"]; |
| | | NSString *shareString =[NSString stringWithFormat:@"%@",dic[@"shareTitle"]]; |
| | | UIPasteboard*pasteboard = [UIPasteboard generalPasteboard]; |
| | | pasteboard.string=shareString; |
| | | NSMutableArray *array = @[].mutableCopy; |
| | | NSArray *arr = dic[@"shareImgs"]; |
| | | |
| | | self.flag = 0; |
| | | |
| | | for (NSInteger index = 0; index < arr.count; index++) { |
| | | |
| | | [[SDWebImageManager sharedManager]loadImageWithURL:[NSURL URLWithString:arr[index]] |
| | | options:0 |
| | | progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { |
| | | |
| | | } completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { |
| | | |
| | | dispatch_async(dispatch_get_main_queue(), ^{ |
| | | |
| | | if (image && finished) { |
| | | |
| | | self.flag ++; |
| | | |
| | | [array addObject:image]; |
| | | |
| | | if (self.flag == arr.count ) { |
| | | |
| | | [self wxShareWithArray:array]; |
| | | } |
| | | } |
| | | |
| | | }); |
| | | }]; |
| | | } |
| | | |
| | | } else { |
| | | [SVProgressHUD dismiss]; |
| | | [SVProgressHUD setContainerView:[UIApplication sharedApplication].delegate.window]; |
| | | [SVProgressHUD showErrorWithStatus:object[@"msg"]]; |
| | | } |
| | | |
| | | } fail:^(id object) { |
| | | [SVProgressHUD dismiss]; |
| | | |
| | | if (((NSError *)object).code == -1009) { |
| | | |
| | | [CustomProgressHUD showNormal:@"ç½ç»æªè¿æ¥ï¼è¯·æ£æµç½ç»è®¾ç½®"]; |
| | | |
| | | } else { |
| | | |
| | | [CustomProgressHUD showNormal:@"ç½ç»è¿æ¥å¼å¸¸ï¼è¯·æ£æµç½ç»è®¾ç½®"]; |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | } fail:^(id object) { |
| | | |
| | | if (((NSError *)object).code == -1009) { |
| | | |
| | | [CustomProgressHUD showNormal:@"ç½ç»æªè¿æ¥ï¼è¯·æ£æµç½ç»è®¾ç½®"]; |
| | | |
| | | } else { |
| | | |
| | | [CustomProgressHUD showNormal:@"ç½ç»è¿æ¥å¼å¸¸ï¼è¯·æ£æµç½ç»è®¾ç½®"]; |
| | | } |
| | | }]; |
| | | } |
| | | |