Emit("error", &args);
}
+void AutoUpdater::OnCheckingForUpdate() {
+ Emit("checking-for-update");
+}
+
+void AutoUpdater::OnUpdateAvailable() {
+ Emit("update-available");
+}
+
void AutoUpdater::OnUpdateNotAvailable() {
Emit("update-not-available");
}
// AutoUpdaterDelegate implementations.
virtual void OnError(const std::string& error) OVERRIDE;
+ virtual void OnCheckingForUpdate() OVERRIDE;
+ virtual void OnUpdateAvailable() OVERRIDE;
virtual void OnUpdateNotAvailable() OVERRIDE;
virtual void OnUpdateDownloaded(
const std::string& release_notes,
// An error happened.
virtual void OnError(const std::string& error) {}
+ // Checking to see if there is an update
+ virtual void OnCheckingForUpdate() {}
+
+ // There is an update available and it is being downloaded
+ virtual void OnUpdateAvailable() {}
+
// There is no available update.
virtual void OnUpdateNotAvailable() {}
#import <ReactiveCocoa/RACCommand.h>
#import <ReactiveCocoa/RACSignal.h>
+#import <ReactiveCocoa/NSObject+RACPropertySubscribing.h>
#import <Squirrel/Squirrel.h>
#include "base/bind.h"
if (!has_update)
delegate->OnUpdateNotAvailable();
has_update = false;
+ [[g_updater rac_valuesForKeyPath:@"state" observer:g_updater]
+ subscribeNext:^(NSNumber *stateNumber) {
+ int state = [stateNumber integerValue];
+ if (state == SQRLUpdaterStateCheckingForUpdate) {
+ delegate->OnCheckingForUpdate();
+ }
+ else if (state == SQRLUpdaterStateDownloadingUpdate) {
+ delegate->OnUpdateAvailable();
+ }
}];
}
}