mirror of https://github.com/oxen-io/session-ios
Add application context class.
parent
594544b264
commit
ffa69b3502
@ -0,0 +1,18 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
typedef void (^BackgroundTaskExpirationHandler)(void);
|
||||
|
||||
@protocol AppContext <NSObject>
|
||||
|
||||
- (BOOL)isMainApp;
|
||||
- (BOOL)isMainAppAndActive;
|
||||
|
||||
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:
|
||||
(BackgroundTaskExpirationHandler)expirationHandler;
|
||||
|
||||
@end
|
||||
|
||||
id<AppContext> CurrentAppContext();
|
||||
void SetCurrentAppContext(id<AppContext> appContext);
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AppContext.h"
|
||||
|
||||
static id<AppContext> currentAppContext = nil;
|
||||
|
||||
id<AppContext> CurrentAppContext()
|
||||
{
|
||||
OWSCAssert(currentAppContext);
|
||||
|
||||
return currentAppContext;
|
||||
}
|
||||
|
||||
void SetCurrentAppContext(id<AppContext> appContext)
|
||||
{
|
||||
OWSCAssert(!currentAppContext);
|
||||
|
||||
currentAppContext = appContext;
|
||||
}
|
Loading…
Reference in New Issue