From 353d105c047356cb9ef9a47dba0cec765095b2ce Mon Sep 17 00:00:00 2001 From: Josh-WikiRealty <62785552+jawshoeadan@users.noreply.github.com> Date: Wed, 2 Feb 2022 16:10:16 -0800 Subject: [PATCH] Automatically open mail when fetching Anisette data and update error message to accomodate --- AltServer/AnisetteDataManager.swift | 10 +++++++++- Shared/Categories/NSError+ALTServerError.m | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/AltServer/AnisetteDataManager.swift b/AltServer/AnisetteDataManager.swift index a54cf02f..bd45f67b 100644 --- a/AltServer/AnisetteDataManager.swift +++ b/AltServer/AnisetteDataManager.swift @@ -7,6 +7,7 @@ // import Foundation +import AppKit private extension Bundle { @@ -115,7 +116,14 @@ private extension AnisetteDataManager let requestUUID = UUID().uuidString 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.anisetteDataTimers[requestUUID] = timer diff --git a/Shared/Categories/NSError+ALTServerError.m b/Shared/Categories/NSError+ALTServerError.m index dfb5a1ba..4d75a777 100644 --- a/Shared/Categories/NSError+ALTServerError.m +++ b/Shared/Categories/NSError+ALTServerError.m @@ -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.", @""); 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: #if TARGET_OS_OSX