2017-11-29 20:51:39 +01:00
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MainAppContext.h"
|
|
|
|
|
2017-11-30 16:10:30 +01:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2017-11-29 20:51:39 +01:00
|
|
|
@implementation MainAppContext
|
|
|
|
|
|
|
|
- (BOOL)isMainApp
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)isMainAppAndActive
|
|
|
|
{
|
|
|
|
return [UIApplication sharedApplication].applicationState == UIApplicationStateActive;
|
|
|
|
}
|
|
|
|
|
2017-11-29 22:32:49 +01:00
|
|
|
- (UIApplicationState)mainApplicationState
|
|
|
|
{
|
|
|
|
return [UIApplication sharedApplication].applicationState;
|
|
|
|
}
|
|
|
|
|
2017-11-29 20:51:39 +01:00
|
|
|
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:
|
|
|
|
(BackgroundTaskExpirationHandler)expirationHandler
|
|
|
|
{
|
|
|
|
return [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:expirationHandler];
|
|
|
|
}
|
|
|
|
|
2017-11-29 21:27:19 +01:00
|
|
|
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)backgroundTaskIdentifier
|
|
|
|
{
|
|
|
|
[UIApplication.sharedApplication endBackgroundTask:backgroundTaskIdentifier];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setMainAppBadgeNumber:(NSInteger)value
|
|
|
|
{
|
|
|
|
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:value];
|
|
|
|
}
|
|
|
|
|
2017-11-29 20:51:39 +01:00
|
|
|
@end
|
2017-11-30 16:10:30 +01:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|