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