-
-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(app launch profiling): add integration and unit tests (#3558)
- Loading branch information
1 parent
da88ff3
commit b625d72
Showing
27 changed files
with
1,168 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// AppStartup.h | ||
// iOS-Swift | ||
// | ||
// Created by Andrew McKnight on 1/31/24. | ||
// Copyright © 2024 Sentry. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface AppStartup : NSObject | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#import "AppStartup.h" | ||
|
||
@implementation AppStartup | ||
|
||
// we must do this in objective c, because it's not permitted to be overridden in Swift | ||
+ (void)load | ||
{ | ||
if ([NSProcessInfo.processInfo.arguments containsObject:@"--io.sentry.wipe-data"]) { | ||
NSLog(@"[iOS-Swift] removing app data"); | ||
NSString *appSupport = [NSSearchPathForDirectoriesInDomains( | ||
NSApplicationSupportDirectory, NSUserDomainMask, true) firstObject]; | ||
NSString *cache = [NSSearchPathForDirectoriesInDomains( | ||
NSCachesDirectory, NSUserDomainMask, true) firstObject]; | ||
NSFileManager *fm = NSFileManager.defaultManager; | ||
for (NSString *dir in @[ appSupport, cache ]) { | ||
for (NSString *file in [fm enumeratorAtPath:dir]) { | ||
NSError *error; | ||
if (![fm removeItemAtPath:[dir stringByAppendingPathComponent:file] error:&error]) { | ||
NSLog(@"[iOS-Swift] failed to remove data at app startup."); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@end |
Oops, something went wrong.