mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Matlab
		
	
		
		
			
		
	
	
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Matlab
		
	
| 
								 
											5 years ago
										 
									 | 
							
								#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;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								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
							 |