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 FOUNDATION_EXPORT NSNotificationName const kEXErrorRecoverySetPropsNotification DEPRECATED_ATTRIBUTE;
11 
12 @interface EXErrorRecoveryManager : NSObject
13   <EXKernelService, EXErrorRecoveryScopedModuleDelegate>
14 
15 /**
16  *  Associate arbitrary developer info with this experience id. If the experience recovers from an
17  *  error, we can pass this info to the new instance of the experience.
18  */
19 - (void)setDeveloperInfo: (NSDictionary *)developerInfo forExperienceid: (NSString *)experienceId;
20 - (NSDictionary *)developerInfoForExperienceId: (NSString *)experienceId;
21 
22 /**
23  *  Associate an error with an experience id. This will never be cleared until the next
24  *  call to `experienceFinishedLoadingWithId:`.
25  */
26 - (void)setError: (NSError *)error forExperienceId: (NSString *)experienceId;
27 
28 /**
29  *  Indicate that a JS bundle has successfully loaded for this experience id.
30  */
31 - (void)experienceFinishedLoadingWithId:(NSString *)experienceId;
32 
33 /**
34  *  True if any bridge for this experience id had an error, and has not successfully loaded
35  *  since the error was reported.
36  */
37 - (BOOL)experienceIdIsRecoveringFromError:(NSString *)experienceId;
38 
39 /**
40  *  True if this error object (by `isEqual:`) has been registered for any experience id.
41  */
42 - (BOOL)errorBelongsToExperience: (NSError *)error;
43 
44 /**
45  *  Whether we want to auto-reload this experience if it encounters a fatal error.
46  */
47 - (BOOL)experienceIdShouldReloadOnError: (NSString *)experienceId;
48 
49 /**
50  *  Back off to a less aggressive autoreload buffer time.
51  *  The longer the time, the longer a experience must wait before a fatal JS error triggers auto reload
52  *  via `experienceIdShouldReloadOnError:`.
53  */
54 - (void)increaseAutoReloadBuffer;
55 
56 @end
57