Make SignalMessaging AppExtension safe

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent fcb17585b0
commit 2af818b3ba

@ -3493,6 +3493,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 9B533A9FA46206D3D99C9ADA /* Pods-SignalMessaging.debug.xcconfig */; baseConfigurationReference = 9B533A9FA46206D3D99C9ADA /* Pods-SignalMessaging.debug.xcconfig */;
buildSettings = { buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@ -3546,6 +3547,7 @@
baseConfigurationReference = 948239851C08032C842937CC /* Pods-SignalMessaging.test.xcconfig */; baseConfigurationReference = 948239851C08032C842937CC /* Pods-SignalMessaging.test.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
@ -3618,6 +3620,7 @@
baseConfigurationReference = 8EEE74B0753448C085B48721 /* Pods-SignalMessaging.app store release.xcconfig */; baseConfigurationReference = 8EEE74B0753448C085B48721 /* Pods-SignalMessaging.app store release.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";

@ -18,6 +18,12 @@ NS_ASSUME_NONNULL_BEGIN
return [UIApplication sharedApplication].applicationState == UIApplicationStateActive; return [UIApplication sharedApplication].applicationState == UIApplicationStateActive;
} }
- (BOOL)isRTL
{
return
[[UIApplication sharedApplication] userInterfaceLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft;
}
- (UIApplicationState)mainApplicationState - (UIApplicationState)mainApplicationState
{ {
return [UIApplication sharedApplication].applicationState; return [UIApplication sharedApplication].applicationState;

@ -4,6 +4,7 @@
#import "OWSMath.h" #import "OWSMath.h"
#import "UIView+OWS.h" #import "UIView+OWS.h"
#import <SignalServiceKit/AppContext.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -256,8 +257,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
return ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute] return ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute]
== UIUserInterfaceLayoutDirectionRightToLeft); == UIUserInterfaceLayoutDirectionRightToLeft);
} else { } else {
return return [CurrentAppContext() isRTL];
[UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
} }
} }

@ -26,6 +26,8 @@ typedef void (^BackgroundTaskExpirationHandler)(void);
// Should only be called if isMainApp is YES. // Should only be called if isMainApp is YES.
- (void)setMainAppBadgeNumber:(NSInteger)value; - (void)setMainAppBadgeNumber:(NSInteger)value;
- (BOOL)isRTL;
@end @end
id<AppContext> CurrentAppContext(void); id<AppContext> CurrentAppContext(void);

@ -18,6 +18,15 @@ NS_ASSUME_NONNULL_BEGIN
return NO; return NO;
} }
- (BOOL)isRTL
{
// Borrowed from PureLayout's AppExtension compatible RTL support.
// App Extensions may not access -[UIApplication sharedApplication]; fall back to checking the bundle's preferred
// localization character direction
return [NSLocale characterDirectionForLanguage:[[NSBundle mainBundle] preferredLocalizations][0]]
== NSLocaleLanguageDirectionRightToLeft;
}
- (UIApplicationState)mainApplicationState - (UIApplicationState)mainApplicationState
{ {
OWSFail(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__); OWSFail(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__);

Loading…
Cancel
Save