mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 08:52:20 +00:00
Remove alert pop-up in test scenarios to prevent main thread stalls
This commit is contained in:
@@ -55,6 +55,11 @@
|
||||
value = "YES"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
<EnvironmentVariable
|
||||
key = "MPIsRunningTests"
|
||||
value = "YES"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
|
||||
@@ -143,6 +143,11 @@ static MPAutotypeDaemon *_sharedInstance;
|
||||
if(!self.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(NSApplication.sharedApplication.isRunningTests) {
|
||||
return; // Do not display pop-up when running tests
|
||||
}
|
||||
|
||||
BOOL hideAlert = NO;
|
||||
if(nil != [NSUserDefaults.standardUserDefaults objectForKey:kMPSettingsKeyAutotypeHideAccessibiltyWarning]) {
|
||||
hideAlert = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyAutotypeHideAccessibiltyWarning];
|
||||
|
||||
@@ -31,6 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (copy, readonly) NSString *applicationName;
|
||||
@property (copy, readonly, nullable) NSURL *applicationSupportDirectoryURL;
|
||||
@property (nullable, readonly, weak) MPAppDelegate *mp_delegate;
|
||||
@property (readonly, nonatomic) BOOL isRunningTests;
|
||||
|
||||
- (NSURL *_Nullable)applicationSupportDirectoryURL:(BOOL)create;
|
||||
- (void)relaunchAfterDelay:(CGFloat)seconds;
|
||||
|
||||
@@ -66,4 +66,13 @@
|
||||
return (MPAppDelegate *)self.delegate;
|
||||
}
|
||||
|
||||
- (BOOL)isRunningTests {
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
NSString *testEnv = processInfo.environment[@"MPIsRunningTests"];
|
||||
if(testEnv) {
|
||||
return [testEnv isEqualToString:@"YES"];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user