Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ios): prevent modal windows from being swiped down #11057

Merged
merged 20 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6d31046
chore(ios) : Added support for Xcode 11 / iOS 13 dev environment
vijaysingh-axway Jun 4, 2019
749c396
Merge branch 'master' into TIMOB-27125
vijaysingh-axway Jun 11, 2019
877accd
Merge branch 'master' into TIMOB-27125
vijaysingh-axway Jun 20, 2019
e5bd9fc
feat(iOS): Removed IS_XCODE_9 constants from code
vijaysingh-axway Jun 24, 2019
1484cad
Merge branch 'master' into TIMOB-27125
vijaysingh-axway Jun 24, 2019
719c9f9
Merge branch 'master' into TIMOB-27125
vijaysingh-axway Jul 12, 2019
b326074
chore(ios): prevent modal windows from being swiped down
vijaysingh-axway Jul 17, 2019
5ea4b6b
feat(android): Optimized TextField/TextArea handling in TableView (#1…
jquick-axway Jul 15, 2019
badda41
feat(ios): updated constants
vijaysingh-axway Jul 18, 2019
0415939
test(db): bump up timeouts
sgtcoolguy Jul 16, 2019
c734de8
test(db): drop long-running query count to 5000 rows
sgtcoolguy Jul 16, 2019
50121c3
test(db): bump up timeout
sgtcoolguy Jul 16, 2019
f40d639
test: migrate overridden tests to suite
sgtcoolguy Jul 17, 2019
a8c8922
Merge branch 'master' into TIMOB-27169
vijaysingh-axway Jul 18, 2019
b2fddd0
Merge branch 'master' into TIMOB-27169
vijaysingh-axway Jul 22, 2019
5cc3bd1
chore(ios): prevent modal windows from being swiped down
vijaysingh-axway Aug 16, 2019
0a98b0e
Merge branch 'master' into TIMOB-27169
vijaysingh-axway Aug 16, 2019
2587c2c
Merge branch 'master' into TIMOB-27169
vijaysingh-axway Aug 21, 2019
9974ced
Merge branch 'master' into TIMOB-27169
vijaysingh-axway Aug 27, 2019
60232ed
Merge branch 'master' into TIMOB-27169
vijaysingh-axway Aug 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions apidoc/Titanium/UI/Window.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,16 @@ properties:
type: Boolean
default: false

- name: forceModal
summary: Indicates whether the window enforces modal behaviour.
description: |
Set to `true` to prevent interactive dismissal of window while it is onscreen.
type: Boolean
default: false
platforms: [iphone, ipad]
since: "8.2.0"
osver: {ios: {min: "13.0"}}

- name: modalStyle
summary: Presentation style of this modal window.
platforms: [iphone, ipad]
Expand Down
6 changes: 0 additions & 6 deletions iphone/Classes/GeolocationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,9 @@ - (CLLocationManager *)locationManager

locationManager.allowsBackgroundLocationUpdates = allowsBackgroundLocationUpdates;

#if IS_XCODE_9
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
locationManager.showsBackgroundLocationIndicator = showBackgroundLocationIndicator;
}
#endif

locationManager.activityType = activityType;
locationManager.pausesLocationUpdatesAutomatically = pauseLocationUpdateAutomatically;
Expand Down Expand Up @@ -605,23 +603,19 @@ - (void)setHeadingFilter:(CLLocationDegrees)value

- (BOOL)showBackgroundLocationIndicator
{
#if IS_XCODE_9
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
return showBackgroundLocationIndicator;
}
#endif
DebugLog(@"[ERROR] The showBackgroundLocationIndicator property is only available on iOS 11.0+. Returning \"false\" ...");
return NO;
}

- (void)setShowBackgroundLocationIndicator:(BOOL)value
{
#if IS_XCODE_9
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
showBackgroundLocationIndicator = value;
return;
}
#endif
DebugLog(@"[ERROR] The showBackgroundLocationIndicator property is only available on iOS 11.0+. Ignoring call ...");
}

Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiAppiOSUserNotificationCenterProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,9 @@ - (void)requestUserNotificationSettings:(id)callback
@"carPlaySetting" : @([settings carPlaySetting]),
@"alertStyle" : @([settings alertStyle])
} mutableCopy];
#if IS_XCODE_9
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
propertiesDict[@"showPreviewsSetting"] = @([settings showPreviewsSetting]);
}
#endif
#if IS_XCODE_10
if ([TiUtils isIOSVersionOrGreater:@"12.0"]) {
propertiesDict[@"criticalAlertSetting"] = @([settings criticalAlertSetting]);
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,6 @@ - (void)viewResignFocus

- (void)viewGetFocus
{
#if IS_XCODE_9
if (isSearchBarInNavigation) {
id proxy = [(TiViewProxy *)self.proxy parent];
while ([proxy isKindOfClass:[TiViewProxy class]] && ![proxy isKindOfClass:[TiWindowProxy class]]) {
Expand All @@ -2214,7 +2213,6 @@ - (void)viewGetFocus
controller.navigationItem.searchController = searchController;
}
}
#endif

if (isSearched && self.searchedString && ![searchController isActive]) {
isSearched = NO;
Expand Down
4 changes: 0 additions & 4 deletions iphone/Classes/TiUINavigationWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ - (void)navigationController:(UINavigationController *)navigationController will
}
}
TiWindowProxy *theWindow = (TiWindowProxy *)[(TiViewController *)viewController proxy];
#if IS_XCODE_9
[theWindow processForSafeArea];
#endif
if ((theWindow != rootWindow) && [theWindow opening]) {
[theWindow windowWillOpen];
[theWindow windowDidOpen];
Expand Down Expand Up @@ -386,7 +384,6 @@ - (void)viewDidDisappear:(BOOL)animated
[super viewDidDisappear:animated];
}

#if IS_XCODE_9
- (BOOL)homeIndicatorAutoHide
{
UIViewController *topVC = [navController topViewController];
Expand All @@ -398,7 +395,6 @@ - (BOOL)homeIndicatorAutoHide
}
return [super homeIndicatorAutoHide];
}
#endif

- (BOOL)hidesStatusBar
{
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ - (TiUIScrollViewImpl *)scrollView

- (void)adjustScrollViewInsets
{
#if IS_XCODE_9
id viewProxy = self.proxy;
while (viewProxy && ![viewProxy isKindOfClass:[TiWindowProxy class]]) {
viewProxy = [viewProxy parent];
Expand All @@ -160,7 +159,6 @@ - (void)adjustScrollViewInsets
[scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
}
#endif
}

- (id)accessibilityElement
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUITabGroupProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ - (UIStatusBarStyle)preferredStatusBarStyle;
return [super preferredStatusBarStyle];
}

#if IS_XCODE_9
- (BOOL)homeIndicatorAutoHide
{
UITabBarController *tabController = [(TiUITabGroup *)[self view] tabController];
Expand All @@ -277,7 +276,6 @@ - (BOOL)homeIndicatorAutoHide
}
return [super homeIndicatorAutoHide];
}
#endif

- (BOOL)hidesStatusBar
{
Expand Down
6 changes: 0 additions & 6 deletions iphone/Classes/TiUITabProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ - (void)openWindow:(NSArray *)args
TiWindowProxy *window = [args objectAtIndex:0];
ENSURE_TYPE(window, TiWindowProxy);

#if IS_XCODE_9
[window processForSafeArea];
#endif

if (window == rootWindow) {
[rootWindow windowWillOpen];
Expand Down Expand Up @@ -385,9 +383,7 @@ - (void)handleWillShowViewController:(UIViewController *)viewController animated
}
}
TiWindowProxy *theWindow = (TiWindowProxy *)[(TiViewController *)viewController proxy];
#if IS_XCODE_9
[theWindow processForSafeArea];
#endif
if (theWindow == rootWindow) {
//This is probably too late for the root view controller.
//Figure out how to call open before this callback
Expand Down Expand Up @@ -742,7 +738,6 @@ - (void)popToRootWindow:(id)args

@synthesize parentOrientationController;

#if IS_XCODE_9
- (BOOL)homeIndicatorAutoHide
{
if (rootWindow == nil) {
Expand All @@ -759,7 +754,6 @@ - (BOOL)homeIndicatorAutoHide
}
return NO;
}
#endif

- (BOOL)hidesStatusBar
{
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,6 @@ - (void)viewResignFocus

- (void)viewGetFocus
{
#if IS_XCODE_9
if (isSearchBarInNavigation) {
id proxy = [(TiViewProxy *)self.proxy parent];
while ([proxy isKindOfClass:[TiViewProxy class]] && ![proxy isKindOfClass:[TiWindowProxy class]]) {
Expand All @@ -2371,7 +2370,6 @@ - (void)viewGetFocus
controller.navigationItem.searchController = searchController;
}
}
#endif
if (!hideOnSearch && isSearched && self.searchedString && ![searchController isActive]) {
isSearched = NO;
searchController.searchBar.text = self.searchedString;
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@

@end

#if IS_XCODE_9
@interface WebAppProtocolHandler : NSObject <WKURLSchemeHandler> {
}

+ (NSString *)specialProtocolScheme;

@end
#endif

#endif
5 changes: 0 additions & 5 deletions iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,11 @@ - (WKWebView *)webView

[config setUserContentController:controller];

#if IS_XCODE_9
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
if (![WKWebView handlesURLScheme:[WebAppProtocolHandler specialProtocolScheme]]) {
[config setURLSchemeHandler:[[WebAppProtocolHandler alloc] init] forURLScheme:[WebAppProtocolHandler specialProtocolScheme]];
}
}
#endif

_willHandleTouches = [TiUtils boolValue:[[self proxy] valueForKey:@"willHandleTouches"] def:YES];

Expand Down Expand Up @@ -1358,8 +1356,6 @@ - (NSHTTPCookie *)cookieForString:(NSString *)cookieStr

@end

#if IS_XCODE_9

@implementation WebAppProtocolHandler

+ (NSString *)specialProtocolScheme
Expand Down Expand Up @@ -1410,6 +1406,5 @@ - (void)webView:(nonnull WKWebView *)webView stopURLSchemeTask:(nonnull id<WKURL
}

@end
#endif

#endif
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIiOSProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,9 @@
@property (nonatomic, readonly) NSNumber *BLUR_EFFECT_STYLE_DARK;
#endif

#if IS_XCODE_9
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_AUTOMATIC;
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_ALWAYS;
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_NEVER;
#endif

/**
Checks the force touch capibility of the current device.
Expand Down
2 changes: 0 additions & 2 deletions iphone/Classes/TiUIiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,9 @@ - (id)createFeedbackGenerator:(id)args
MAKE_SYSTEM_PROP(FEEDBACK_GENERATOR_IMPACT_STYLE_HEAVY, UIImpactFeedbackStyleHeavy);
#endif

#if IS_XCODE_9
MAKE_SYSTEM_PROP(LARGE_TITLE_DISPLAY_MODE_AUTOMATIC, UINavigationItemLargeTitleDisplayModeAutomatic);
MAKE_SYSTEM_PROP(LARGE_TITLE_DISPLAY_MODE_ALWAYS, UINavigationItemLargeTitleDisplayModeAlways);
MAKE_SYSTEM_PROP(LARGE_TITLE_DISPLAY_MODE_NEVER, UINavigationItemLargeTitleDisplayModeNever);
#endif

#ifdef USE_TI_UIWEBVIEW

Expand Down
4 changes: 0 additions & 4 deletions iphone/Classes/TiUIiOSSplitWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,8 @@ - (void)setMasterView_:(id)args
RELEASE_TO_NIL(masterProxy);
masterProxy = [args retain];

#if IS_XCODE_9
TiWindowProxy *masterWindowProxy = (TiWindowProxy *)masterProxy;
masterWindowProxy.isMasterWindow = YES;
#endif

if (viewsInitialized) {
[self initProxy:masterProxy withWrapper:masterViewWrapper];
Expand All @@ -282,10 +280,8 @@ - (void)setDetailView_:(id)args
RELEASE_TO_NIL(detailProxy);
detailProxy = [args retain];

#if IS_XCODE_9
TiWindowProxy *detailWindowProxy = (TiWindowProxy *)detailProxy;
detailWindowProxy.isDetailWindow = YES;
#endif

if (viewsInitialized) {
[self initProxy:detailProxy withWrapper:detailViewWrapper];
Expand Down
3 changes: 1 addition & 2 deletions iphone/Classes/UIModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,9 @@ - (NSNumber *)ATTRIBUTE_LINE_BREAK_BY_TRUNCATING_MIDDLE
MAKE_SYSTEM_STR(AUTOFILL_TYPE_URL, UITextContentTypeURL);
MAKE_SYSTEM_STR(AUTOFILL_TYPE_CARD_NUMBER, UITextContentTypeCreditCardNumber);

#if IS_XCODE_9
MAKE_SYSTEM_STR(AUTOFILL_TYPE_USERNAME, UITextContentTypeUsername);
MAKE_SYSTEM_STR(AUTOFILL_TYPE_PASSWORD, UITextContentTypePassword);
#endif

#if IS_XCODE_10
MAKE_SYSTEM_STR(AUTOFILL_TYPE_NEW_PASSWORD, UITextContentTypeNewPassword);
MAKE_SYSTEM_STR(AUTOFILL_TYPE_ONE_TIME_CODE, UITextContentTypeOneTimeCode);
Expand Down
1 change: 1 addition & 0 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiWindowProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
BOOL focussed;
BOOL isModal;
BOOL hidesStatusBar;
BOOL isForceModalDisable;
UIStatusBarStyle barStyle;
TiViewProxy<TiTab> *tab;
TiAnimation *openAnimation;
Expand Down
9 changes: 8 additions & 1 deletion iphone/TitaniumKit/TitaniumKit/Sources/API/TiWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,13 @@ - (void)openOnUIThread:(NSArray *)args
[theController setModalPresentationStyle:style];
}
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
janvennemann marked this conversation as resolved.
Show resolved Hide resolved
if ([TiUtils isIOSVersionOrGreater:@"13.0"]) {
isForceModalDisable = ![TiUtils boolValue:@"forceModal" properties:dict def:NO];
janvennemann marked this conversation as resolved.
Show resolved Hide resolved
vijaysingh-axway marked this conversation as resolved.
Show resolved Hide resolved
theController.modalInPresentation = !isForceModalDisable;
}
#endif
BOOL animated = [TiUtils boolValue:@"animated" properties:dict def:YES];
[[TiApp app] showModalController:theController animated:animated];
} else {
Expand Down Expand Up @@ -731,7 +738,7 @@ - (void)viewDidAppear:(BOOL)animated
}
- (void)viewDidDisappear:(BOOL)animated
{
if (isModal && closing) {
if (isModal && (closing || isForceModalDisable)) {
[self windowDidClose];
}
}
Expand Down
6 changes: 3 additions & 3 deletions iphone/iphone/Titanium_Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include "ThirdpartyNS.h"
#import <AvailabilityInternal.h>

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
#define IS_XCODE_9 true
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
#define IS_XCODE_11 true
#else
#define IS_XCODE_9 false
#define IS_XCODE_11 false
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000
Expand Down
4 changes: 2 additions & 2 deletions iphone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"minIosVersion": "9.0",
"minWatchosVersion": "2.0",
"vendorDependencies": {
"xcode": ">=8.0 <=10.x",
"ios sdk": ">=9.0 <=12.x"
"xcode": ">=9.0 <=11.x",
"ios sdk": ">=10.0 <=13.x"
},
"repository": {
"type": "git",
Expand Down