session-ios/SessionUtilitiesKit/General/AppContext.m
Morgan Pretty 823006a892 Updated the colours to source from direct theme values (instead of individual)
Removed an unused notification
Refactored the PrivacySettingsViewController
Refactored the ScreenLock code to Swift
Fixed an issue where the match dark/light setting wasn't getting applied on launch
Update the modal styling for the various settings modals
2022-08-24 17:33:10 +10:00

55 lines
1.4 KiB
Objective-C
Executable file

#import "AppContext.h"
NS_ASSUME_NONNULL_BEGIN
NSString *const OWSApplicationDidEnterBackgroundNotification = @"OWSApplicationDidEnterBackgroundNotification";
NSString *const OWSApplicationWillEnterForegroundNotification = @"OWSApplicationWillEnterForegroundNotification";
NSString *const OWSApplicationWillResignActiveNotification = @"OWSApplicationWillResignActiveNotification";
NSString *const OWSApplicationDidBecomeActiveNotification = @"OWSApplicationDidBecomeActiveNotification";
NSString *NSStringForUIApplicationState(UIApplicationState value)
{
switch (value) {
case UIApplicationStateActive:
return @"UIApplicationStateActive";
case UIApplicationStateInactive:
return @"UIApplicationStateInactive";
case UIApplicationStateBackground:
return @"UIApplicationStateBackground";
}
}
static id<AppContext> currentAppContext = nil;
id<AppContext> CurrentAppContext(void)
{
return currentAppContext;
}
BOOL HasAppContext(void)
{
return (currentAppContext != nil);
}
void SetCurrentAppContext(id<AppContext> appContext)
{
// The main app context should only be set once.
//
// App extensions may be opened multiple times in the same process,
// so statics will persist.
currentAppContext = appContext;
}
#ifdef DEBUG
void ClearCurrentAppContextForTests()
{
currentAppContext = nil;
}
#endif
void ExitShareExtension(void)
{
exit(0);
}
NS_ASSUME_NONNULL_END