Skip to content

Commit

Permalink
Make appWasBackgroundedOnExist a visible property
Browse files Browse the repository at this point in the history
This is useful to show messaging in app, before crashlytics has loaded
to determine what type of crash it was.
  • Loading branch information
wibge authored and JesseCrocker committed Dec 12, 2016
1 parent bd74a1d commit 69f06c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions TBOOMDetector/TBOOMDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef NS_ENUM(NSInteger, TBTerminationType) {
@interface TBOOMDetector : NSObject

@property (nonatomic, readonly) TBTerminationType lastTerminationType;
@property (nonatomic, readonly) BOOL appWasBackgroundedOnExit;

- (instancetype)initWithCrashlyticsApiKey:(NSString*)apiKey
directory:(NSString*)directory
Expand Down
7 changes: 3 additions & 4 deletions TBOOMDetector/TBOOMDetector.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ @interface TBOOMDetector () <CrashlyticsDelegate> {
NSString *backgroundStateFile;
NSString *terminationEventFileContents;
BOOL crashWasDetected;
BOOL appWasBackgroundedOnExit;
NSString *stateDirectory;
}

Expand Down Expand Up @@ -63,10 +62,10 @@ - (instancetype)initWithCrashlyticsApiKey:(NSString*)apiKey
}

backgroundStateFile = [directory stringByAppendingString:@"OOMDetectorBackgroundState.bool"];
appWasBackgroundedOnExit = NO;
_appWasBackgroundedOnExit = NO;
if([[NSFileManager defaultManager] fileExistsAtPath:backgroundStateFile]) {
[[NSFileManager defaultManager] removeItemAtPath:backgroundStateFile error:nil];
appWasBackgroundedOnExit = YES;
_appWasBackgroundedOnExit = YES;
}

//Wait for crashlytics to run, so we know if there was a crash
Expand Down Expand Up @@ -103,7 +102,7 @@ - (void)runChecks:(void (^)(TBTerminationType terminationType))callback; {
} else if ([terminationEventFileContents isEqualToString:@"debugger"]) {
terminationType = TBTerminationTypeDebugger;
} else {
if(appWasBackgroundedOnExit) {
if(_appWasBackgroundedOnExit) {
NSLog(@"Detected Background OOM");
terminationType = TBTerminationTypeBackgroundOom;
} else {
Expand Down

0 comments on commit 69f06c7

Please sign in to comment.