修复消息页面部分bug

This commit is contained in:
wbzhan 2019-05-27 16:41:39 +08:00
parent 25c051d5f1
commit 8e027e82c9
16 changed files with 355 additions and 546 deletions

View File

@ -1732,8 +1732,6 @@
886537481E24B70400E3C87F /* explore_new_label@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 886537421E24B70400E3C87F /* explore_new_label@3x.png */; };
88653C9B1E76691E00FF973E /* IfishInformationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88653C9A1E76691E00FF973E /* IfishInformationViewController.m */; };
88653C9E1E76697000FF973E /* IfishInformations.m in Sources */ = {isa = PBXBuildFile; fileRef = 88653C9D1E76697000FF973E /* IfishInformations.m */; };
88653CA21E7671F900FF973E /* MineHeaderNewItemsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 88653CA01E7671F900FF973E /* MineHeaderNewItemsCell.m */; };
88653CA31E7671F900FF973E /* MineHeaderNewItemsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88653CA11E7671F900FF973E /* MineHeaderNewItemsCell.xib */; };
88673AFC1E1E57CB001D5F49 /* RuSunGuiDeng.m in Sources */ = {isa = PBXBuildFile; fileRef = 88673AFB1E1E57CB001D5F49 /* RuSunGuiDeng.m */; };
88673B041E1F6A4F001D5F49 /* SongNuoBDProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 88673B031E1F6A4F001D5F49 /* SongNuoBDProtocol.m */; };
88673B071E1F71DC001D5F49 /* SongNuoDBCenterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88673B061E1F71DC001D5F49 /* SongNuoDBCenterViewController.m */; };
@ -4864,9 +4862,6 @@
88653C9A1E76691E00FF973E /* IfishInformationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IfishInformationViewController.m; sourceTree = "<group>"; };
88653C9C1E76697000FF973E /* IfishInformations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IfishInformations.h; sourceTree = "<group>"; };
88653C9D1E76697000FF973E /* IfishInformations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IfishInformations.m; sourceTree = "<group>"; };
88653C9F1E7671F900FF973E /* MineHeaderNewItemsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MineHeaderNewItemsCell.h; sourceTree = "<group>"; };
88653CA01E7671F900FF973E /* MineHeaderNewItemsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MineHeaderNewItemsCell.m; sourceTree = "<group>"; };
88653CA11E7671F900FF973E /* MineHeaderNewItemsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MineHeaderNewItemsCell.xib; sourceTree = "<group>"; };
88673AF91E1E1C20001D5F49 /* IfishDeviceInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IfishDeviceInfo.h; sourceTree = "<group>"; };
88673AFA1E1E57CB001D5F49 /* RuSunGuiDeng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuSunGuiDeng.h; sourceTree = "<group>"; };
88673AFB1E1E57CB001D5F49 /* RuSunGuiDeng.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RuSunGuiDeng.m; sourceTree = "<group>"; };
@ -9767,9 +9762,6 @@
883E77091D48A5E50030E075 /* leftCell.h */,
883E770A1D48A5E50030E075 /* leftCell.m */,
883E770B1D48A5E50030E075 /* leftCell.xib */,
88653C9F1E7671F900FF973E /* MineHeaderNewItemsCell.h */,
88653CA01E7671F900FF973E /* MineHeaderNewItemsCell.m */,
88653CA11E7671F900FF973E /* MineHeaderNewItemsCell.xib */,
887AD4731E7F95B100009BF2 /* WodeUserAssetCell.h */,
887AD4741E7F95B100009BF2 /* WodeUserAssetCell.m */,
);
@ -13241,7 +13233,6 @@
8814783F1E71398800BFB79C /* signin_popup_obtain.png in Resources */,
88C1B21E1DCC5A1400C2C99A /* personal_iocn_scan@2x.png in Resources */,
883517F51E6664D200FCBE56 /* fishrank_dragonking.png in Resources */,
88653CA31E7671F900FF973E /* MineHeaderNewItemsCell.xib in Resources */,
883E78841D48A5E50030E075 /* ChangeModelDoneController.xib in Resources */,
88C1B2241DCC5A1400C2C99A /* replace_iocn_code@2x.png in Resources */,
882955E31DBDA3A100E9DDD7 /* ic_ifish.png in Resources */,
@ -15119,7 +15110,6 @@
FA0892F62270BED00084A609 /* XuanduoHuliModel.m in Sources */,
3D1C5106221A9EE00096AE43 /* CameraNoParyBackVideoView.m in Sources */,
881671AD1EA5DE2B00BEBF23 /* UMComUserListDataController.m in Sources */,
88653CA21E7671F900FF973E /* MineHeaderNewItemsCell.m in Sources */,
3D1C513E221A9EE10096AE43 /* FishControlSecondCell.m in Sources */,
88597ABF1E56BAF1003D0E5C /* WFCollectionViewCell.m in Sources */,
881671ED1EA5DE2B00BEBF23 /* UMComEditTextView.m in Sources */,
@ -15476,6 +15466,21 @@
TARGETED_DEVICE_FAMILY = 1;
USER_HEADER_SEARCH_PATHS = "";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = (
"-Wno-implicit-retain-self",
"-Wno-objc-missing-super-calls",
"-Wno-shorten-64-to-32",
"-Wno-enum-conversion",
"-Wno-deprecated-declarations",
"-Wno-strict-prototypes",
"-Wno-incomplete-umbrella",
"-Wno-incomplete-implementation",
"-Wno-nonnull",
"-Wno-deprecated-implementations",
"-Wno-incompatible-pointer-types-discards-qualifiers",
"-Wno-nullability-completeness",
"-Wno-format",
);
};
name = Debug;
};
@ -15588,6 +15593,21 @@
TARGETED_DEVICE_FAMILY = 1;
USER_HEADER_SEARCH_PATHS = "";
VERSIONING_SYSTEM = "apple-generic";
WARNING_CFLAGS = (
"-Wno-implicit-retain-self",
"-Wno-objc-missing-super-calls",
"-Wno-shorten-64-to-32",
"-Wno-enum-conversion",
"-Wno-deprecated-declarations",
"-Wno-strict-prototypes",
"-Wno-incomplete-umbrella",
"-Wno-incomplete-implementation",
"-Wno-nonnull",
"-Wno-deprecated-implementations",
"-Wno-incompatible-pointer-types-discards-qualifiers",
"-Wno-nullability-completeness",
"-Wno-format",
);
};
name = Release;
};

View File

@ -124,6 +124,9 @@
+(AppDelegate *)sharedDefault{
dispatch_async(dispatch_get_main_queue(), ^{
});
return (AppDelegate *)[UIApplication sharedApplication].delegate;
}
@ -170,8 +173,6 @@
//
[SMSSDK registerApp:SMSSDK_APPKey withSecret:SMSSDK_APPSec];
[SMSSDK enableAppContactFriends:NO];
/**
* APNS
*/
@ -244,10 +245,11 @@
[self setUpSVProgressHUD];
//appkey
//
[[UMSocialManager defaultManager] openLog:YES];
// if (DEBUG) {
// [[UMSocialManager defaultManager] openLog:YES];
// }
//appkey
[[UMSocialManager defaultManager] setUmSocialAppkey:UMSocial_APPKEY];
//AppIdappSecreturl
//appKeyappSecret
[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wxb3b27d653ec3e3cb" appSecret:@"79d35215d7ef369b927f7cb21a2b8ff6" redirectURL:@"http://mobile.umeng.com/social"];

View File

@ -7,19 +7,19 @@
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, ImagePosition) {
ImagePositionLeft = 0, // 图片在左,文字在右,默认
ImagePositionRight, // 图片在右,文字在左
ImagePositionTop, // 图片在上,文字在下
ImagePositionBottom, // 图片在下,文字在上
};
#define defaultInterval 0.01//默认时间间隔
//typedef NS_ENUM(NSInteger, ImagePosition) {
// ImagePositionLeft = 0, // 图片在左,文字在右,默认
// ImagePositionRight, // 图片在右,文字在左
// ImagePositionTop, // 图片在上,文字在下
// ImagePositionBottom, // 图片在下,文字在上
//};
//#define defaultInterval 0.01//默认时间间隔
@interface UIButton (button)
/**
* eventTimeInterval秒
*/
@property(nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;//响应范围负值为扩大,正值为缩小
@property (nonatomic, assign) NSTimeInterval timeInterval;
- (void)setImagePosition:(ImagePosition)postion spacing:(CGFloat)spacing;//设置图片与文字具体位置与间距
//@property(nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;//响应范围负值为扩大,正值为缩小
//@property (nonatomic, assign) NSTimeInterval timeInterval;
//- (void)setImagePosition:(ImagePosition)postion spacing:(CGFloat)spacing;//设置图片与文字具体位置与间距
@end

View File

@ -10,15 +10,15 @@
#import <objc/runtime.h>
@interface UIButton()
@property (nonatomic, assign) BOOL isIgnoreEvent;
// @property (nonatomic, assign) BOOL isIgnoreEvent;
@end
@implementation UIButton (button)
@dynamic hitTestEdgeInsets;
//@dynamic hitTestEdgeInsets;
static const NSString *KEY_HIT_TEST_EDGE_INSETS = @"HitTestEdgeInsets";
static const char *UIControl_timeInterval = "UIControl_timeInterval";
static const char *UIControl_enventIsIgnoreEvent = "UIControl_enventIsIgnoreEvent";
//static const NSString *KEY_HIT_TEST_EDGE_INSETS = @"HitTestEdgeInsets";
//static const char *UIControl_timeInterval = "UIControl_timeInterval";
//static const char *UIControl_enventIsIgnoreEvent = "UIControl_enventIsIgnoreEvent";
-(instancetype)init{
self = [super init];
@ -31,142 +31,142 @@ static const char *UIControl_enventIsIgnoreEvent = "UIControl_enventIsIgnoreEven
[super setHighlighted:NO];
}
// runtime
- (void)setIsIgnoreEvent:(BOOL)isIgnoreEvent
{
objc_setAssociatedObject(self, UIControl_enventIsIgnoreEvent, @(isIgnoreEvent), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (BOOL)isIgnoreEvent{
return [objc_getAssociatedObject(self, UIControl_enventIsIgnoreEvent) boolValue];
}
- (NSTimeInterval)timeInterval
{
return [objc_getAssociatedObject(self, UIControl_timeInterval) doubleValue];
}
- (void)setTimeInterval:(NSTimeInterval)timeInterval
{
objc_setAssociatedObject(self, UIControl_timeInterval, @(timeInterval), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
+ (void)load
{
// Method Swizzling
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
SEL selA = @selector(sendAction:to:forEvent:);
SEL selB = @selector(after_sendAction:to:forEvent:);
Method methodA = class_getInstanceMethod(self,selA);
Method methodB = class_getInstanceMethod(self, selB);
BOOL isAdd = class_addMethod(self, selA, method_getImplementation(methodB), method_getTypeEncoding(methodB));
if (isAdd) {
class_replaceMethod(self, selB, method_getImplementation(methodA), method_getTypeEncoding(methodA));
}else{
// methodBmethodAmethodBIMP
method_exchangeImplementations(methodA, methodB);
}
});
}
- (void)after_sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event
{
self.timeInterval = self.timeInterval == 0 ? defaultInterval : self.timeInterval;
if (self.isIgnoreEvent){
return;
}else if (self.timeInterval > 0){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.timeInterval * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self setIsIgnoreEvent:NO];
});
}
self.isIgnoreEvent = YES;
// sendAction:to:forEvent:sendAction:to:forEvent:
[self after_sendAction:action to:target forEvent:event];
}
#pragma mark --button
- (void)setImagePosition:(ImagePosition)postion spacing:(CGFloat)spacing
{
// [self setTitle:self.currentTitle forState:UIControlStateNormal];
// [self setImage:self.currentImage forState:UIControlStateNormal];
CGFloat imageWidth = self.imageView.image.size.width;
CGFloat imageHeight = self.imageView.image.size.height;
CGFloat labelWidth = [self.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:self.titleLabel.font}].width;
if (postion == ImagePositionRight && labelWidth >= self.frame.size.width - imageWidth) {
labelWidth = self.frame.size.width - imageWidth;
}
CGFloat labelHeight = [self.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:self.titleLabel.font}].height;
CGFloat imageOffsetX = (imageWidth + labelWidth) / 2 - imageWidth / 2; //imagex
CGFloat imageOffsetY = imageHeight / 2 + spacing / 2; //imagey
CGFloat labelOffsetX = (imageWidth + labelWidth / 2) - (imageWidth + labelWidth) / 2; //labelx
CGFloat labelOffsetY = labelHeight / 2 + spacing / 2; //labely
CGFloat tempWidth = MAX(labelWidth, imageWidth);
CGFloat changedWidth = labelWidth + imageWidth - tempWidth;
CGFloat tempHeight = MAX(labelHeight, imageHeight);
CGFloat changedHeight = labelHeight + imageHeight + spacing - tempHeight;
switch (postion) {
case ImagePositionLeft:
self.imageEdgeInsets = UIEdgeInsetsMake(0, -spacing / 2, 0, spacing / 2);
self.titleEdgeInsets = UIEdgeInsetsMake(0, spacing / 2, 0, -spacing / 2);
self.contentEdgeInsets = UIEdgeInsetsMake(0, spacing / 2, 0, spacing / 2);
break;
case ImagePositionRight:
self.imageEdgeInsets = UIEdgeInsetsMake(0, labelWidth + spacing / 2, 0, -(labelWidth + spacing / 2));
self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageWidth + spacing / 2), 0, imageWidth + spacing / 2);
self.contentEdgeInsets = UIEdgeInsetsMake(0, spacing / 2, 0, spacing / 2);
break;
case ImagePositionTop:
self.imageEdgeInsets = UIEdgeInsetsMake(-imageOffsetY, imageOffsetX, imageOffsetY, -imageOffsetX);
self.titleEdgeInsets = UIEdgeInsetsMake(labelOffsetY, -labelOffsetX, -labelOffsetY, labelOffsetX);
self.contentEdgeInsets = UIEdgeInsetsMake(imageOffsetY, -changedWidth / 2, changedHeight - imageOffsetY, -changedWidth / 2);
break;
case ImagePositionBottom:
self.imageEdgeInsets = UIEdgeInsetsMake(imageOffsetY, imageOffsetX, -imageOffsetY, -imageOffsetX);
self.titleEdgeInsets = UIEdgeInsetsMake(-labelOffsetY, -labelOffsetX, labelOffsetY, labelOffsetX);
self.contentEdgeInsets = UIEdgeInsetsMake(changedHeight - imageOffsetY, -changedWidth / 2, imageOffsetY, -changedWidth / 2);
break;
default:
break;
}
}
-(void)setHitTestEdgeInsets:(UIEdgeInsets)hitTestEdgeInsets
{
NSValue *value = [NSValue value:&hitTestEdgeInsets withObjCType:@encode(UIEdgeInsets)];
objc_setAssociatedObject(self, &KEY_HIT_TEST_EDGE_INSETS, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
-(UIEdgeInsets)hitTestEdgeInsets
{
NSValue *value = objc_getAssociatedObject(self, &KEY_HIT_TEST_EDGE_INSETS);
if(value) {
UIEdgeInsets edgeInsets; [value getValue:&edgeInsets]; return edgeInsets;
}else {
return UIEdgeInsetsZero;
}
}
//
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
if(UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero) || !self.enabled || self.hidden) {
return [super pointInside:point withEvent:event];
}
CGRect relativeFrame = self.bounds;
CGRect hitFrame = UIEdgeInsetsInsetRect(relativeFrame, self.hitTestEdgeInsets);
return CGRectContainsPoint(hitFrame, point);
}
//// runtime
//- (void)setIsIgnoreEvent:(BOOL)isIgnoreEvent
//{
// objc_setAssociatedObject(self, UIControl_enventIsIgnoreEvent, @(isIgnoreEvent), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
//}
//- (BOOL)isIgnoreEvent{
// return [objc_getAssociatedObject(self, UIControl_enventIsIgnoreEvent) boolValue];
//}
//
//- (NSTimeInterval)timeInterval
//{
// return [objc_getAssociatedObject(self, UIControl_timeInterval) doubleValue];
//}
//
//- (void)setTimeInterval:(NSTimeInterval)timeInterval
//{
// objc_setAssociatedObject(self, UIControl_timeInterval, @(timeInterval), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
//}
//
//+ (void)load
//{
// // Method Swizzling
// static dispatch_once_t onceToken;
// dispatch_once(&onceToken, ^{
// SEL selA = @selector(sendAction:to:forEvent:);
// SEL selB = @selector(after_sendAction:to:forEvent:);
// Method methodA = class_getInstanceMethod(self,selA);
// Method methodB = class_getInstanceMethod(self, selB);
//
// BOOL isAdd = class_addMethod(self, selA, method_getImplementation(methodB), method_getTypeEncoding(methodB));
//
// if (isAdd) {
// class_replaceMethod(self, selB, method_getImplementation(methodA), method_getTypeEncoding(methodA));
// }else{
// // methodBmethodAmethodBIMP
// method_exchangeImplementations(methodA, methodB);
// }
// });
//}
//
//- (void)after_sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event
//{
// self.timeInterval = self.timeInterval == 0 ? defaultInterval : self.timeInterval;
// if (self.isIgnoreEvent){
// return;
// }else if (self.timeInterval > 0){
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(self.timeInterval * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self setIsIgnoreEvent:NO];
// });
// }
//
// self.isIgnoreEvent = YES;
// // sendAction:to:forEvent:sendAction:to:forEvent:
// [self after_sendAction:action to:target forEvent:event];
//}
//#pragma mark --button
//- (void)setImagePosition:(ImagePosition)postion spacing:(CGFloat)spacing
//{
//// [self setTitle:self.currentTitle forState:UIControlStateNormal];
//// [self setImage:self.currentImage forState:UIControlStateNormal];
//
// CGFloat imageWidth = self.imageView.image.size.width;
// CGFloat imageHeight = self.imageView.image.size.height;
// CGFloat labelWidth = [self.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:self.titleLabel.font}].width;
//
// if (postion == ImagePositionRight && labelWidth >= self.frame.size.width - imageWidth) {
// labelWidth = self.frame.size.width - imageWidth;
// }
//
// CGFloat labelHeight = [self.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:self.titleLabel.font}].height;
//
// CGFloat imageOffsetX = (imageWidth + labelWidth) / 2 - imageWidth / 2; //imagex
// CGFloat imageOffsetY = imageHeight / 2 + spacing / 2; //imagey
// CGFloat labelOffsetX = (imageWidth + labelWidth / 2) - (imageWidth + labelWidth) / 2; //labelx
// CGFloat labelOffsetY = labelHeight / 2 + spacing / 2; //labely
//
// CGFloat tempWidth = MAX(labelWidth, imageWidth);
// CGFloat changedWidth = labelWidth + imageWidth - tempWidth;
// CGFloat tempHeight = MAX(labelHeight, imageHeight);
// CGFloat changedHeight = labelHeight + imageHeight + spacing - tempHeight;
//
// switch (postion) {
// case ImagePositionLeft:
// self.imageEdgeInsets = UIEdgeInsetsMake(0, -spacing / 2, 0, spacing / 2);
// self.titleEdgeInsets = UIEdgeInsetsMake(0, spacing / 2, 0, -spacing / 2);
// self.contentEdgeInsets = UIEdgeInsetsMake(0, spacing / 2, 0, spacing / 2);
// break;
//
// case ImagePositionRight:
// self.imageEdgeInsets = UIEdgeInsetsMake(0, labelWidth + spacing / 2, 0, -(labelWidth + spacing / 2));
// self.titleEdgeInsets = UIEdgeInsetsMake(0, -(imageWidth + spacing / 2), 0, imageWidth + spacing / 2);
// self.contentEdgeInsets = UIEdgeInsetsMake(0, spacing / 2, 0, spacing / 2);
// break;
//
// case ImagePositionTop:
// self.imageEdgeInsets = UIEdgeInsetsMake(-imageOffsetY, imageOffsetX, imageOffsetY, -imageOffsetX);
// self.titleEdgeInsets = UIEdgeInsetsMake(labelOffsetY, -labelOffsetX, -labelOffsetY, labelOffsetX);
// self.contentEdgeInsets = UIEdgeInsetsMake(imageOffsetY, -changedWidth / 2, changedHeight - imageOffsetY, -changedWidth / 2);
// break;
//
// case ImagePositionBottom:
// self.imageEdgeInsets = UIEdgeInsetsMake(imageOffsetY, imageOffsetX, -imageOffsetY, -imageOffsetX);
// self.titleEdgeInsets = UIEdgeInsetsMake(-labelOffsetY, -labelOffsetX, labelOffsetY, labelOffsetX);
// self.contentEdgeInsets = UIEdgeInsetsMake(changedHeight - imageOffsetY, -changedWidth / 2, imageOffsetY, -changedWidth / 2);
// break;
//
// default:
// break;
// }
//}
//
//-(void)setHitTestEdgeInsets:(UIEdgeInsets)hitTestEdgeInsets
//{
// NSValue *value = [NSValue value:&hitTestEdgeInsets withObjCType:@encode(UIEdgeInsets)];
// objc_setAssociatedObject(self, &KEY_HIT_TEST_EDGE_INSETS, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
//}
//
//-(UIEdgeInsets)hitTestEdgeInsets
//{
// NSValue *value = objc_getAssociatedObject(self, &KEY_HIT_TEST_EDGE_INSETS);
// if(value) {
// UIEdgeInsets edgeInsets; [value getValue:&edgeInsets]; return edgeInsets;
// }else {
// return UIEdgeInsetsZero;
// }
//}
////
//- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
//{
// if(UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero) || !self.enabled || self.hidden) {
// return [super pointInside:point withEvent:event];
// }
//
// CGRect relativeFrame = self.bounds;
// CGRect hitFrame = UIEdgeInsetsInsetRect(relativeFrame, self.hitTestEdgeInsets);
//
// return CGRectContainsPoint(hitFrame, point);
//}
@end

View File

@ -190,8 +190,10 @@ static const void *NotificationCenterKey = &NotificationCenterKey;
#pragma mark SDK Init
- (void)registerAliPush {
// 线
[CloudPushSDK turnOnDebug];
// // 线
// if (DEBUG) {
// [CloudPushSDK turnOnDebug];
// }
// SDK
[CloudPushSDK asyncInit:Ali_Push_APPKey appSecret:Ali_Push_APPSecret callback:^(CloudPushCallbackResult *res) {
if (res.success) {

View File

@ -70,7 +70,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.8</string>
<string>9.8.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>

View File

@ -33,10 +33,13 @@
@return <#return value description#>
*/
#define Push_Message_Url Api_DomainName @"/api/pageList/pushListInf.do"
//删除消息
#define Push_Message_Delete_Url Api_DomainName @"/api/updateUser/deleteMessages.do"
//绑定设备
#define Push_BindDevice_Url Api_DomainName @"/api/updateUser/bindDevice.do"
//用户消息已读
#define Push_Message_Readed Api_DomainName @"/api/updateUser/userMessageIsRead.do"
//用户未读消息个数
#define Push_Message_UnReadCount Api_DomainName @"/api/updateUser/userMessageNoReadCount.do"
#endif /* UrlAdress_h */

View File

@ -44,7 +44,6 @@
#import "IfishUserObsever.h"
#import "QianDaoGiftView.h"
#import "IfishGoldAndExpTostView.h"
//#import "MineHeaderNewItemsCell.h"
#import "IfishMineGoldViewController.h"
#import "IifshMineDJViewController.h"
#import "WoDeRenWuViewController.h"

View File

@ -1,27 +0,0 @@
//
// MineHeaderNewItemsCell.h
// Ifish
//
// Created by imac on 17/3/13.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol MineHeaderItemsDelegate <NSObject>
-(void)tapDengjiAction;
-(void)tapGoldAction;
-(void)tapRenWuAction;
@end
@interface MineHeaderNewItemsCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *levlellabel;
@property (weak, nonatomic) IBOutlet UILabel *goldLabel;
@property (weak, nonatomic) IBOutlet UILabel *taskNumber;
@property (weak, nonatomic) IBOutlet UILabel *dengJi;
@property (weak, nonatomic) IBOutlet UILabel *jinBi;
@property (weak, nonatomic) IBOutlet UILabel *renWu;
@property (nonatomic,assign) id<MineHeaderItemsDelegate> itemsDelegate;
-(void)loadCellData;
@property (nonatomic,strong) UIView *redpontView;
@end

View File

@ -1,113 +0,0 @@
//
// MineHeaderNewItemsCell.m
// Ifish
//
// Created by imac on 17/3/13.
// Copyright © 2017 lianlian. All rights reserved.
//
#import "MineHeaderNewItemsCell.h"
@implementation MineHeaderNewItemsCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
UITapGestureRecognizer *tapDengji=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dengjiAction)];
UITapGestureRecognizer *tapDengji2=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dengjiAction2)];
[self.dengJi addGestureRecognizer:tapDengji];
[self.levlellabel addGestureRecognizer:tapDengji2];
UITapGestureRecognizer *tapgold=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGoldAction)];
[self.goldLabel addGestureRecognizer:tapgold];
UITapGestureRecognizer *tapgold2=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGoldAction2)];
[self.jinBi addGestureRecognizer:tapgold2];
UITapGestureRecognizer *tapRenWu=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRenWuAction)];
UITapGestureRecognizer *tapRenWu2=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRenWuAction2)];
[self.renWu addGestureRecognizer:tapRenWu];
[self.taskNumber addGestureRecognizer:tapRenWu2];
}
-(void)layoutSubviews{
if (!self.redpontView) {
self.redpontView = [[UIView alloc] init];
NSString *renwu= @"我的任务";
CGSize size = [renwu sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}];
self.redpontView.frame = CGRectMake(CGRectGetWidth(self.renWu.frame)/2 + size.width/2, 4, 8, 8);
self.redpontView.backgroundColor = RGB(252, 89, 89);
self.redpontView.layer.masksToBounds = YES;
self.redpontView.layer.cornerRadius = 4.0;
[self addSubview:self.redpontView];
[self.renWu bringSubviewToFront:self.redpontView];
}
}
-(void)loadCellData{
IfishUserAsset *userAsset =[dataContorl getAllIfishUserAsset];
self.levlellabel.text = [NSString stringWithFormat:@"LV%@",userAsset.gradeNum];
self.goldLabel.text = [NSString stringWithFormat:@"%ld",(long)userAsset.goldValue];
NSInteger undoneCount = [IfishHelperUtils getUnDoneTaskCount];
self.taskNumber.text = [NSString stringWithFormat:@"%ld",undoneCount];
self.redpontView.hidden = undoneCount ==0? YES : NO;
if (undoneCount==0) {
[[NSNotificationCenter defaultCenter] postNotificationName:IFISHTASK_HAVEDONEALL object:nil];
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)dengjiAction
{
if (self.itemsDelegate) {
[self.itemsDelegate tapDengjiAction];
}
}
-(void)dengjiAction2
{
if (self.itemsDelegate) {
[self.itemsDelegate tapDengjiAction];
}
}
-(void)tapGoldAction
{
if (self.itemsDelegate) {
[self.itemsDelegate tapGoldAction];
}
}
-(void)tapGoldAction2
{
if (self.itemsDelegate) {
[self.itemsDelegate tapGoldAction];
}
}
-(void)tapRenWuAction
{
if (self.itemsDelegate) {
[self.itemsDelegate tapRenWuAction];
}
}
-(void)tapRenWuAction2
{
if (self.itemsDelegate) {
[self.itemsDelegate tapRenWuAction];
}
}
@end

View File

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="MineHeaderNewItemsCell" id="KGk-i7-Jjw" customClass="MineHeaderNewItemsCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="59.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="等级" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O45-QR-cHa">
<rect key="frame" x="21" y="0.0" width="82" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9wv-Em-ymJ">
<rect key="frame" x="8" y="29" width="108" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.9882352941176471" green="0.85098039215686272" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="277777" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YNL-Tj-AKG">
<rect key="frame" x="134" y="29" width="105" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.98823529409999999" green="0.85098039219999999" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UFF-ah-s4k">
<rect key="frame" x="257" y="29" width="110" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.98823529409999999" green="0.85098039219999999" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lAB-ez-ZeT">
<rect key="frame" x="124" y="13" width="2" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.047058823529411764" green="0.46274509803921571" blue="0.85098039215686272" alpha="0.69555004222972971" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uhm-GO-5Ke">
<rect key="frame" x="247" y="13" width="2" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.047058823530000002" green="0.46274509800000002" blue="0.85098039219999999" alpha="0.69555004220000005" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="我的任务" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hah-cc-Hgz">
<rect key="frame" x="271" y="0.0" width="82" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.98823529409999999" green="0.85098039219999999" blue="0.36862745099999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="金币" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="B6H-GU-HKz">
<rect key="frame" x="134" y="0.0" width="105" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
<color key="backgroundColor" red="0.039215686270000001" green="0.41960784309999999" blue="0.7725490196" alpha="1" colorSpace="calibratedRGB"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
<connections>
<outlet property="dengJi" destination="O45-QR-cHa" id="LfW-VK-4g0"/>
<outlet property="goldLabel" destination="YNL-Tj-AKG" id="ogk-kt-ySC"/>
<outlet property="jinBi" destination="B6H-GU-HKz" id="CS2-5L-R8c"/>
<outlet property="levlellabel" destination="9wv-Em-ymJ" id="bTK-L1-Xe0"/>
<outlet property="renWu" destination="Hah-cc-Hgz" id="gtx-WH-xHK"/>
<outlet property="taskNumber" destination="UFF-ah-s4k" id="DPn-Bh-Vxz"/>
</connections>
<point key="canvasLocation" x="25.5" y="52"/>
</tableViewCell>
</objects>
</document>

View File

@ -17,6 +17,7 @@ Strong UIButton *bgBtn;
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self loadSubViews];
}
return self;
@ -159,6 +160,8 @@ Strong UIButton *bgBtn;
self.bgBtn.selected = YES;
}else
{
self.bgBtn.selected = NO;
self.deleteBtn.selected = NO;
self.deleteBtn.hidden = !isShowDelte;
self.bgBtn.hidden = !isShowDelte;
}

View File

@ -55,7 +55,9 @@ Assign BOOL isShowDelete;//是否显示删除按钮
Strong MessageAlertView *comboxView;
Strong UIView *deleteView;
Strong UIButton *deleteBtn;
Strong UIAlertController *alertController;
Strong UIAlertAction *okAction;
Strong UIAlertAction *cancelAction;
@end
extern BOOL launchedByNotification;
@implementation IfishMessageViewController
@ -157,23 +159,24 @@ extern BOOL launchedByNotification;
[self.deleteBtn setTitleColor:RGB(178, 178, 178) forState:UIControlStateNormal];
[self.deleteBtn setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
[self.deleteBtn addTarget:self action:@selector(deleBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_deleteView addSubview:self.deleteBtn];
[self.deleteView addSubview:self.deleteBtn];
UIButton *allDeleteBtn = InitObject(UIButton);
[allDeleteBtn setTitle:@"全选" forState:UIControlStateNormal];
[allDeleteBtn setTitle:@"取消" forState:UIControlStateSelected];
[allDeleteBtn.titleLabel setFont:SYSTEMSIZE(34)];
[allDeleteBtn setTitleColor:RGB(4, 99, 201) forState:UIControlStateNormal];
[allDeleteBtn addTarget:self action:@selector(allDeleteBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[_deleteView addSubview:allDeleteBtn];
[self.deleteView addSubview:allDeleteBtn];
[self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.deleteView);
make.left.mas_equalTo(0);
make.width.mas_equalTo(screen_width/2);
make.height.mas_equalTo(self.deleteView);
make.top.height.mas_equalTo(self.deleteView);
}];
[allDeleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(self.deleteBtn);
make.top.width.height.mas_equalTo(self.deleteBtn);
make.left.mas_equalTo(self.deleteBtn.mas_right);
}];
@ -185,9 +188,7 @@ extern BOOL launchedByNotification;
make.left.mas_equalTo(kSizeFrom750(30));
make.right.mas_equalTo(-kSizeFrom750(30));
make.height.mas_equalTo(ONE_PIXEL_SIZE);
}];
}
#pragma mark --buttonClick
-(void)deleBtnClick:(UIButton *)sender{
@ -196,7 +197,7 @@ extern BOOL launchedByNotification;
[SVProgressHUD showInfoWithStatus:@"请先选择要删除的消息"];
}else{
//
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确认删除选中消息么" preferredStyle:UIAlertControllerStyleAlert];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确认删除所有选中消息么" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"cancel Action");
}];
@ -210,16 +211,22 @@ extern BOOL launchedByNotification;
}
}
-(void)allDeleteBtnClick:(UIButton *)sender{
//
self.isDelteAll = YES;
self.deleteBtn.selected = YES;
[self.deleteArray removeAllObjects];
for (NSArray *arr in self.dataSource) {
for (PushmessageModel *model in arr) {
[self.deleteArray addObject:model.pushId];
if (!sender.selected) {//
//
self.isDelteAll = YES;
self.deleteBtn.selected = YES;
[self.deleteArray removeAllObjects];
for (NSArray *arr in self.dataSource) {
for (PushmessageModel *model in arr) {
[self.deleteArray addObject:model.pushId];
}
}
}else{//
[self.deleteArray removeAllObjects];
self.isDelteAll = NO;
self.deleteBtn.selected = NO;
}
sender.selected = !sender.selected;
[self.tableView reloadData];
}
#pragma mark --comboxView
@ -259,20 +266,7 @@ extern BOOL launchedByNotification;
-(void)getRequest
{
[SVProgressHUD show];
NSDictionary *resalutDic = [CommonUtils getCacheDataWithKey:Cache_Message];
if (resalutDic==nil) {
self.pushId = @"";
}else{
NSArray *dataArray = [resalutDic objectForKey:@"data"];
PushmessageModel *model = [PushmessageModel yy_modelWithJSON:dataArray.firstObject];
self.pushId = model.pushId;
for (int i=0; i<dataArray.count; i++) {
PushmessageModel *cacheModel = [PushmessageModel yy_modelWithJSON:[dataArray objectAtIndex:i]];
[cacheModel getCellHeight];
[self.oldMessageArr addObject:cacheModel];
}
}
self.pushId = @"";
UserModel*userModel=[dataContorl getUserInfo];
NSDictionary *reqDic = @{@"pushId":self.pushId,
@"userId":userModel.userId,
@ -284,28 +278,21 @@ extern BOOL launchedByNotification;
NSString *totalCount = [successDic objectForKey:@"total"];
NSArray *dataArray = [successDic objectForKey:@"data"];
if ([totalCount integerValue]>0) {
//
NSDictionary *resalutDic = [CommonUtils getCacheDataWithKey:Cache_Message];
if (resalutDic!=nil) {
//
NSArray *cacheDataArray = [resalutDic objectForKey:@"data"];
//
NSMutableArray *newDataArray = [NSMutableArray arrayWithArray:dataArray];
[newDataArray addObjectsFromArray:cacheDataArray];
NSMutableDictionary *newDic = InitObject(NSMutableDictionary);
[newDic setObject:newDataArray forKey:@"data"];
[CommonUtils SetCacheDataWithObject:newDic WithPathName:Cache_Message];
}else{
[CommonUtils SetCacheDataWithObject:successDic WithPathName:Cache_Message];
}
NSMutableArray *newMessageArray = InitObject(NSMutableArray);
NSMutableArray *oldMessageArray = InitObject(NSMutableArray);
for (int i=0; i<dataArray.count; i++) {
PushmessageModel *cacheModel = [PushmessageModel yy_modelWithJSON:[dataArray objectAtIndex:i]];
[cacheModel getCellHeight];
[self.messageArray addObject:cacheModel];
PushmessageModel *messageModel = [PushmessageModel yy_modelWithJSON:[dataArray objectAtIndex:i]];
[messageModel getCellHeight];
if ([messageModel.isRead integerValue]==1) {//
[newMessageArray addObject:messageModel];
}else{
[oldMessageArray addObject:messageModel];
}
}
[self.dataSource addObject:newMessageArray];
[self.dataSource addObject:oldMessageArray];
}
[self.dataSource addObject:self.messageArray];
[self.dataSource addObject:self.oldMessageArr];
[self.tableView reloadData];
@ -314,7 +301,63 @@ extern BOOL launchedByNotification;
}];
}
//
//
-(void)postReadMessageRequestWithIndexPath:(NSIndexPath *)indexPath{
UserModel*userModel=[dataContorl getUserInfo];
PushmessageModel *model = [[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
if([model.isRead integerValue]==1)//
{
NSMutableDictionary *deleteDic = InitObject(NSMutableDictionary);
[deleteDic setValue:model.pushId forKey:@"pushId"];
NSDictionary *reqDic = @{@"userId":userModel.userId,
@"pushId":model.pushId
};
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_Readed params:reqDic success:^(NSDictionary *successDic) {
NSString *result = [successDic objectForKey:RESPONSE_CODE];
if ([result integerValue]==kReqSuccess) {
//
}else{
}
} failure:^(NSDictionary *errorDic) {
}];
}
}
//
-(void)deleteSingleMessageWithIndex:(NSIndexPath *)indexPath{
UserModel*userModel=[dataContorl getUserInfo];
PushmessageModel *model = [[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
NSMutableDictionary *deleteDic = InitObject(NSMutableDictionary);
[deleteDic setValue:model.pushId forKey:@"pushId"];
NSDictionary *reqDic = @{@"userId":userModel.userId,
@"pushIds":[CommonUtils arrayToJSONString:@[deleteDic]]
};
[SVProgressHUD show];
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_Delete_Url params:reqDic success:^(NSDictionary *successDic) {
NSString *result = [successDic objectForKey:RESPONSE_CODE];
if ([result integerValue]==kReqSuccess) {
[[self.dataSource objectAtIndex:indexPath.section] removeObjectAtIndex:indexPath.row];
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
// //
// [self.tableView reloadData];
// [self.tableView scrollsToTop];
}else{
[SVProgressHUD showInfoWithStatus:@"删除失败"];
}
} failure:^(NSDictionary *errorDic) {
[SVProgressHUD showInfoWithStatus:@"删除失败"];
// self.deleteBtn.selected = NO;
// [self.deleteView setHidden:YES];
// [self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.bottom.mas_equalTo(self.view);
// }];
}];
}
//()
-(void)deleteMessage{
UserModel*userModel=[dataContorl getUserInfo];
NSMutableArray *deleteArray = InitObject(NSMutableArray);
@ -333,43 +376,19 @@ extern BOOL launchedByNotification;
NSString *result = [successDic objectForKey:RESPONSE_CODE];
if ([result integerValue]==kReqSuccess) {
self.deleteBtn.selected = NO;
NSDictionary *cacheDic = [CommonUtils getCacheDataWithKey:Cache_Message];
NSArray *cacheArray = [cacheDic objectForKey:@"data"];
NSMutableArray *newCacheArray = InitObject(NSMutableArray);
//
for (int i=0; i<cacheArray.count; i++) {
NSDictionary *dic = [cacheArray objectAtIndex:i];
NSString *cachePushId =[NSString stringWithFormat:@"%@",[dic objectForKey:@"pushId"]];
if ([self.deleteArray containsObject:cachePushId]) {
}else{
[newCacheArray addObject:dic];
for (int i=0;i< self.dataSource.count;i++) {
NSArray *arr = [self.dataSource objectAtIndex:i];
NSMutableArray *newArray = InitObject(NSMutableArray);
for (int j=0; j<arr.count; j++) {
PushmessageModel *model = [arr objectAtIndex:j];
if ([self.deleteArray containsObject:model.pushId]) {
}else{
[newArray addObject:model];
}
}
[self.dataSource setObject:newArray atIndexedSubscript:i];
}
[self.dataSource removeAllObjects];
NSMutableArray *newArray = InitObject(NSMutableArray);
NSMutableArray *oldArray = InitObject(NSMutableArray);
//
for (int i=0; i<self.messageArray.count; i++) {
PushmessageModel *model = [self.messageArray objectAtIndex:i];
if ([self.deleteArray containsObject:model.pushId]) {
}else{
[newArray addObject:model];
}
}
//
for (int i=0; i<self.oldMessageArr.count; i++) {
PushmessageModel *model = [self.oldMessageArr objectAtIndex:i];
if ([self.deleteArray containsObject:model.pushId]) {
}else{
[oldArray addObject:model];
}
}
[self.dataSource addObject:newArray];
[self.dataSource addObject:oldArray];
[CommonUtils SetCacheDataWithObject:[NSDictionary dictionaryWithObjectsAndKeys:newCacheArray,@"data", nil] WithPathName:Cache_Message];
//
[self.deleteArray removeAllObjects];
self.isDelteAll = NO;
@ -498,25 +517,24 @@ extern BOOL launchedByNotification;
//
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
// [tableView deselectRowAtIndexPath:indexPath animated:YES];
[self.deleteArray removeAllObjects];
[self.deleteView setHidden:YES];
[self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.view);
}];
PushmessageModel *model = [[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
[self.deleteArray addObject:model.pushId];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确认删除该消息么" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"cancel Action");
}];
UIAlertAction *delteActicon = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"delete Action");
[self deleteMessage];
}];
[alertController addAction:cancelAction];
[alertController addAction:delteActicon];
[self presentViewController:alertController animated:YES completion:nil];
dispatch_async(dispatch_get_main_queue(), ^{
[self postReadMessageRequestWithIndexPath:indexPath];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确认删除该消息么" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"cancel Action");
}];
WEAK_SELF;
UIAlertAction *delteActicon = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[weakSelf deleteSingleMessageWithIndex:indexPath];
}];
[alertController addAction:cancelAction];
[alertController addAction:delteActicon];
[weakSelf presentViewController:alertController animated:YES completion:nil];
});
}
-(void)viewWillAppear:(BOOL)animated{

View File

@ -21,6 +21,8 @@
Copy NSString *phoneType;
//推送类型
Copy NSString *jpushStatus;
Copy NSString *isRead;//1、未读 0 已读
//创建时间
@property(nonatomic,copy) NSString *createTime;
//设备id

View File

@ -118,7 +118,6 @@ Assign NSInteger messageCount;//消息个数
//dispatch_queue_t queue = dispatch_queue_create("com.privateQueue",NULL);
dispatch_async(dispatch_get_main_queue(), ^{
[self getMessageData];
[self getMoreUserData];
[self initBannerData];
[self loadGoodsData];
@ -136,34 +135,23 @@ Assign NSInteger messageCount;//消息个数
}
-(void)getMessageData{
//
-(void)getMessageCount{
NSDictionary *resalutDic = [CommonUtils getCacheDataWithKey:Cache_Message];
NSString *pushId = @"";
if (resalutDic==nil) {
pushId = @"";
}else{
NSArray *dataArray = [resalutDic objectForKey:@"data"];
PushmessageModel *model = [PushmessageModel yy_modelWithJSON:dataArray.firstObject];
pushId = model.pushId;
}
UserModel*userModel=[dataContorl getUserInfo];
NSDictionary *reqDic = @{@"pushId":pushId,
@"userId":userModel.userId,
@"firstResult":@(0),
@"pageSize":@(999)
NSDictionary *reqDic = @{@"userId":userModel.userId
};
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_Url params:reqDic success:^(NSDictionary *successDic) {
[[AFNOHeaderHttpTool sharedInstance] postRequestWihtUrl:Push_Message_UnReadCount params:reqDic success:^(NSDictionary *successDic) {
NSString *totalCount = [successDic objectForKey:@"total"];
if ([totalCount integerValue]>0) {
//
self.messageCount = [totalCount integerValue];
[self setRedViewData];
}else{
NSString *result = [successDic objectForKey:RESPONSE_CODE];
NSDictionary *dic = [successDic objectForKey:RESPONSE_DATA];
if ([result integerValue]==kReqSuccess) {
NSString *count = [dic objectForKey:@"messageNoReadCount"];
self.messageCount = [count integerValue];
}
[self setRedViewData];
} failure:^(NSDictionary *errorDic) {
}];
@ -605,7 +593,7 @@ Assign NSInteger messageCount;//消息个数
_mesglabel.textAlignment = NSTextAlignmentCenter;
_mesglabel.backgroundColor = [UIColor redColor];
[navMeaasageBtn addSubview:_mesglabel];
_mesglabel.font = [UIFont boldSystemFontOfSize:10];
_mesglabel.font = [UIFont systemFontOfSize:10];
// [self setRedViewData];
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
@ -623,8 +611,10 @@ Assign NSInteger messageCount;//消息个数
-(void)setRedViewData{
// NSInteger count = [[[NIMSDK sharedSDK] conversationManager] allUnreadCount];
if (self.messageCount> 0) {
if(self.messageCount>=100){
_mesglabel.frame = RECT(self.mesglabel.frame.origin.x, self.mesglabel.frame.origin.y, 24, 16);
}
_mesglabel.text = [NSString stringWithFormat:@"%ld",(long)self.messageCount];
_mesglabel.hidden = NO;
}else{
@ -723,14 +713,15 @@ Assign NSInteger messageCount;//消息个数
[super viewWillAppear:animated];
self.navigationController.navigationBar.translucent = YES;
//
[self.navigationController
.navigationBar setClearNav];
[self.navigationController.navigationBar setClearNav];
[self scrollViewDidScroll:self.tableView];
//
//[self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
[self refreshUI];
//
[self setRedViewData];
[self getMessageCount];
}
-(void)refreshUI{
@ -1067,6 +1058,7 @@ Assign NSInteger messageCount;//消息个数
CGFloat rowH=TabContentHeaght*0.068;
UIView*view=[[UIView alloc] initWithFrame:CGRectMake(0,0, kScreenSize.width, rowH)];
view.userInteractionEnabled = YES;
view.backgroundColor = [UIColor whiteColor];
CGFloat Space =kScreenSize.width*0.063;
CGFloat ImgW =kScreenSize.width*0.056;
@ -1079,18 +1071,12 @@ Assign NSInteger messageCount;//消息个数
UIButton *addbtn =[UIButton buttonWithType:UIButtonTypeCustom];
CGFloat Space2 =kScreenSize.width*0.031;
addbtn.frame = CGRectMake(CGRectGetMaxX(headImg.frame) + Space2 -3,1,200,rowH -2);
NSDictionary *attributes=@{ NSFontAttributeName:[UIFont systemFontOfSize:15],
NSForegroundColorAttributeName:[UIColor colorWithRed:153.0/255.0 green:153.0/255.0 blue:153.0/255.0 alpha:1] ,
};
NSAttributedString *str= [[NSAttributedString alloc] initWithString:@"添加设备" attributes:attributes];
[addbtn setAttributedTitle:str forState:UIControlStateNormal];
[addbtn setTitleColor:RGB(153, 153, 153) forState:UIControlStateNormal];
[addbtn.titleLabel setFont:[UIFont systemFontOfSize:15]];
[addbtn setTitle:@"添加设备" forState:UIControlStateNormal];
addbtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
//[addbtn setBackgroundColor:[UIColor redColor]];
[addbtn addTarget:self action:@selector(addBtnAction) forControlEvents:UIControlEventTouchUpInside];
[addbtn addTarget:self action:@selector(addBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:addbtn];
return view;
@ -1111,7 +1097,7 @@ Assign NSInteger messageCount;//消息个数
#pragma mark-
-(void)addBtnAction{
-(void)addBtnAction:(UIButton *)sender{
[self pushWiFiConnectVC];

View File

@ -23,6 +23,7 @@
[aCoder encodeObject:self forKey:@"shopsUserId"];
[aCoder encodeObject:self forKey:@"userType"];
[aCoder encodeObject:self forKey:@"neteaseToken"];
[aCoder encodeObject:self forKey:@"messageIsRead"];
}
//
@ -41,6 +42,8 @@
self.shopsUserId = [aDecoder decodeObjectForKey:@"shopsUserId"];
self.userType = [aDecoder decodeObjectForKey:@"userType"];
self.neteaseToken = [aDecoder decodeObjectForKey:@"neteaseToken"];
self.messageIsRead = [aDecoder decodeObjectForKey:@"messageIsRead"];
}
return self;
}
@ -60,7 +63,7 @@
_shopsUserId = [dict objectForKey:@"shopsUserId"];
_userType = [dict objectForKey:@"userType"];
_neteaseToken = [dict objectForKey:@"neteaseToken"];
_messageIsRead = [dict objectForKey:@"messageIsRead"];
}
return self;
}