Merge pull request #13 from SideStore/pullrequests/jawshoeadan/master

Automatically open mail when fetching Anisette data and update error …
This commit is contained in:
Joe Mattiello
2022-06-03 23:35:40 -04:00
committed by GitHub
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