mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Add acknowledgement handler to installation did finish
This commit is contained in:
1 parent
f65f4beda8
commit
6dddbcc353
9 files changed
+41
-22
No files matched your search
Vendored
+4
-2
@@ -378,9 +378,11 @@
|
||||
});
|
||||
}
|
||||
|
||||
- (void)showUpdateInstallationDidFinish
|
||||
- (void)showUpdateInstallationDidFinishWithAcknowledgement:(void (^)(void))acknowledgement
|
||||
{
|
||||
//...
|
||||
// Deciding not to show anything here
|
||||
[self.coreComponent registerAcknowledgement:acknowledgement];
|
||||
[self.coreComponent acceptAcknowledgement];
|
||||
}
|
||||
|
||||
#pragma mark Aborting Everything
|
||||
|
||||
Vendored
+3
-1
@@ -268,9 +268,11 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* This will only be invoked if the updater process is still alive, which is typically not the case if
|
||||
* the updater's lifetime is tied to the application it is updating.
|
||||
*
|
||||
* @param acknowledgement Acknowledge to the updater that the installation finish was shown.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdateInstallationDidFinish;
|
||||
- (void)showUpdateInstallationDidFinishWithAcknowledgement:(void (^)(void))acknowledgement;
|
||||
|
||||
/*!
|
||||
* Dismiss the current update installation
|
||||
|
||||
Vendored
+1
-1
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)installerIsRequestingAppTermination;
|
||||
|
||||
- (void)installerDidFinishInstallation;
|
||||
- (void)installerDidFinishInstallationWithAcknowledgement:(void(^)(void))acknowledgement;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+5
-3
@@ -247,10 +247,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerDidFinishInstallation
|
||||
- (void)installerDidFinishInstallationWithAcknowledgement:(void(^)(void))acknowledgement
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(installerDidFinishInstallation)]) {
|
||||
[self.delegate installerDidFinishInstallation];
|
||||
if ([self.delegate respondsToSelector:@selector(installerDidFinishInstallationWithAcknowledgement:)]) {
|
||||
[self.delegate installerDidFinishInstallationWithAcknowledgement:acknowledgement];
|
||||
} else {
|
||||
acknowledgement();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
||||
- (void)installerIsRequestingAppTermination;
|
||||
- (void)installerWillFinishInstallationAndRelaunch:(BOOL)relaunch;
|
||||
- (void)installerDidFinishInstallation;
|
||||
- (void)installerDidFinishInstallationWithAcknowledgement:(void(^)(void))acknowledgement;
|
||||
|
||||
- (void)installerIsRequestingAbortInstallWithError:(nullable NSError *)error;
|
||||
- (void)installerDidFailToApplyDeltaUpdate;
|
||||
|
||||
Vendored
+5
-2
@@ -284,8 +284,11 @@
|
||||
[self.installerConnection invalidate];
|
||||
self.installerConnection = nil;
|
||||
|
||||
[self.delegate installerDidFinishInstallation];
|
||||
[self.delegate installerIsRequestingAbortInstallWithError:nil];
|
||||
[self.delegate installerDidFinishInstallationWithAcknowledgement:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.delegate installerIsRequestingAbortInstallWithError:nil];
|
||||
});
|
||||
}];
|
||||
} else if (identifier == SPUUpdaterAlivePing) {
|
||||
// Don't update the current stage; a ping request has no effect on that.
|
||||
[self.installerConnection handleMessageWithIdentifier:SPUUpdaterAlivePong data:[NSData data]];
|
||||
|
||||
Vendored
+2
-2
@@ -215,9 +215,9 @@
|
||||
[self.userDriver terminateApplication];
|
||||
}
|
||||
|
||||
- (void)installerDidFinishInstallation
|
||||
- (void)installerDidFinishInstallationWithAcknowledgement:(void(^)(void))acknowledgement
|
||||
{
|
||||
[self.userDriver showUpdateInstallationDidFinish];
|
||||
[self.userDriver showUpdateInstallationDidFinishWithAcknowledgement:acknowledgement];
|
||||
}
|
||||
|
||||
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error
|
||||
|
||||
@@ -224,6 +224,14 @@
|
||||
|
||||
#pragma mark Update Errors
|
||||
|
||||
- (void)acceptAcknowledgementAfterDelay
|
||||
{
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// Installation will be dismissed shortly after this
|
||||
[self.coreComponent acceptAcknowledgement];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)showUpdaterError:(NSError *)error acknowledgement:(void (^)(void))acknowledgement
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@@ -232,10 +240,7 @@
|
||||
NSLog(@"Error: %@", error);
|
||||
[self addUpdateButtonWithTitle:@"Update Errored!" action:nil];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// Installation will be dismissed shortly after this
|
||||
[self.coreComponent acceptAcknowledgement];
|
||||
});
|
||||
[self acceptAcknowledgementAfterDelay];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -246,10 +251,7 @@
|
||||
|
||||
[self addUpdateButtonWithTitle:@"No Update Available" action:nil];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
// Installation will be dismissed shortly after this
|
||||
[self.coreComponent acceptAcknowledgement];
|
||||
});
|
||||
[self acceptAcknowledgementAfterDelay];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -302,10 +304,14 @@
|
||||
});
|
||||
}
|
||||
|
||||
- (void)showUpdateInstallationDidFinish
|
||||
- (void)showUpdateInstallationDidFinishWithAcknowledgement:(void (^)(void))acknowledgement
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.coreComponent registerAcknowledgement:acknowledgement];
|
||||
|
||||
[self addUpdateButtonWithTitle:@"Installation Finished!"];
|
||||
|
||||
[self acceptAcknowledgementAfterDelay];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -285,12 +285,16 @@
|
||||
});
|
||||
}
|
||||
|
||||
- (void)showUpdateInstallationDidFinish
|
||||
- (void)showUpdateInstallationDidFinishWithAcknowledgement:(void (^)(void))acknowledgement
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.coreComponent registerAcknowledgement:acknowledgement];
|
||||
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Installation Finished.\n");
|
||||
}
|
||||
|
||||
[self.coreComponent acceptAcknowledgement];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user