Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit c459e49

Browse files
committed
Fixed bug related with show/not show pincode depend of the state of the ssoviewcontroller
1 parent 18e105e commit c459e49

File tree

6 files changed

+44
-13
lines changed

6 files changed

+44
-13
lines changed

Owncloud iOs Client/AppDelegate.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ - (void)application:(UIApplication *)application handleEventsForBackgroundURLSes
16991699
#pragma mark - Pass Code
17001700

17011701
- (void)checkIfIsNecesaryShowPassCode {
1702-
if ([ManageAppSettingsDB isPasscode] || k_is_passcode_forced) {
1702+
if (([ManageAppSettingsDB isPasscode] || k_is_passcode_forced) && (_isPasscodeVisible == false) && ([PresentedViewUtils isSSOViewControllerPresentedAndLoading:self.window] == false)) {
17031703
dispatch_async(dispatch_get_main_queue(), ^{
17041704

17051705
KKPasscodeViewController* vc = [[KKPasscodeViewController alloc] initWithNibName:nil bundle:nil];
@@ -1726,7 +1726,7 @@ - (void)checkIfIsNecesaryShowPassCode {
17261726
} else {
17271727
oc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
17281728
oc.modalPresentationStyle = UIModalPresentationFormSheet;
1729-
[rootController presentViewController:oc animated:NO completion:nil];
1729+
[rootController presentViewController:oc animated:NO completion:nil];
17301730
}
17311731
});
17321732
} else {
@@ -1737,7 +1737,7 @@ - (void)checkIfIsNecesaryShowPassCode {
17371737

17381738
- (void)checkIfIsNecesaryShowPassCodeWillResignActive {
17391739

1740-
if ([ManageAppSettingsDB isPasscode] || k_is_passcode_forced) {
1740+
if (([ManageAppSettingsDB isPasscode] || k_is_passcode_forced) && (_isPasscodeVisible == false) && ([PresentedViewUtils isSSOViewControllerPresentedAndLoading:self.window] == false)) {
17411741
dispatch_async(dispatch_get_main_queue(), ^{
17421742

17431743
KKPasscodeViewController* vc = [[KKPasscodeViewController alloc] initWithNibName:nil bundle:nil];

Owncloud iOs Client/Branding/Customization.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define k_hide_url_server NO
2727

2828
//Set a default url server. It must be obligatory if we hide the url server (#define k_hide_url_server YES)
29-
#define k_default_url_server @""
29+
#define k_default_url_server @"https://docker.oc.solidgear.es:63360/oc-shib/"
3030

3131
//force override existing accounts with k_default_url_server. It must be obligatory if we change authentication type (k_is_sso_active)
3232
#define k_force_update_of_server_url NO
@@ -44,7 +44,7 @@
4444
#define k_is_oauth_active NO
4545

4646
//Have SAML active
47-
#define k_is_sso_active NO
47+
#define k_is_sso_active YES
4848

4949
//OAuth server
5050
#define k_oauth_login @""

Owncloud iOs Client/Login/SSO/SSOViewController.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111

1212
/*
13-
Copyright (C) 2016, ownCloud GmbH.
13+
Copyright (C) 2017, ownCloud GmbH.
1414
This code is covered by the GNU Public License Version 3.
1515
For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/
1616
You should have received a copy of this license
@@ -29,12 +29,11 @@
2929

3030
@interface SSOViewController : UIViewController <UIWebViewDelegate, UIAlertViewDelegate, UITextFieldDelegate, NSURLConnectionDelegate, NSURLConnectionDataDelegate, ManageNetworkErrorsDelegate>
3131

32-
33-
3432
@property (nonatomic, strong) IBOutlet UIWebView *webView;
3533
@property (nonatomic, strong) UIActivityIndicatorView *activity;
3634
@property (nonatomic, strong) NSString *ownCloudServerUrlString;
3735
@property (nonatomic, strong) NSString *urlString;
36+
@property (nonatomic) BOOL isLoading;
3837
@property (nonatomic,weak) __weak id<SSODelegate> delegate;
3938

4039
#pragma mark - Properties for SAML server with 401 error. Like Microsoft NTLM

Owncloud iOs Client/Login/SSO/SSOViewController.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010

1111
/*
12-
Copyright (C) 2016, ownCloud GmbH.
12+
Copyright (C) 2017, ownCloud GmbH.
1313
This code is covered by the GNU Public License Version 3.
1414
For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/
1515
You should have received a copy of this license
@@ -242,6 +242,7 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
242242

243243
- (void)webViewDidStartLoad:(UIWebView *)webView {
244244
DLog(@"_webViewDidStartLoad_: %@", webView.request.URL.absoluteString);
245+
self.isLoading = true;
245246

246247
[_webView endEditing:YES];
247248

@@ -257,8 +258,8 @@ - (void)webViewDidStartLoad:(UIWebView *)webView {
257258
}
258259

259260
-(void)webViewDidFinishLoad:(UIWebView *)webView {
260-
261261
DLog(@"_webViewDidFinishLoad_");
262+
self.isLoading = false;
262263

263264
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(delay) object:nil];
264265

Owncloud iOs Client/Utils/PresentedViewUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020

2121
+ (UIViewController *) getPresentedViewControllerInWindow: (UIWindow *)window;
2222
+ (BOOL) isSSOViewControllerPresentedInWindow: (UIWindow *)window withPassCodeVisible: (BOOL) isPasscodeVisible;
23+
+ (BOOL) isSSOViewControllerPresentedAndLoading: (UIWindow *) window;
2324

2425
@end

Owncloud iOs Client/Utils/PresentedViewUtils.m

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
@implementation PresentedViewUtils
2020

21-
+ (UIViewController *) getPresentedViewControllerInWindow: (UIWindow *)window {
22-
UIViewController *presentedVC = window.rootViewController;
21+
+ (UIViewController *) getPresentedViewControllerInViewController: (UIViewController *) viewController {
22+
UIViewController *presentedVC = viewController;
2323

2424
while (presentedVC.presentedViewController != nil) {
2525
presentedVC = presentedVC.presentedViewController;
@@ -28,6 +28,21 @@ + (UIViewController *) getPresentedViewControllerInWindow: (UIWindow *)window {
2828
return presentedVC;
2929
}
3030

31+
+ (UIViewController *) getPresentedViewControllerInWindow: (UIWindow *)window {
32+
UIViewController *presentedVC = window.rootViewController;
33+
34+
presentedVC = [self getPresentedViewControllerInViewController:presentedVC];
35+
36+
if ([presentedVC isKindOfClass:[UINavigationController class]]){
37+
UINavigationController *navigationVC = (UINavigationController *) presentedVC;
38+
if (navigationVC.viewControllers[0] != nil) {
39+
presentedVC = [self getPresentedViewControllerInViewController:navigationVC.viewControllers[0]];
40+
}
41+
}
42+
43+
return presentedVC;
44+
}
45+
3146
+ (BOOL) isSSOViewControllerPresentedInWindow: (UIWindow *)window withPassCodeVisible: (BOOL) isPasscodeVisible{
3247

3348
BOOL isSSOViewControllerPresented = false;
@@ -47,9 +62,24 @@ + (BOOL) isSSOViewControllerPresentedInWindow: (UIWindow *)window withPassCodeVi
4762
isSSOViewControllerPresented = true;
4863
}
4964
}
50-
5165
return isSSOViewControllerPresented;
5266
}
5367

68+
+ (BOOL) isSSOViewControllerPresentedAndLoading: (UIWindow *) window {
69+
70+
BOOL isSSOViewControllerAndLoading = false;
71+
72+
UIViewController *presentedVC = [self getPresentedViewControllerInWindow:window];
73+
74+
if ([presentedVC isKindOfClass:[SSOViewController class]]) {
75+
SSOViewController *SSOVC = (SSOViewController *) presentedVC;
76+
if (SSOVC.isLoading == true) {
77+
isSSOViewControllerAndLoading = true;
78+
}
79+
}
80+
81+
return isSSOViewControllerAndLoading;
82+
83+
}
5484

5585
@end

0 commit comments

Comments
 (0)