|
//
// messageHomeController.m
// ThePaperHD
//
// Created by liyuan on 15/7/15.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "messageCenterHomeController.h"
#import "MLNavigationController.h"
#import "messageCenterController.h"
#import "messageViewModel.h"
@interface messageCenterHomeController ()<messageCenterDelegate,messageViewModelDelegate>
@property(nonatomic, strong)MLNavigationController *navigationController;
@property(nonatomic, strong)messageCenterController *homeVC;
@property(nonatomic, strong)messageViewModel *messageModel;
@property(nonatomic, strong)NSMutableDictionary *msgDic;
@end
@implementation messageCenterHomeController
@synthesize isNeedHold;
@synthesize msgDic = _msgDic;
- (void)viewDidLoad {
[super viewDidLoad];
//【需求】统计-iPad(BUG:4571)
[MobClick event:@"16"];
self.view.backgroundColor = [UIColor clearColor];
self.homeVC = [messageCenterController new];
self.homeVC.messageCenterDelegate = self;
[self addChildViewController:self.homeVC];
self.navigationController = [[MLNavigationController alloc]initWithRootViewController:self.homeVC];
self.navigationController.view.backgroundColor = [UIColor clearColor];
self.navigationController.view.frame = self.view.bounds;
[self.view addSubview:self.navigationController.view];
[self addChildViewController:self.navigationController];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushToDetail:) name:MESSAGETODETAIL object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushToTopicInfoContent:) name:MESSAGETOTOIPICINFO object:nil];
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushToTopicList:) name:MESSAGETOTOPICLIST object:nil];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.isNeedHold = NO;
// self.messageModel = messageViewModel.new;
// self.messageModel.delegate = self;
// self.messageModel.msgMark = nil;
}
#pragma mark -- notification
-(void)pushToTopic:(NSDictionary *)dic{
id data = dic[@"data"];
TopicInfoBO *topic = (TopicInfoBO *)data;
//【倒退】关注的提问和回复我的:进入话题问答详情页,点击进入原话题,闪退(bug:6087)
userBO *user = dic[@"user"]?dic[@"user"]:nil;
if ([self.homeDelegate respondsToSelector:@selector(messageTopicInfo:user:)]) {
[self.homeDelegate messageTopicInfo:topic user:user];
}
}
- (void)pushToNews:(NSDictionary*)dic {
self.isNeedHold = YES;
id data = dic[@"data"];
if ([self.homeDelegate respondsToSelector:@selector(messageToContent:)]) {
[self.homeDelegate messageToContent:data];
}
}
//-(void) pushToTopicList:(NSNotification*) noti{
// if([self.homeDelegate respondsToSelector:@selector(messageToTopicList)]){
// [self.homeDelegate messageToTopicList];
// }
//}
#pragma mark -- delegate
-(void)messageCenterGotoOtherVC:(letterBO *)letter{
if ([self.homeDelegate respondsToSelector:@selector(messageHomeToOtherVC:)]) {
[self.homeDelegate messageHomeToOtherVC:letter];
}
}
-(void)notificationToCenterHome:(commentObjectVO *)bo{
if ([self.homeDelegate respondsToSelector:@selector(notificationToOther:)]) {
[self.homeDelegate notificationToOther:bo];
}
}
-(void)pushMsgToCenterHome:(letterBO *)bo{
if ([self.homeDelegate respondsToSelector:@selector(pushMsgToOtherVC:)]) {
[self.homeDelegate pushMsgToOtherVC:bo];
}
}
-(void)messageToUserGamb:(commentObjectVO *)bo{
if ([self.homeDelegate respondsToSelector:@selector(msgHomeToUserGamb:)]) {
[self.homeDelegate msgHomeToUserGamb:bo];
}
}
-(void)centerToTopicList{
if ([self.homeDelegate respondsToSelector:@selector(messageToTopicList)]) {
[self.homeDelegate messageToTopicList];
}
}
-(void)centerToNews:(NSDictionary *)dic{//进入原新闻
[self pushToNews:dic];
}
-(void)centerToTopic:(NSDictionary *)dic{//进入愿话题
[self pushToTopic:dic];
}
//-(void)returnMsgMark:(NSMutableDictionary *)dic{
// _msgDic = dic;
// self.homeVC.msgDic = _msgDic;
//}
@end
|