1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //
- // RQSettingViewController.m
- // jiaPei
- //
- // Created by 张嵘 on 2022/5/5.
- // Copyright © 2022 JCZ. All rights reserved.
- //
- #import "RQSettingViewController.h"
- @interface RQSettingViewController ()
- /// viewModel
- @property (nonatomic, readonly, strong) RQSettingViewModel *viewModel;
- @end
- @implementation RQSettingViewController
- @dynamic viewModel;
- #pragma mark - SystemMethod
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- }
- #pragma mark - OverrideMethods
- - (void)bindViewModel{
- [super bindViewModel];
- @weakify(self);
- /// show HUD
- [[self.viewModel.logoutCommand.executing
- skip:1]
- subscribeNext:^(NSNumber * showHud) {
- if (showHud.boolValue) {
- [MBProgressHUD rq_showProgressHUD:@"正在退出..."];
- }else{
- [MBProgressHUD rq_hideHUD];
- }
- }];
-
- /// 点击退出登录回调
- [self.viewModel.logoutSubject subscribeNext:^(id input) {
- // @strongify(self);
- // @weakify(self);
- LCActionSheet *sheet = [LCActionSheet sheetWithTitle:@"退出后不会删除任何历史数据,下次登录依然可以使用本账号" cancelButtonTitle:@"取消" clicked:^(LCActionSheet * _Nonnull actionSheet, NSInteger buttonIndex) {
- if (buttonIndex == 0) return ;
- /// 退出账号
- @strongify(self)
- [self.viewModel.logoutCommand execute:nil];
-
- } otherButtonTitles:@"退出登录", nil];
- NSMutableIndexSet *indexSet = [[NSMutableIndexSet alloc] init];
- [indexSet addIndex:1];
- sheet.destructiveButtonIndexSet = indexSet;
- [sheet show];
- }];
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
- switch (indexPath.section) {
- case 1 : {
- RQProfileLogoutCell *cell = [RQProfileLogoutCell cellWithTableView:tableView];
- return cell;
- }
-
- default:
- return [super tableView:tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
- }
-
- }
- - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
- switch (indexPath.section) {
- case 1 : {
- RQProfileLogoutCell *profileLogoutCell = (RQProfileLogoutCell *)cell;
- [profileLogoutCell bindViewModel:object];
- break;
- }
-
- default: {
- [super configureCell:cell atIndexPath:indexPath withObject:object];
- break;
- }
- }
-
- }
- @end
|