-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[TIMOB-23684] iOS: Expose properties to hide the navbar #8160
Changes from 9 commits
e88eb02
5e7c827
6a9eaf6
1f91020
2c29ee6
0a35071
272d318
b36132c
d39fded
bd69f67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -920,6 +920,70 @@ -(void)setToolbar:(id)items withObject:(id)properties | |
|
||
} | ||
|
||
-(void)setHidesBarsOnSwipe:(id)value | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need validation, please add
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uhm, it's a bool! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They come to the proxies as NSNumbers (because of the JavaScriptCore below it). So usually this is what you do in boolean-setters: - (void)setHidesBarsOnSwipe:(id)value
{
ENSURE_TYPE(value, NSNumber);
[myView setWhatever:[TiUtils boolValue:value def:YES]];
[self replaceValue:value forKey:@"hidesBarsOnSwipe" notification:NO];
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect! Thank you! |
||
ENSURE_TYPE(value, NSNumber); | ||
|
||
[self replaceValue:value forKey:@"hidesBarsOnSwipe" notification:NO]; | ||
|
||
if ([TiUtils isIOS8OrGreater]) { | ||
TiThreadPerformOnMainThread(^{ | ||
if ((controller != nil) && ([controller navigationController] != nil)) { | ||
UINavigationController *ourNC = [controller navigationController]; | ||
ourNC.hidesBarsOnSwipe = [TiUtils boolValue:[self valueForUndefinedKey:@"hidesBarsOnSwipe"] def:NO]; | ||
} | ||
}, NO); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would do that in the setters directly to keep the number of methods small and the code semantically together. |
||
|
||
-(void)setHidesBarsOnTap:(id)value | ||
{ | ||
ENSURE_TYPE(value, NSNumber); | ||
|
||
[self replaceValue:value forKey:@"hidesBarsOnTap" notification:NO]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, add it for all please |
||
|
||
if ([TiUtils isIOS8OrGreater]) { | ||
TiThreadPerformOnMainThread(^{ | ||
if ((controller != nil) && ([controller navigationController] != nil)) { | ||
UINavigationController *ourNC = [controller navigationController]; | ||
ourNC.hidesBarsOnTap = [TiUtils boolValue:[self valueForUndefinedKey:@"hidesBarsOnTap"] def:NO]; | ||
} | ||
}, NO); | ||
} | ||
} | ||
|
||
-(void)setHidesBarsWhenVerticallyCompact:(id)value | ||
{ | ||
ENSURE_TYPE(value, NSNumber); | ||
|
||
[self replaceValue:value forKey:@"hidesBarsWhenVerticallyCompact" notification:NO]; | ||
|
||
if ([TiUtils isIOS8OrGreater]) { | ||
TiThreadPerformOnMainThread(^{ | ||
if ((controller != nil) && ([controller navigationController] != nil)) { | ||
UINavigationController *ourNC = [controller navigationController]; | ||
ourNC.hidesBarsWhenVerticallyCompact = [TiUtils boolValue:[self valueForUndefinedKey:@"hidesBarsWhenVerticallyCompact"] def:NO]; | ||
} | ||
}, NO); | ||
} | ||
} | ||
|
||
-(void)setHidesBarsWhenKeyboardAppears:(id)value | ||
{ | ||
ENSURE_TYPE(value, NSNumber); | ||
|
||
[self replaceValue:value forKey:@"hidesBarsWhenKeyboardAppears" notification:NO]; | ||
|
||
if ([TiUtils isIOS8OrGreater]) { | ||
TiThreadPerformOnMainThread(^{ | ||
if ((controller != nil) && ([controller navigationController] != nil)) { | ||
UINavigationController *ourNC = [controller navigationController]; | ||
ourNC.hidesBarsWhenKeyboardAppears = [TiUtils boolValue:[self valueForUndefinedKey:@"hidesBarsWhenKeyboardAppears"] def:NO]; | ||
} | ||
}, NO); | ||
} | ||
} | ||
|
||
|
||
#define SETPROP(m,x) \ | ||
{\ | ||
|
@@ -970,6 +1034,10 @@ -(void)setupWindowDecorations | |
SETPROP(@"navTintColor",setNavTintColor); | ||
SETPROP(@"translucent",setTranslucent); | ||
SETPROP(@"tabBarHidden",setTabBarHidden); | ||
SETPROP(@"hidesBarsOnSwipe", setHidesBarsOnSwipe); | ||
SETPROP(@"hidesBarsOnTap", setHidesBarsOnTap); | ||
SETPROP(@"hidesBarsWhenVerticallyCompact", setHidesBarsWhenVerticallyCompact); | ||
SETPROP(@"hidesBarsWhenKeyboardAppears", setHidesBarsWhenKeyboardAppears); | ||
SETPROPOBJ(@"toolbar",setToolbar); | ||
[self updateBarImage]; | ||
[self updateNavButtons]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is invalid. Check my comment again, it's