1 // Copyright 2018-present 650 Industries. All rights reserved.
2 
3 #import <Foundation/Foundation.h>
4 #import <ExpoModulesCore/EXTaskInterface.h>
5 
6 NS_ASSUME_NONNULL_BEGIN
7 
8 // Interface for EXTaskManager module.
9 
10 @protocol EXTaskManagerInterface
11 
12 /**
13  *  Returns boolean value whether task with given taskName has been registered by the app.
14  */
15 - (BOOL)hasRegisteredTaskWithName:(NSString *)taskName;
16 
17 /**
18  *  Returns boolean value whether or not the task's consumer is a member of given class.
19  */
20 - (BOOL)taskWithName:(NSString *)taskName hasConsumerOfClass:(Class)consumerClass;
21 
22 /**
23  *  Registers task with given name, task consumer class and options.
24  *  Can throw an exception if task with given name is already registered
25  *  or given consumer class doesn't conform to EXTaskConsumerInterface protocol.
26  */
27 - (void)registerTaskWithName:(NSString *)taskName
28                     consumer:(Class)consumerClass
29                      options:(NSDictionary *)options;
30 
31 /**
32  *  Unregisters task with given name and consumer class.
33  *  Can throw an exception if the consumer class mismatches.
34  */
35 - (void)unregisterTaskWithName:(NSString *)taskName
36                  consumerClass:(nullable Class)consumerClass;
37 
38 /**
39  *  Returns boolean value whether the application contains
40  *  given backgroundMode in UIBackgroundModes field in Info.plist file.
41  */
42 - (BOOL)hasBackgroundModeEnabled:(NSString *)backgroundMode;
43 
44 /**
45  *  Called by task manager service to send an event with given body.
46  */
47 - (void)executeWithBody:(NSDictionary *)body;
48 
49 /**
50  *  Whether or not the module was initialized for headless (background) JS app.
51  */
52 - (BOOL)isRunningInHeadlessMode;
53 
54 @end
55 
56 NS_ASSUME_NONNULL_END
57