123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //
- // NIMSessionConfigurator.m
- // NIMKit
- //
- // Created by chris on 2016/11/7.
- // Copyright © 2016年 NetEase. All rights reserved.
- //
- #import "NIMSessionConfigurator.h"
- #import "NIMSessionMsgDatasource.h"
- #import "NIMSessionInteractorImpl.h"
- #import "NIMCustomLeftBarView.h"
- #import "UIView+NIM.h"
- #import "NIMMessageModel.h"
- #import "NIMGlobalMacro.h"
- #import "NIMSessionInteractorImpl.h"
- #import "NIMSessionDataSourceImpl.h"
- #import "NIMSessionLayoutImpl.h"
- #import "NIMSessionTableAdapter.h"
- /*
- NIMSessionViewController 类关系图
-
-
- .........................................................................
- . .
- . .
- . . | ---> [NIMSessionDatasource]
- . .
- . | ---> [NIMSessionInteractor] --> |
- .
- . | ---> [NIMSessionLayout]
- .
- ↓
- [NIMSessionViewController]-------> [NIMSessionConfigurator] -----> |
- |
- |
- |
- |
- ↓ | ---> [NIMSessionTableAdapter]
- [UITableView] .
- ↑ .
- . .
- . .
- .......................................................................
- */
- @interface NIMSessionConfigurator()
- @property (nonatomic,strong) NIMSessionInteractorImpl *interactor;
- @property (nonatomic,strong) NIMSessionTableAdapter *tableAdapter;
- @end
- @implementation NIMSessionConfigurator
- - (void)youpaifsetup:(NIMSessionViewController *)vc
- {
- NIMSession *session = vc.session;
- id<NIMSessionConfig> sessionConfig = vc.sessionConfig;
- UITableView *tableView = vc.tableView;
- YOUPAINIMInputView *inputView = vc.sessionInputView;
-
- NIMSessionDataSourceImpl *datasource = [[NIMSessionDataSourceImpl alloc] initWithSession:session config:sessionConfig];
- NIMSessionLayoutImpl *layout = [[NIMSessionLayoutImpl alloc] initWithSession:session config:sessionConfig];
- layout.tableView = tableView;
- layout.inputView = inputView;
-
-
- _interactor = [[NIMSessionInteractorImpl alloc] initWithSession:session config:sessionConfig];
- _interactor.delegate = vc;
- _interactor.dataSource = datasource;
- _interactor.layout = layout;
-
- [layout setDelegate:_interactor];
-
- _tableAdapter = [[NIMSessionTableAdapter alloc] init];
- _tableAdapter.interactor = _interactor;
- _tableAdapter.delegate = vc;
- vc.tableView.delegate = _tableAdapter;
- vc.tableView.dataSource = _tableAdapter;
-
-
- [vc setInteractor:_interactor];
- }
- - (void)youpaifuc_setup:(YOUPAIUCIMP2PSessionVC *)vc
- {
- NIMSession *session = vc.session;
- id<NIMSessionConfig> sessionConfig = vc.sessionConfig;
- UITableView *tableView = vc.tableView;
- YOUPAINIMInputView *inputView = vc.sessionInputView;
-
- NIMSessionDataSourceImpl *datasource = [[NIMSessionDataSourceImpl alloc] initWithSession:session config:sessionConfig];
- NIMSessionLayoutImpl *layout = [[NIMSessionLayoutImpl alloc] initWithSession:session config:sessionConfig];
- layout.tableView = tableView;
- layout.inputView = inputView;
-
-
- _interactor = [[NIMSessionInteractorImpl alloc] initWithSession:session config:sessionConfig];
- _interactor.delegate = vc;
- _interactor.dataSource = datasource;
- _interactor.layout = layout;
-
- [layout setDelegate:_interactor];
-
- _tableAdapter = [[NIMSessionTableAdapter alloc] init];
- _tableAdapter.interactor = _interactor;
- _tableAdapter.delegate = vc;
- vc.tableView.delegate = _tableAdapter;
- vc.tableView.dataSource = _tableAdapter;
-
-
- [vc setInteractor:_interactor];
- }
- @end
|