Automatically open mail when fetching Anisette data and update error message to accomodate

This commit is contained in:
Josh-WikiRealty
2022-02-02 16:10:16 -08:00
committed by Joseph Mattello
parent 070cb6c873
commit 353d105c04
2 changed files with 10 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
// //
import Foundation import Foundation
import AppKit
private extension Bundle private extension Bundle
{ {
@@ -115,7 +116,14 @@ private extension AnisetteDataManager
let requestUUID = UUID().uuidString let requestUUID = UUID().uuidString
self.anisetteDataCompletionHandlers[requestUUID] = completion self.anisetteDataCompletionHandlers[requestUUID] = completion
let timer = Timer(timeInterval: 1.0, repeats: false) { (timer) in if let mailApp = FileManager.default.urls(
for: .applicationDirectory,
in: .systemDomainMask
).first?.appendingPathComponent("Mail.app") {
NSWorkspace.shared.open(mailApp)
}
let timer = Timer(timeInterval: 5.0, repeats: false) { (timer) in
self.finishRequest(forUUID: requestUUID, result: .failure(ALTServerError(.pluginNotFound))) self.finishRequest(forUUID: requestUUID, result: .failure(ALTServerError(.pluginNotFound)))
} }
self.anisetteDataTimers[requestUUID] = timer self.anisetteDataTimers[requestUUID] = timer

View File

@@ -158,7 +158,7 @@ NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSyste
return NSLocalizedString(@"Make sure you have trusted this device with your computer and Wi-Fi sync is enabled.", @""); return NSLocalizedString(@"Make sure you have trusted this device with your computer and Wi-Fi sync is enabled.", @"");
case ALTServerErrorPluginNotFound: case ALTServerErrorPluginNotFound:
return NSLocalizedString(@"Make sure Mail is running and the plug-in is enabled in Mail's preferences.", @""); return NSLocalizedString(@"Mail has been automatically opened, try again in a moment. Otherwise, make sure plug-in is enabled in Mail's preferences.", @"");
case ALTServerErrorMaximumFreeAppLimitReached: case ALTServerErrorMaximumFreeAppLimitReached:
#if TARGET_OS_OSX #if TARGET_OS_OSX