1 // Copyright 2015-present 650 Industries. All rights reserved.
2 //
3 //  Keeps track of experience error state, including between reloads, so that we can
4 //  pass error recovery info to an experience which just reloaded.
5 //
6 
7 #import "EXErrorRecovery.h"
8 #import "EXKernelService.h"
9 
10 @interface EXErrorRecoveryManager : NSObject
11   <EXKernelService, EXErrorRecoveryScopedModuleDelegate>
12 
13 /**
14  *  Associate arbitrary developer info with this experience id. If the experience recovers from an
15  *  error, we can pass this info to the new instance of the experience.
16  */
17 - (void)setDeveloperInfo: (NSDictionary *)developerInfo forExperienceid: (NSString *)experienceId;
18 - (NSDictionary *)developerInfoForExperienceId: (NSString *)experienceId;
19 
20 /**
21  *  Associate an error with an experience id. This will never be cleared until the next
22  *  call to `experienceFinishedLoadingWithId:`.
23  */
24 - (void)setError: (NSError *)error forExperienceId: (NSString *)experienceId;
25 
26 /**
27  *  Indicate that a JS bundle has successfully loaded for this experience id.
28  */
29 - (void)experienceFinishedLoadingWithId:(NSString *)experienceId;
30 
31 /**
32  *  True if any bridge for this experience id had an error, and has not successfully loaded
33  *  since the error was reported.
34  */
35 - (BOOL)experienceIdIsRecoveringFromError:(NSString *)experienceId;
36 
37 /**
38  *  True if this error object (by `isEqual:`) has been registered for any experience id.
39  */
40 - (BOOL)errorBelongsToExperience: (NSError *)error;
41 
42 /**
43  *  Whether we want to auto-reload this experience if it encounters a fatal error.
44  */
45 - (BOOL)experienceIdShouldReloadOnError: (NSString *)experienceId;
46 
47 /**
48  *  Back off to a less aggressive autoreload buffer time.
49  *  The longer the time, the longer a experience must wait before a fatal JS error triggers auto reload
50  *  via `experienceIdShouldReloadOnError:`.
51  */
52 - (void)increaseAutoReloadBuffer;
53 
54 @end
55