Skip to content

Commit e100447

Browse files
joshrad-devJoeMatt
authored andcommitted
Automatically open mail when fetching Anisette data and update error message to accomodate
1 parent e671363 commit e100447

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

AltServer/AnisetteDataManager.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Foundation
10+
import AppKit
1011

1112
private extension Bundle
1213
{
@@ -115,7 +116,14 @@ private extension AnisetteDataManager
115116
let requestUUID = UUID().uuidString
116117
self.anisetteDataCompletionHandlers[requestUUID] = completion
117118

118-
let timer = Timer(timeInterval: 1.0, repeats: false) { (timer) in
119+
if let mailApp = FileManager.default.urls(
120+
for: .applicationDirectory,
121+
in: .systemDomainMask
122+
).first?.appendingPathComponent("Mail.app") {
123+
NSWorkspace.shared.open(mailApp)
124+
}
125+
126+
let timer = Timer(timeInterval: 5.0, repeats: false) { (timer) in
119127
self.finishRequest(forUUID: requestUUID, result: .failure(ALTServerError(.pluginNotFound)))
120128
}
121129
self.anisetteDataTimers[requestUUID] = timer

Shared/Categories/NSError+ALTServerError.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ - (nullable NSString *)altserver_localizedRecoverySuggestion
158158
return NSLocalizedString(@"Make sure you have trusted this device with your computer and Wi-Fi sync is enabled.", @"");
159159

160160
case ALTServerErrorPluginNotFound:
161-
return NSLocalizedString(@"Make sure Mail is running and the plug-in is enabled in Mail's preferences.", @"");
161+
return NSLocalizedString(@"Mail has been automatically opened, try again in a moment. Otherwise, make sure plug-in is enabled in Mail's preferences.", @"");
162162

163163
case ALTServerErrorMaximumFreeAppLimitReached:
164164
#if TARGET_OS_OSX

0 commit comments

Comments
 (0)