Change forceRTL to allowRTL

Summary: Rename the forceRTL to allowRTL so that make it much clear to read. And change a typo.

Reviewed By: fkgozali

Differential Revision: D3489235

fbshipit-source-id: b9803dfbcda2f764b7e752c9810cfc7a0b9fe39b
This commit is contained in:
Mengjue Wang
2016-06-27 12:57:45 -07:00
committed by Facebook Github Bot 6
parent 229d6d2fd0
commit 0c818586ca
2 changed files with 8 additions and 8 deletions

View File

@@ -18,8 +18,8 @@
@interface RCTI18nUtil : NSObject
- (BOOL)isRTL;
- (BOOL)forceRTL;
- (void)setForceRTL:(BOOL)value;
- (BOOL)allowRTL;
- (void)setAllowRTL:(BOOL)value;
+ (id)sharedInstance;
@end

View File

@@ -22,26 +22,26 @@
return sharedRCTI18nUtilInstance;
}
// If currnent using language is RTL language and meanwhile set forceRTL on the JS side,
// If current using language is RTL language and meanwhile set allowRTL on the JS side,
// the RN app will automatically have a RTL layout.
- (BOOL)isRTL
{
if ([self forceRTL] && [self isApplicationPreferredLanguageRTL]) {
if ([self allowRTL] && [self isApplicationPreferredLanguageRTL]) {
return YES;
}
return NO;
}
- (BOOL)forceRTL
- (BOOL)allowRTL
{
BOOL rtlStatus = [[NSUserDefaults standardUserDefaults]
boolForKey:@"RCTI18nUtil_forceRTL"];
boolForKey:@"RCTI18nUtil_allowRTL"];
return rtlStatus;
}
- (void)setForceRTL:(BOOL)rtlStatus
- (void)setAllowRTL:(BOOL)rtlStatus
{
[[NSUserDefaults standardUserDefaults] setBool:rtlStatus forKey:@"RCTI18nUtil_forceRTL"];
[[NSUserDefaults standardUserDefaults] setBool:rtlStatus forKey:@"RCTI18nUtil_allowRTL"];
[[NSUserDefaults standardUserDefaults] synchronize];
}