Skip to content

Commit ef0a7a7

Browse files
committed
切换测试环境移动到 无法登陆 页面
1 parent 1b8c9ec commit ef0a7a7

3 files changed

Lines changed: 35 additions & 15 deletions

File tree

Coding_iOS/Controllers/Login/CannotLoginViewController.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,46 @@ - (void)viewDidLoad
4040
});
4141
self.myTableView.tableFooterView=[self customFooterView];
4242
self.myTableView.tableHeaderView = [self customHeaderView];
43+
44+
[self addChangeBaseURLGesture];
45+
if ([NSObject baseURLStrIsTest]) {
46+
kTipAlert(@"在此页面连续点击屏幕 10 下切换到生产环境!");
47+
}
4348
}
49+
50+
- (void)addChangeBaseURLGesture{
51+
@weakify(self);
52+
UITapGestureRecognizer *tapGR = [UITapGestureRecognizer bk_recognizerWithHandler:^(UIGestureRecognizer *sender, UIGestureRecognizerState state, CGPoint location) {
53+
@strongify(self);
54+
if (state == UIGestureRecognizerStateRecognized) {
55+
[self changeToTest:![NSObject baseURLStrIsTest]];
56+
}
57+
}];
58+
tapGR.numberOfTapsRequired = 10.0;
59+
[self.view addGestureRecognizer:tapGR];
60+
}
61+
62+
- (void)changeToTest:(BOOL)isTest{
63+
[NSObject changeBaseURLStrToTest:isTest];
64+
NSString *tipstr;
65+
if (isTest) {
66+
tipstr = @"你现在切换到了测试环境。\n若要重新切换回生产环境则需要按照如下步骤操作:\n\
67+
1. 进到 '登录' 页\n\
68+
2. 点击 '无法登陆' 按钮\n\
69+
3. 进入 '找回密码/重发激活邮件' 页\n\
70+
4. 单击屏幕 10 次";
71+
}else{
72+
tipstr = @"你已成功切换到了生产环境!";
73+
}
74+
kTipAlert(@"%@", tipstr);
75+
[self.navigationController popToRootViewControllerAnimated:YES];
76+
}
77+
4478
- (void)viewWillAppear:(BOOL)animated{
4579
[super viewWillAppear:animated];
4680
[self.navigationController setNavigationBarHidden:NO animated:YES];
4781
}
82+
4883
- (NSString *)titleStr{
4984
NSString *curStr = @"";
5085
if (_type == CannotLoginTypeResetPassword) {

Coding_iOS/Controllers/MeSetting/AboutViewController.m

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,6 @@ - (void)viewDidLoad
149149
// make.height.mas_equalTo(20);
150150
// }];
151151

152-
[self addChangeBaseURLGesture];
153-
if ([NSObject baseURLStrIsTest]) {
154-
kTipAlert(@"在该页面连续点击屏幕 5 下切换到生产环境!");
155-
}
156-
}
157-
158-
- (void)addChangeBaseURLGesture{
159-
UITapGestureRecognizer *tapGR = [UITapGestureRecognizer bk_recognizerWithHandler:^(UIGestureRecognizer *sender, UIGestureRecognizerState state, CGPoint location) {
160-
if (state == UIGestureRecognizerStateRecognized) {
161-
[NSObject changeBaseURLStrToTest:![NSObject baseURLStrIsTest]];
162-
}
163-
}];
164-
tapGR.numberOfTapsRequired = 5.0;
165-
[self.view addGestureRecognizer:tapGR];
166152
}
167153

168154
- (void)didReceiveMemoryWarning

Coding_iOS/Util/OC_Category/NSObject+Common.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ + (void)changeBaseURLStrToTest:(BOOL)isTest{
133133
[CodingNetAPIClient changeJsonClient];
134134

135135
[[UINavigationBar appearance] setBackgroundImage: [UIImage imageWithColor:[UIColor colorWithHexString:isTest?@"0x3bbd79": @"0x28303b"]] forBarMetrics:UIBarMetricsDefault];
136-
[((AppDelegate *)[UIApplication sharedApplication].delegate) setupLoginViewController];
137136
}
138137

139138
#pragma mark File M

0 commit comments

Comments
 (0)