refresh
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
||||||
BuildableName = "Tinju55.app"
|
BuildableName = "TESTAPP.app"
|
||||||
BlueprintName = "ShenQi"
|
BlueprintName = "ShenQi"
|
||||||
ReferencedContainer = "container:ShenQi.xcodeproj">
|
ReferencedContainer = "container:ShenQi.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
||||||
BuildableName = "Tinju55.app"
|
BuildableName = "TESTAPP.app"
|
||||||
BlueprintName = "ShenQi"
|
BlueprintName = "ShenQi"
|
||||||
ReferencedContainer = "container:ShenQi.xcodeproj">
|
ReferencedContainer = "container:ShenQi.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
||||||
BuildableName = "Tinju55.app"
|
BuildableName = "TESTAPP.app"
|
||||||
BlueprintName = "ShenQi"
|
BlueprintName = "ShenQi"
|
||||||
ReferencedContainer = "container:ShenQi.xcodeproj">
|
ReferencedContainer = "container:ShenQi.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
||||||
BuildableName = "Tinju55.app"
|
BuildableName = "TESTAPP.app"
|
||||||
BlueprintName = "ShenQi"
|
BlueprintName = "ShenQi"
|
||||||
ReferencedContainer = "container:ShenQi.xcodeproj">
|
ReferencedContainer = "container:ShenQi.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</Testables>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Release"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
||||||
BuildableName = "Tinju55.app"
|
BuildableName = "TESTAPP.app"
|
||||||
BlueprintName = "ShenQi"
|
BlueprintName = "ShenQi"
|
||||||
ReferencedContainer = "container:ShenQi.xcodeproj">
|
ReferencedContainer = "container:ShenQi.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
BlueprintIdentifier = "20B61C7729DC008500CE7946"
|
||||||
BuildableName = "Tinju55.app"
|
BuildableName = "TESTAPP.app"
|
||||||
BlueprintName = "ShenQi"
|
BlueprintName = "ShenQi"
|
||||||
ReferencedContainer = "container:ShenQi.xcodeproj">
|
ReferencedContainer = "container:ShenQi.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
|
|||||||
Binary file not shown.
@@ -21,6 +21,7 @@
|
|||||||
#import "MainOldViewController.h"
|
#import "MainOldViewController.h"
|
||||||
|
|
||||||
#import "LaunchViewController.h"
|
#import "LaunchViewController.h"
|
||||||
|
#import "NotiCenterViewController.h"
|
||||||
|
|
||||||
@interface AppDelegate () <FIRMessagingDelegate,UNUserNotificationCenterDelegate>
|
@interface AppDelegate () <FIRMessagingDelegate,UNUserNotificationCenterDelegate>
|
||||||
|
|
||||||
@@ -223,6 +224,11 @@
|
|||||||
NSString *jumpUrl = [messageNotiDic objectForKey:@"jumpUrl"];
|
NSString *jumpUrl = [messageNotiDic objectForKey:@"jumpUrl"];
|
||||||
NSInteger pushId = [[messageNotiDic objectForKey:@"pushId"] longValue];
|
NSInteger pushId = [[messageNotiDic objectForKey:@"pushId"] longValue];
|
||||||
|
|
||||||
|
NotiCenterViewController *notiCenterViewController = [[NotiCenterViewController alloc] initWithNibName:@"NotiCenterViewController" bundle:nil];
|
||||||
|
notiCenterViewController.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||||
|
notiCenterViewController.pushId = pushId;
|
||||||
|
[self.window.rootViewController presentViewController:notiCenterViewController animated:NO completion:nil];
|
||||||
|
|
||||||
// 上传点击 pushId
|
// 上传点击 pushId
|
||||||
if (pushId > 0) {
|
if (pushId > 0) {
|
||||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:PushStatisticsURL]];
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:PushStatisticsURL]];
|
||||||
@@ -238,6 +244,7 @@
|
|||||||
}];
|
}];
|
||||||
[dataTask resume];
|
[dataTask resume];
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (type == 2 && !ISNULLSTR(image)) {
|
if (type == 2 && !ISNULLSTR(image)) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
NSURL *url = [NSURL URLWithString:image];
|
NSURL *url = [NSURL URLWithString:image];
|
||||||
@@ -266,6 +273,7 @@
|
|||||||
[self.window.rootViewController presentViewController:view animated:YES completion:^{}];
|
[self.window.rootViewController presentViewController:view animated:YES completion:^{}];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
NSURL *url = [NSURL URLWithString:self.list.image];
|
NSURL *url = [NSURL URLWithString:self.list.image];
|
||||||
self.contentLabel.text = self.list.content;
|
self.contentLabel.text = self.list.content;
|
||||||
self.imageHeightConstraint.constant = self.list.imageHeight;
|
self.imageHeightConstraint.constant = self.list.imageHeight;
|
||||||
[self.contentImageView sd_setImageWithURL:url];
|
[self.contentImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanwei"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
}
|
}
|
||||||
UIFont *textFont = [UIFont boldSystemFontOfSize:15];
|
UIFont *textFont = [UIFont boldSystemFontOfSize:15];
|
||||||
CGFloat width = [self.typeLabel.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 30) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: textFont} context:nil].size.width;
|
CGFloat width = [self.typeLabel.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 30) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: textFont} context:nil].size.width;
|
||||||
self.widthConstraint.constant = width+20;
|
self.widthConstraint.constant = width+10;
|
||||||
self.dateLabel.text = self.list.createTime;
|
self.dateLabel.text = self.list.createTime;
|
||||||
self.titleLabel.text = self.list.title;
|
self.titleLabel.text = self.list.title;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface NotiCenterViewController : UIViewController
|
@interface NotiCenterViewController : UIViewController
|
||||||
|
|
||||||
|
@property (nonatomic, assign) NSInteger pushId;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#import <SDWebImage.h>
|
#import <SDWebImage.h>
|
||||||
#import "DataModels.h"
|
#import "DataModels.h"
|
||||||
#import "UIButton+DSButtonBlock.h"
|
#import "UIButton+DSButtonBlock.h"
|
||||||
|
#import <MJRefresh.h>
|
||||||
|
|
||||||
#import "MainOldViewController.h"
|
#import "MainOldViewController.h"
|
||||||
|
|
||||||
@@ -32,6 +33,8 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
|
|||||||
@property (nonatomic, strong) NSString *mainUserId;
|
@property (nonatomic, strong) NSString *mainUserId;
|
||||||
@property (nonatomic, strong) NSMutableArray *notiArray;
|
@property (nonatomic, strong) NSMutableArray *notiArray;
|
||||||
|
|
||||||
|
@property (nonatomic, assign) NSInteger page;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NotiCenterViewController
|
@implementation NotiCenterViewController
|
||||||
@@ -56,16 +59,22 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
|
|||||||
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterContentTableViewCell" bundle:nil] forCellReuseIdentifier:contentidentifier];
|
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterContentTableViewCell" bundle:nil] forCellReuseIdentifier:contentidentifier];
|
||||||
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterImageTableViewCell" bundle:nil] forCellReuseIdentifier:imageidentifier];
|
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterImageTableViewCell" bundle:nil] forCellReuseIdentifier:imageidentifier];
|
||||||
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterJumpLinkTableViewCell" bundle:nil] forCellReuseIdentifier:linkidentifier];
|
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterJumpLinkTableViewCell" bundle:nil] forCellReuseIdentifier:linkidentifier];
|
||||||
|
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||||
|
self.notiArray = @[].mutableCopy;
|
||||||
|
self.page = 1;
|
||||||
|
[self refreshDatasource];
|
||||||
|
}];
|
||||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||||
self.tableView.tableFooterView = [UIView new];
|
self.tableView.tableFooterView = [UIView new];
|
||||||
|
|
||||||
self.notiArray = @[].mutableCopy;
|
self.notiArray = @[].mutableCopy;
|
||||||
[self setupDatasource];
|
self.page = 1;
|
||||||
|
[self refreshDatasource];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)setupDatasource
|
-(void)refreshDatasource
|
||||||
{
|
{
|
||||||
NSString *urlstring = [NSString stringWithFormat:@"%@?userId=%@&page=1&size=100",PushRecordsURL,self.mainUserId];
|
NSString *urlstring = [NSString stringWithFormat:@"%@?userId=%@&page=%ld&size=20",PushRecordsURL,self.mainUserId,(long)self.page];
|
||||||
NSURL *url = [NSURL URLWithString:urlstring];
|
NSURL *url = [NSURL URLWithString:urlstring];
|
||||||
|
|
||||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||||
@@ -85,17 +94,28 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
|
|||||||
}else{
|
}else{
|
||||||
if (ISNULL(error) && !ISNULL(responseObject) && [[responseObject objectForKey:@"code"] integerValue] == 1) {
|
if (ISNULL(error) && !ISNULL(responseObject) && [[responseObject objectForKey:@"code"] integerValue] == 1) {
|
||||||
PushRecordDataModel *model = [[PushRecordDataModel alloc] initWithDictionary:responseObject];
|
PushRecordDataModel *model = [[PushRecordDataModel alloc] initWithDictionary:responseObject];
|
||||||
for (PushRecordList *list in self.notiArray) {
|
for (PushRecordList *list in model.data.list) {
|
||||||
if (list.type == 2) {
|
if (list.type == 2) {
|
||||||
list.imageHeight = SCREEN_WIDTH-30;
|
list.imageHeight = SCREEN_WIDTH-30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[self.notiArray addObjectsFromArray:model.data.list];
|
[self.notiArray addObjectsFromArray:model.data.list];
|
||||||
|
if (model.data.list.count == 20) {
|
||||||
|
self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||||
|
self.page++;
|
||||||
|
[self refreshDatasource];
|
||||||
|
}];
|
||||||
|
}else{
|
||||||
|
self.tableView.mj_footer = nil;
|
||||||
|
}
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
[self refreshImageDatasource];
|
[self refreshImageDatasource];
|
||||||
|
[self scrollViewToRecordIDSection];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[self.tableView.mj_header endRefreshing];
|
||||||
|
[self.tableView.mj_footer endRefreshing];
|
||||||
});
|
});
|
||||||
}];
|
}];
|
||||||
[dataTask resume];
|
[dataTask resume];
|
||||||
@@ -103,16 +123,35 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
|
|||||||
|
|
||||||
-(void)refreshImageDatasource
|
-(void)refreshImageDatasource
|
||||||
{
|
{
|
||||||
for (PushRecordList *list in self.notiArray) {
|
for (NSInteger i=0; i<self.notiArray.count; i++) {
|
||||||
|
PushRecordList *list = self.notiArray[i];
|
||||||
NSURL *url = [NSURL URLWithString:list.image];
|
NSURL *url = [NSURL URLWithString:list.image];
|
||||||
[[SDWebImageDownloader sharedDownloader] downloadImageWithURL:url completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
|
[[SDWebImageDownloader sharedDownloader] downloadImageWithURL:url completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
|
||||||
if (image && error == nil) {
|
if (image && error == nil) {
|
||||||
list.imageHeight = (SCREEN_WIDTH-30)*image.size.height/image.size.width;
|
list.imageHeight = (SCREEN_WIDTH-30)*image.size.height/image.size.width;
|
||||||
|
if (list.isOpen == YES) {
|
||||||
|
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:1 inSection:i]] withRowAnimation:(UITableViewRowAnimationNone)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)scrollViewToRecordIDSection
|
||||||
|
{
|
||||||
|
if (self.pushId > 0) {
|
||||||
|
for (NSInteger i=0; i<self.notiArray.count; i++) {
|
||||||
|
PushRecordList *list = self.notiArray[i];
|
||||||
|
if (list.recordId == self.pushId) {
|
||||||
|
list.isOpen = YES;
|
||||||
|
[self.tableView reloadData];
|
||||||
|
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:i] atScrollPosition:(UITableViewScrollPositionNone) animated:YES];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||||
{
|
{
|
||||||
return self.notiArray.count;
|
return self.notiArray.count;
|
||||||
@@ -130,20 +169,6 @@ static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
|
|||||||
|
|
||||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
{
|
{
|
||||||
// PushRecordList *list = self.notiArray[indexPath.section];
|
|
||||||
// if (list.isOpen == YES) {
|
|
||||||
// if (indexPath.row == 0) {
|
|
||||||
// return UITableViewAutomaticDimension;
|
|
||||||
// }else{
|
|
||||||
// if (list.type == 2) {
|
|
||||||
// return list.imageHeight;
|
|
||||||
// }else{
|
|
||||||
// return UITableViewAutomaticDimension;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// return UITableViewAutomaticDimension;
|
|
||||||
// }
|
|
||||||
return UITableViewAutomaticDimension;
|
return UITableViewAutomaticDimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user