Skip to content

Commit

Permalink
fix(ios): prevent modal windows from being swiped down (#11057)
Browse files Browse the repository at this point in the history
Fixes TIMOB-27169
  • Loading branch information
vijaysingh-axway authored and sgtcoolguy committed Aug 29, 2019
1 parent 50f5435 commit 118bf47
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
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
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 forceModal;
UIStatusBarStyle barStyle;
TiViewProxy<TiTab> *tab;
TiAnimation *openAnimation;
Expand Down
10 changes: 9 additions & 1 deletion iphone/TitaniumKit/TitaniumKit/Sources/API/TiWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ - (void)_destroy

- (void)_configure
{
forceModal = YES;
[self replaceValue:nil forKey:@"orientationModes" notification:NO];
[super _configure];
}
Expand Down Expand Up @@ -560,6 +561,13 @@ - (void)openOnUIThread:(NSArray *)args
[theController setModalPresentationStyle:style];
}
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
if ([TiUtils isIOSVersionOrGreater:@"13.0"]) {
forceModal = [TiUtils boolValue:@"forceModal" properties:dict def:NO];
theController.modalInPresentation = forceModal;
}
#endif
BOOL animated = [TiUtils boolValue:@"animated" properties:dict def:YES];
[[TiApp app] showModalController:theController animated:animated];
} else {
Expand Down Expand Up @@ -733,7 +741,7 @@ - (void)viewDidAppear:(BOOL)animated
}
- (void)viewDidDisappear:(BOOL)animated
{
if (isModal && closing) {
if (isModal && (closing || !forceModal)) {
[self windowDidClose];
}
}
Expand Down

0 comments on commit 118bf47

Please sign in to comment.