forked from coding/Coding-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9fd351
commit 3d1c7c1
Showing
10 changed files
with
652 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1223,6 +1223,7 @@ | |
B14689C21EE100B200B01371 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B14689B21EE100B200B01371 /* [email protected] */; }; | ||
B14689C31EE100B200B01371 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B14689B31EE100B200B01371 /* [email protected] */; }; | ||
B152ED4E2090B223004A6E8A /* ProjectSettingEntranceController.m in Sources */ = {isa = PBXBuildFile; fileRef = B152ED4D2090B223004A6E8A /* ProjectSettingEntranceController.m */; }; | ||
B152ED542091B7CB004A6E8A /* ProjectArchiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B152ED532091B7CB004A6E8A /* ProjectArchiveViewController.m */; }; | ||
B16EEF08208DDBB6005ABFD5 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B16EEF06208DDBB5005ABFD5 /* [email protected] */; }; | ||
B16EEF09208DDBB6005ABFD5 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = B16EEF07208DDBB6005ABFD5 /* [email protected] */; }; | ||
B16EEF13209080D7005ABFD5 /* TaskBoardsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B16EEF12209080D7005ABFD5 /* TaskBoardsViewController.m */; }; | ||
|
@@ -3333,6 +3334,8 @@ | |
B14689B31EE100B200B01371 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; }; | ||
B152ED4C2090B223004A6E8A /* ProjectSettingEntranceController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProjectSettingEntranceController.h; sourceTree = "<group>"; }; | ||
B152ED4D2090B223004A6E8A /* ProjectSettingEntranceController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProjectSettingEntranceController.m; sourceTree = "<group>"; }; | ||
B152ED522091B7CB004A6E8A /* ProjectArchiveViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProjectArchiveViewController.h; sourceTree = "<group>"; }; | ||
B152ED532091B7CB004A6E8A /* ProjectArchiveViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProjectArchiveViewController.m; sourceTree = "<group>"; }; | ||
B16EEF06208DDBB5005ABFD5 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; }; | ||
B16EEF07208DDBB6005ABFD5 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; }; | ||
B16EEF11209080D7005ABFD5 /* TaskBoardsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TaskBoardsViewController.h; sourceTree = "<group>"; }; | ||
|
@@ -7035,6 +7038,8 @@ | |
isa = PBXGroup; | ||
children = ( | ||
B9A00D7E1ACA3A05008BA008 /* ProjectSetting.storyboard */, | ||
B152ED522091B7CB004A6E8A /* ProjectArchiveViewController.h */, | ||
B152ED532091B7CB004A6E8A /* ProjectArchiveViewController.m */, | ||
B152ED4C2090B223004A6E8A /* ProjectSettingEntranceController.h */, | ||
B152ED4D2090B223004A6E8A /* ProjectSettingEntranceController.m */, | ||
B9A00D801ACA3A17008BA008 /* ProjectSettingViewController.h */, | ||
|
@@ -8529,6 +8534,7 @@ | |
B12B64151FF0DE4800ACFDCC /* SkillCCell.m in Sources */, | ||
4E94C4FF1B4D2B9300EB668A /* MenuButton.m in Sources */, | ||
B12B64091FE900D400ACFDCC /* AMPopTip+Draw.m in Sources */, | ||
B152ED542091B7CB004A6E8A /* ProjectArchiveViewController.m in Sources */, | ||
4ED4B49D1D8295F600EED8C6 /* TeamViewController.m in Sources */, | ||
4EF3741C1BB1258600DDA662 /* LocalFileViewController.m in Sources */, | ||
3A3878401AE295970078D5DE /* ResetLabelCell.m in Sources */, | ||
|
17 changes: 17 additions & 0 deletions
17
Coding_iOS/Controllers/ProjectSetting/ProjectArchiveViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// ProjectArchiveViewController.h | ||
// Coding_iOS | ||
// | ||
// Created by Easeeeeeeeee on 2018/4/26. | ||
// Copyright © 2018年 Coding. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "Project.h" | ||
|
||
@interface ProjectArchiveViewController : UITableViewController | ||
|
||
@property (nonatomic, strong) Project *project; | ||
@property (strong, nonatomic) IBOutletCollection(NSLayoutConstraint) NSArray *lines; | ||
|
||
@end |
153 changes: 153 additions & 0 deletions
153
Coding_iOS/Controllers/ProjectSetting/ProjectArchiveViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
// | ||
// ProjectArchiveViewController.m | ||
// Coding_iOS | ||
// | ||
// Created by Easeeeeeeeee on 2018/4/26. | ||
// Copyright © 2018年 Coding. All rights reserved. | ||
// | ||
|
||
#import "ProjectArchiveViewController.h" | ||
#import "Coding_NetAPIManager.h" | ||
|
||
#import <SDCAlertController.h> | ||
#import <SDCAlertView.h> | ||
#import <UIView+SDCAutoLayout.h> | ||
#import "ProjectDeleteAlertControllerVisualStyle.h" | ||
|
||
#import "Ease_2FA.h" | ||
|
||
@interface ProjectArchiveViewController ()<UITextFieldDelegate> | ||
@property (strong, nonatomic) SDCAlertController *alert; | ||
|
||
@end | ||
|
||
@implementation ProjectArchiveViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
self.title = @"归档项目"; | ||
|
||
for (NSLayoutConstraint *cons in self.lines) { | ||
cons.constant = 0.5; | ||
} | ||
|
||
self.tableView.tableFooterView = [UIView new]; | ||
[self.tableView setSeparatorColor:[UIColor colorWithRGBHex:0xe5e5e5]]; | ||
self.tableView.backgroundColor = kColorTableSectionBg; | ||
} | ||
|
||
|
||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ | ||
return [UIView new]; | ||
} | ||
|
||
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth]; | ||
} | ||
|
||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | ||
[tableView deselectRowAtIndexPath:indexPath animated:YES]; | ||
if (indexPath.section != 1) { | ||
return; | ||
} | ||
[[Coding_NetAPIManager sharedManager] request_VerifyTypeWithBlock:^(VerifyType type, NSError *error) { | ||
if (!error) { | ||
[self showArchiveAlertWithType:type]; | ||
} | ||
}]; | ||
} | ||
|
||
- (void)showArchiveAlertWithType:(VerifyType)type{ | ||
|
||
if (self.alert) {//正在显示 | ||
return; | ||
} | ||
|
||
NSString *title, *message, *placeHolder; | ||
if (type == VerifyTypePassword) { | ||
title = @"需要验证密码"; | ||
message = @"这是一个危险的操作,请提供登录密码确认!"; | ||
placeHolder = @"请输入密码"; | ||
}else if (type == VerifyTypeTotp){ | ||
title = @"需要动态验证码"; | ||
message = @"这是一个危险操作,需要进行身份验证!"; | ||
placeHolder = @"请输入动态验证码"; | ||
}else{//不知道啥类型,不处理 | ||
return; | ||
} | ||
|
||
_alert = [SDCAlertController alertControllerWithTitle:title message:message preferredStyle:SDCAlertControllerStyleAlert]; | ||
|
||
UITextField *passwordTextField = [[UITextField alloc] initWithFrame:CGRectMake(15, 0, 240.0, 30.0)]; | ||
passwordTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 30)]; | ||
passwordTextField.leftViewMode = UITextFieldViewModeAlways; | ||
passwordTextField.layer.borderColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.6].CGColor; | ||
passwordTextField.layer.borderWidth = 1; | ||
passwordTextField.secureTextEntry = (type == VerifyTypePassword); | ||
passwordTextField.backgroundColor = [UIColor whiteColor]; | ||
passwordTextField.placeholder = placeHolder; | ||
if (type == VerifyTypeTotp) { | ||
passwordTextField.text = [OTPListViewController otpCodeWithGK:[Login curLoginUser].global_key]; | ||
} | ||
passwordTextField.delegate = self; | ||
|
||
[_alert.contentView addSubview:passwordTextField]; | ||
|
||
NSDictionary* passwordViews = NSDictionaryOfVariableBindings(passwordTextField); | ||
|
||
[_alert.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[passwordTextField]-(>=14)-|" options:0 metrics:nil views:passwordViews]]; | ||
|
||
// Style | ||
_alert.visualStyle = [ProjectDeleteAlertControllerVisualStyle new]; | ||
|
||
// 添加密码框 | ||
// [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) { | ||
// textField.secureTextEntry = YES; | ||
// }]; | ||
|
||
// 添加按钮 | ||
@weakify(self); | ||
_alert.actionLayout = SDCAlertControllerActionLayoutHorizontal; | ||
[_alert addAction:[SDCAlertAction actionWithTitle:@"取消" style:SDCAlertActionStyleDefault handler:^(SDCAlertAction *action) { | ||
@strongify(self); | ||
self.alert = nil; | ||
}]]; | ||
[_alert addAction:[SDCAlertAction actionWithTitle:@"确定" style:SDCAlertActionStyleDefault handler:^(SDCAlertAction *action) { | ||
@strongify(self); | ||
self.alert = nil; | ||
NSString *passCode = passwordTextField.text; | ||
if ([passCode length] > 0) { | ||
// 归档项目 | ||
[[Coding_NetAPIManager sharedManager] request_ArchiveProject_WithObj:self.project passCode:passCode type:type andBlock:^(Project *data, NSError *error) { | ||
if (!error) { | ||
[self.navigationController popToRootViewControllerAnimated:YES]; | ||
} | ||
}]; | ||
} | ||
}]]; | ||
|
||
[_alert presentWithCompletion:^{ | ||
[passwordTextField becomeFirstResponder]; | ||
}]; | ||
} | ||
|
||
|
||
-(BOOL)textFieldShouldReturn:(UITextField *)textField{ | ||
[textField resignFirstResponder]; | ||
return YES; | ||
} | ||
|
||
#pragma mark - Orientations | ||
- (BOOL)shouldAutorotate{ | ||
return UIInterfaceOrientationIsLandscape(self.interfaceOrientation); | ||
} | ||
|
||
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { | ||
return UIInterfaceOrientationPortrait; | ||
} | ||
|
||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations { | ||
return UIInterfaceOrientationMaskPortrait; | ||
} | ||
@end |
Oops, something went wrong.