blob: be58355ad88b7657f08932432cb2a3fa903f28af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/*
* Copyright (c) 2016-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#import <SwifTools/AutoUpdater/SparkleAutoUpdaterDelegate.h>
#include <string>
#include <Swiften/Base/Log.h>
#include <SwifTools/Cocoa/CocoaUtil.h>
using namespace Swift;
@implementation SparkleAutoUpdaterDelegate
@synthesize onNewUpdateState;
- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast {
(void)updater;
(void)appcast;
onNewUpdateState(AutoUpdater::State::DownloadingUpdate);
}
- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update {
(void)updater;
(void)update;
}
- (id <SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)updater {
(void)updater;
return nil;
}
- (void)updaterDidNotFindUpdate:(SUUpdater *)updater {
(void)updater;
onNewUpdateState(AutoUpdater::State::NoUpdateAvailable);
}
- (void)updater:(SUUpdater *)updater willDownloadUpdate:(SUAppcastItem *)item withRequest:(NSMutableURLRequest *)request {
(void)updater;
(void)item;
(void)request;
onNewUpdateState(AutoUpdater::State::DownloadingUpdate);
}
- (void)updater:(SUUpdater *)updater failedToDownloadUpdate:(SUAppcastItem *)item error:(NSError *)error {
(void)updater;
(void)item;
SWIFT_LOG(error) << ns2StdString([error localizedDescription]) << std::endl;
onNewUpdateState(AutoUpdater::State::ErrorCheckingForUpdate);
}
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update {
(void)updater;
(void)update;
}
- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)item immediateInstallationInvocation:(NSInvocation *)invocation {
(void)updater;
(void)item;
(void)invocation;
onNewUpdateState(AutoUpdater::State::RestartToInstallUpdate);
}
- (void)updater:(SUUpdater *)updater didAbortWithError:(NSError *)error {
(void)updater;
if ([error code] == SUNoUpdateError) {
onNewUpdateState(AutoUpdater::State::NoUpdateAvailable);
}
else {
SWIFT_LOG(error) << ns2StdString([error localizedDescription]) << std::endl;
onNewUpdateState(AutoUpdater::State::ErrorCheckingForUpdate);
}
}
@end
|