mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-23 04:34:27 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76acd9cb5f | ||
|
|
e4b2d96faf | ||
|
|
9229fc57b1 | ||
|
|
c396a53c6f | ||
|
|
2a67e2d732 | ||
|
|
a135f1a1ee | ||
|
|
30361b0128 | ||
|
|
cce5edd78d |
No files matched your search
@@ -20,8 +20,13 @@ jobs:
|
||||
- name: "Checkout sources"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "Extract latest changes from CHANGELOG"
|
||||
run: |
|
||||
./Configurations/generate_latest_changes.py > latest-changes.txt
|
||||
|
||||
- name: "Extract version information from project"
|
||||
run: |
|
||||
@@ -37,19 +42,22 @@ jobs:
|
||||
echo "PRERELEASE_VERSION=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: "Create a temporary Git tag"
|
||||
run: git tag "${{ env.MARKETING_VERSION }}"
|
||||
- name: "Set up git and create tag"
|
||||
run: |
|
||||
git config user.name Sparkle-Bot
|
||||
git config user.email sparkle.project.bot@gmail.com
|
||||
git tag "${{ env.MARKETING_VERSION }}"
|
||||
|
||||
- name: "Build release distribution"
|
||||
run: make release
|
||||
env:
|
||||
GITHUB_ACTOR: ${{ github.actor }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
MARKETING_VERSION: ${{ env.MARKETING_VERSION }}
|
||||
SPARKLE_VERSION_SUFFIX: ${{ env.SPARKLE_VERSION_SUFFIX }}
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
|
||||
- name: "Push the updated Swift package description"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
run: git push
|
||||
|
||||
- name: "Draft a release"
|
||||
@@ -60,6 +68,8 @@ jobs:
|
||||
name: "Sparkle ${{ env.MARKETING_VERSION }}"
|
||||
tag_name: ${{ env.MARKETING_VERSION }}
|
||||
fail_on_unmatched_files: true
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
body_path: latest-changes.txt
|
||||
files: |
|
||||
build/Build/Products/Release/Sparkle-*.tar.xz
|
||||
build/Build/Products/Release/Sparkle-for-Swift-Package-Manager.zip
|
||||
@@ -23,8 +23,8 @@ SPARKLE_VERSION_MINOR = 0
|
||||
SPARKLE_VERSION_PATCH = 0
|
||||
|
||||
// This should be in SemVer format or empty, ie. "-beta.1"
|
||||
SPARKLE_VERSION_SUFFIX = -beta.1
|
||||
CURRENT_PROJECT_VERSION = 2001
|
||||
SPARKLE_VERSION_SUFFIX = -beta.2
|
||||
CURRENT_PROJECT_VERSION = 2002
|
||||
|
||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os, sys
|
||||
|
||||
# Ignore the first version line starting with # x.y.z..
|
||||
# and print everything until the second version line starting with # x.y.z..
|
||||
|
||||
hit_first_changelog_note = False
|
||||
with open("CHANGELOG", "r") as changelog_file:
|
||||
for line in changelog_file:
|
||||
if line.startswith("#"):
|
||||
if hit_first_changelog_note:
|
||||
# We are done with printing changes
|
||||
break
|
||||
else:
|
||||
# We haven't hit an important changelog line yet, so continue
|
||||
continue
|
||||
|
||||
if not hit_first_changelog_note and len(line.strip()) == 0:
|
||||
continue
|
||||
|
||||
hit_first_changelog_note = True
|
||||
sys.stdout.write(line)
|
||||
@@ -0,0 +1,12 @@
|
||||
# Sparkle 2 API Reference
|
||||
|
||||
These are the primary classes and protocols in Sparkle 2 you may be interested in:
|
||||
|
||||
- `SPUStandardUpdaterController` for creating a standard updater (encapsulates a `SPUUpdater` and `SPUStandardUserDriver`)
|
||||
- `SPUUpdater` for invoking update checks and retrieving updater properties.
|
||||
- `SPUUpdaterDelegate` for delegation methods to control the behavior of `SPUUpdater`.
|
||||
- `SPUUserDriver` for making custom user interfaces.
|
||||
|
||||
If you are migrating from Sparkle 1, please refer to `SPUStandardUpdaterController` and `SPUUpdater`.
|
||||
|
||||
Please also visit the [Basic Setup](https://sparkle-project.org/documentation/) guide which shows how to instantiate an updater in a nib or how to create one programmatically.
|
||||
@@ -1,20 +0,0 @@
|
||||
PROJECT_NAME = Sparkle
|
||||
PROJECT_NUMBER = 1.14.0
|
||||
PROJECT_BRIEF = "A software update framework for macOS"
|
||||
PROJECT_LOGO = Resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png
|
||||
|
||||
RECURSIVE = YES
|
||||
INPUT = Sparkle
|
||||
OUTPUT_DIRECTORY = Documentation
|
||||
|
||||
GENERATE_HTML = YES
|
||||
GENERATE_LATEX = NO
|
||||
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
QT_AUTOBRIEF = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
@@ -13,9 +13,9 @@
|
||||
### Launching the Installer
|
||||
SPUCoreBasedUpdateDriver invokes SPUInstallerDriver's extraction method which invokes SUInstallerLauncher's launch installer method. The launcher can be inside a XPC service or running inside the updater/sparkle framework itself. The launcher XPC bundle includes a copy of the installer and agent application in its bundle so it can compute the path to them itself (instead of relying on the updater to pass the paths), which is for security trust reasons.
|
||||
|
||||
First, the launcher makes sure that if the updater delegate doesn't allow interaction, that installation can be done without interaction. If it can't, then the launcher fails. If the updater driver that invoked the launcher doesn't allow for interaction (in particular, the automatic/silent update driver does not allow interaction), then the launcher fails with a hint to try again with interaction enabled (in particular, with a UI based update driver). If this happens, the updater keeps a reference to the downloaded update and appcast item that is used for resuming with a UI based update driver later. The launcher in this case is telling that authorization can only be done if interaction is allowed from the driver, so the user can enter their password to start up the installer as root to install over a location that requires such privileges.
|
||||
First, if the updater driver that invoked the launcher doesn't allow for interaction (in particular, the automatic/silent update driver does not allow interaction), then the launcher fails with a hint to try again with interaction enabled (in particular, with a UI based update driver). If this happens, the updater keeps a reference to the downloaded update and appcast item that is used for resuming with a UI based update driver later. The launcher in this case is telling that authorization can only be done if interaction is allowed from the driver, so the user can enter their password to start up the installer as root to install over a location that requires such privileges.
|
||||
|
||||
The launcher then looks for the installer and agent application first in its bundle's auxiliary directory path, and then its resources path. If the launcher is running inside a XPC service, the tools will be in the auxiliary path location, which allows the developer using the service to also code sign the tools. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative depedencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
|
||||
The launcher then looks for the installer and agent application first in its bundle's auxiliary directory path. Once those paths are found, the launcher copies the progress agent application to a temporary cache location. The installer is not copied because it is a plain single executable that does not rely on external relative dependencies, whereas the agent application relies on bundle resources. This is important to consider because the old application may be moved around and removed when the installation process occurs. Leaving the installer inside its bundle also could leave it in a place the user doesn't necessarily have write privileges to.
|
||||
|
||||
The installer is first submitted. If it requires root privileges, it will ask for an admin user name and password. How it determines if root privileges are necessary is based on:
|
||||
|
||||
@@ -27,7 +27,7 @@ The installer makes sure, after extraction, that the expected installation type
|
||||
|
||||
If the user cancels submitting the installer on authorization (if it's required), the launcher aborts the installation process silently. If everything does alright, the progress agent application is submitted next. If either of the submissions fail, the installation fails and aborts, otherwise the launcher succeeds and its job is done. Note before the submissions are done, the jobs are removed from launchd, and the jobs are submitted in a way that act as "one-time" jobs. If they fail or succeed, the jobs aren't restarted, and the jobs aren't installed in a system location for launchd to attempt launching again.
|
||||
|
||||
The only argument passed to the installer is the host bundle identifier of the bundle to update. This bundle identifier is used so that the installer and updater know what Mach service to connect to for IPC. Everything else to the installer is sent via a XPC connection. The host bundle path is passed to the progress agent, which is just used for obtaining the bundle identifier, and for UI purposes (eg: displaying app icon and name when the app needs to show progress). The type of domain the installer is running in (user vs system) is also passed to the progress agent application so it can know which domain to use to connect to the installer.
|
||||
The most important argument passed to the installer is the host bundle identifier of the bundle to update. This bundle identifier is used so that the installer and updater know what Mach service to connect to for IPC. Mostly everything else to the installer is sent via a XPC connection. The host bundle path is passed to the progress agent, which is just used for obtaining the bundle identifier, and for UI purposes (eg: displaying app icon and name when the app needs to show progress). The type of domain the installer is running in (user vs system) is also passed to the progress agent application so it can know which domain to use to connect to the installer.
|
||||
|
||||
### Timeouts
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// SUInstallerLauncher+Private.h
|
||||
// SUInstallerLauncher+Private
|
||||
//
|
||||
// Created by Mayur Pawashe on 8/21/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SUInstallerLauncher_Private_h
|
||||
#define SUInstallerLauncher_Private_h
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
// Chances are clients will need this too
|
||||
#import <Sparkle/SPUInstallationType.h>
|
||||
|
||||
@class NSString;
|
||||
|
||||
/**
|
||||
Private API for determining if the system needs authorization access to update a bundle path
|
||||
|
||||
This API is not supported when used directly from a Sandboxed applications and will always return @c YES in that case.
|
||||
|
||||
@param bundlePath The bundle path to test if authorization is needed when performing an update that replaces this bundle.
|
||||
@return @c YES if Sparkle thinks authorization is needed to update the @p bundlePath, otherwise @c NO.
|
||||
*/
|
||||
SU_EXPORT BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath);
|
||||
|
||||
#endif /* SUInstallerLauncher_Private_h */
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "SUInstallerLauncher.h"
|
||||
#import "SUInstallerLauncher+Private.h"
|
||||
#import "SUFileManager.h"
|
||||
#import "SULog.h"
|
||||
#import "SPUMessageTypes.h"
|
||||
@@ -315,7 +316,44 @@
|
||||
return resolvedAuxiliaryToolURL.path;
|
||||
}
|
||||
|
||||
static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installationType)
|
||||
BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath)
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
BOOL hasWritability = [fileManager isWritableFileAtPath:bundlePath] && [fileManager isWritableFileAtPath:[bundlePath stringByDeletingLastPathComponent]];
|
||||
|
||||
BOOL needsAuthorization;
|
||||
if (!hasWritability) {
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
// Just because we have writability access does not mean we can set the correct owner/group
|
||||
// Test if we can set the owner/group on a temporarily created file
|
||||
// If we can, then we can probably perform an update without authorization
|
||||
|
||||
NSString *tempFilename = @"permission_test" ;
|
||||
|
||||
SUFileManager *suFileManager = [[SUFileManager alloc] init];
|
||||
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryWithPreferredName:tempFilename appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
|
||||
|
||||
if (tempDirectoryURL == nil) {
|
||||
// I don't imagine this ever happening but in case it does, requesting authorization may be the better option
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
NSURL *tempFileURL = [tempDirectoryURL URLByAppendingPathComponent:tempFilename];
|
||||
if (![[NSData data] writeToURL:tempFileURL atomically:NO]) {
|
||||
// Obvious indicator we may need authorization
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
needsAuthorization = ![suFileManager changeOwnerAndGroupOfItemAtRootURL:tempFileURL toMatchURL:[NSURL fileURLWithPath:bundlePath] error:NULL];
|
||||
}
|
||||
|
||||
[suFileManager removeItemAtURL:tempDirectoryURL error:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
return needsAuthorization;
|
||||
}
|
||||
|
||||
static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installationType)
|
||||
{
|
||||
BOOL needsAuthorization;
|
||||
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||
@@ -323,45 +361,17 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
|
||||
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
needsAuthorization = NO;
|
||||
} else {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
BOOL hasWritability = [fileManager isWritableFileAtPath:path] && [fileManager isWritableFileAtPath:[path stringByDeletingLastPathComponent]];
|
||||
if (!hasWritability) {
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
// Just because we have writability access does not mean we can set the correct owner/group
|
||||
// Test if we can set the owner/group on a temporarily created file
|
||||
// If we can, then we can probably perform an update without authorization
|
||||
|
||||
NSString *tempFilename = @"permission_test" ;
|
||||
|
||||
SUFileManager *suFileManager = [[SUFileManager alloc] init];
|
||||
NSURL *tempDirectoryURL = [suFileManager makeTemporaryDirectoryWithPreferredName:tempFilename appropriateForDirectoryURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] error:NULL];
|
||||
|
||||
if (tempDirectoryURL == nil) {
|
||||
// I don't imagine this ever happening but in case it does, requesting authorization may be the better option
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
NSURL *tempFileURL = [tempDirectoryURL URLByAppendingPathComponent:tempFilename];
|
||||
if (![[NSData data] writeToURL:tempFileURL atomically:NO]) {
|
||||
// Obvious indicator we may need authorization
|
||||
needsAuthorization = YES;
|
||||
} else {
|
||||
needsAuthorization = ![suFileManager changeOwnerAndGroupOfItemAtRootURL:tempFileURL toMatchURL:[NSURL fileURLWithPath:path] error:NULL];
|
||||
}
|
||||
|
||||
[suFileManager removeItemAtURL:tempDirectoryURL error:NULL];
|
||||
}
|
||||
}
|
||||
needsAuthorization = SPUSystemNeedsAuthorizationAccessForBundlePath(path);
|
||||
}
|
||||
return needsAuthorization;
|
||||
}
|
||||
|
||||
|
||||
// Note: do not pass untrusted information such as paths to the installer and progress agent tools, when we can find them ourselves here
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
BOOL needsSystemAuthorization = SPUNeedsSystemAuthorizationAccess(hostBundlePath, installationType);
|
||||
BOOL needsSystemAuthorization = SPUSystemNeedsAuthorizationAccess(hostBundlePath, installationType);
|
||||
|
||||
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
|
||||
if (hostBundle == nil) {
|
||||
@@ -372,18 +382,6 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
|
||||
return;
|
||||
}
|
||||
|
||||
if (needsSystemAuthorization && !allowingUpdaterInteraction) {
|
||||
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher.");
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!allowingUpdaterInteraction && [installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
SULog(SULogLevelError, @"Updater is not allowing interaction to the launcher for performing an interactive type package installation.");
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
return;
|
||||
}
|
||||
|
||||
// if we need to use the system domain and we aren't allowed interaction, then try sometime later when interaction is allowed
|
||||
if (needsSystemAuthorization && !allowingDriverInteraction) {
|
||||
completionHandler(SUInstallerLauncherAuthorizeLater, needsSystemAuthorization);
|
||||
@@ -462,10 +460,4 @@ static BOOL SPUNeedsSystemAuthorizationAccess(NSString *path, NSString *installa
|
||||
});
|
||||
}
|
||||
|
||||
- (void)checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:(NSString *)hostBundlePath reply:(void(^)(BOOL))reply
|
||||
{
|
||||
// No need to execute on main queue
|
||||
reply(SPUNeedsSystemAuthorizationAccess(hostBundlePath, SPUInstallationTypeApplication));
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
@protocol SUInstallerLauncherProtocol
|
||||
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction allowingUpdaterInteraction:(BOOL)allowingUpdaterInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
|
||||
|
||||
- (void)checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:(NSString *)hostBundlePath reply:(void(^)(BOOL requiresAuthorization))reply;
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
|
||||
|
||||
@end
|
||||
@@ -25,7 +25,7 @@ build:
|
||||
|
||||
# Need to first gem install jazzy to run this rule
|
||||
docs:
|
||||
jazzy --objc --umbrella-header Sparkle/Sparkle.h --framework-root . --output Documentation/html
|
||||
jazzy --objc --umbrella-header Sparkle/Sparkle.h --framework-root . --readme Documentation/API_README.markdown --theme jony --output Documentation/html
|
||||
|
||||
uitest:
|
||||
xcodebuild -scheme UITests -configuration Debug test
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
import PackageDescription
|
||||
|
||||
// Version is technically not required here, SPM doesn't check
|
||||
let version = "2.0.0-beta.1"
|
||||
let version = "2.0.0-beta.2"
|
||||
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
|
||||
let tag = "2.0.0-beta.1"
|
||||
let checksum = "389a58bc0b333d9d18c8fa2d72aacbf4905d5d59a9858ecd9a5b16ff769bb5c5"
|
||||
let tag = "2.0.0-beta.2"
|
||||
let checksum = "0df58f522a002b6a2d0c02fd2a2828e6c7e1ca387680023e2dffa633c7a3ff61"
|
||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
let package = Package(
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "2.0.0-beta.1"
|
||||
s.version = "2.0.0-beta.2"
|
||||
s.summary = "A software update framework for macOS"
|
||||
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
|
||||
s.homepage = "http://sparkle-project.org"
|
||||
s.documentation_url = "http://sparkle-project.org/documentation/"
|
||||
s.screenshot = "http://sparkle-project.org/images/screenshot-noshadow@2x.png"
|
||||
s.homepage = "https://sparkle-project.org"
|
||||
s.documentation_url = "https://sparkle-project.org/documentation/"
|
||||
s.screenshot = "https://sparkle-project.org/images/screenshot-noshadow@2x.png"
|
||||
s.license = {
|
||||
:type => 'MIT',
|
||||
:file => 'LICENSE'
|
||||
@@ -22,7 +22,7 @@ Pod::Spec.new do |s|
|
||||
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.bz2" }
|
||||
s.source_files = 'Sparkle.framework/Versions/A/Headers/*.h'
|
||||
|
||||
s.preserve_paths = 'bin/*'
|
||||
s.preserve_paths = ['bin/*', 'XPCServices/*']
|
||||
s.public_header_files = 'Sparkle.framework/Versions/A/Headers/*.h'
|
||||
s.vendored_frameworks = 'Sparkle.framework'
|
||||
s.xcconfig = {
|
||||
|
||||
@@ -370,6 +370,9 @@
|
||||
72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */; };
|
||||
72EB87EB1CB8859100C37F42 /* Updater.app in Copy Tools */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; };
|
||||
72EE17FB26D1CC8800C58B19 /* SUInstallerLauncher+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
72EE17FC26D1CC9D00C58B19 /* SPUInstallationType.h in Headers */ = {isa = PBXBuildFile; fileRef = 7214B8851D45AD9A00CB5CED /* SPUInstallationType.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
72EE181926DAE70900C58B19 /* SPUUpdateCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
72EF30BE2675CF38008CE987 /* SPUAppcastItemStateResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EF30BA2675CF38008CE987 /* SPUAppcastItemStateResolver.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
72EF30BF2675CF38008CE987 /* SPUAppcastItemState.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BB2675CF38008CE987 /* SPUAppcastItemState.m */; };
|
||||
72EF30C02675CF38008CE987 /* SPUAppcastItemStateResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.m */; };
|
||||
@@ -804,7 +807,6 @@
|
||||
0263187214FEBB31005EBF43 /* uk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
|
||||
1420DF4E196247B500203BB0 /* Doxyfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Doxyfile; sourceTree = "<group>"; };
|
||||
1420DF4F196247F900203BB0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
142E0E0819A83AAC00E4312B /* SUBinaryDeltaTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaTest.m; sourceTree = "<group>"; };
|
||||
14652F7919A93E5F00959E44 /* set-git-version-info.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-git-version-info.sh"; sourceTree = "<group>"; };
|
||||
@@ -1274,6 +1276,8 @@
|
||||
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUpdateSettingsWindowController.xib; sourceTree = "<group>"; };
|
||||
72E45CFB1B641961005C701A /* sparkletestcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sparkletestcast.xml; sourceTree = "<group>"; };
|
||||
72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; };
|
||||
72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SUInstallerLauncher+Private.h"; sourceTree = "<group>"; };
|
||||
72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUUpdateCheck.h; sourceTree = "<group>"; };
|
||||
72EF30BA2675CF38008CE987 /* SPUAppcastItemStateResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUAppcastItemStateResolver.h; sourceTree = "<group>"; };
|
||||
72EF30BB2675CF38008CE987 /* SPUAppcastItemState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUAppcastItemState.m; sourceTree = "<group>"; };
|
||||
72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUAppcastItemStateResolver.m; sourceTree = "<group>"; };
|
||||
@@ -1599,7 +1603,6 @@
|
||||
1420DE391962322200203BB0 /* Documentation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1420DF4E196247B500203BB0 /* Doxyfile */,
|
||||
721D8A891D4D273E0032E472 /* Internal */,
|
||||
);
|
||||
path = Documentation;
|
||||
@@ -1957,6 +1960,7 @@
|
||||
720E21791D0D00BF003A311C /* SPUUpdaterCycle.h */,
|
||||
720E217A1D0D00BF003A311C /* SPUUpdaterCycle.m */,
|
||||
72F9EC471D5EA7D3004AC8B6 /* SPUUpdaterDelegate.h */,
|
||||
72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */,
|
||||
726E078B1CA891E9001A286B /* SPUUpdaterSettings.h */,
|
||||
726E078C1CA891E9001A286B /* SPUUpdaterSettings.m */,
|
||||
72F9EC3D1D5E823F004AC8B6 /* SPUUpdaterTimer.h */,
|
||||
@@ -2091,6 +2095,7 @@
|
||||
726E07B51CAF08D6001A286B /* Info.plist */,
|
||||
726E07B31CAF08D6001A286B /* main.m */,
|
||||
726E07B01CAF08D6001A286B /* SUInstallerLauncher.h */,
|
||||
72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */,
|
||||
726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */,
|
||||
726E07AF1CAF08D6001A286B /* SUInstallerLauncherProtocol.h */,
|
||||
721652671D3C8FED00FD13D8 /* SUInstallerLauncherStatus.h */,
|
||||
@@ -2327,6 +2332,7 @@
|
||||
7229E1BD1C98EFF200CB50D0 /* SPUDownloadDriver.h in Headers */,
|
||||
7267E5FD1D3DD1B700D1BF90 /* SPUResumableUpdate.h in Headers */,
|
||||
7267E5B61D3D8AEE00D1BF90 /* SPUInstallationInfo.h in Headers */,
|
||||
72EE181926DAE70900C58B19 /* SPUUpdateCheck.h in Headers */,
|
||||
72B767CE1C9B924900A07552 /* SPUInstallerDriver.h in Headers */,
|
||||
723ABF30259D062F00BDB4FA /* SULegacyWebView.h in Headers */,
|
||||
721BC20E1D1CDE55002BC71E /* SPULocalCacheDirectory.h in Headers */,
|
||||
@@ -2339,8 +2345,10 @@
|
||||
7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */,
|
||||
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */,
|
||||
726E4A371C89116000C57C6A /* SPUStandardUserDriverDelegate.h in Headers */,
|
||||
72EE17FC26D1CC9D00C58B19 /* SPUInstallationType.h in Headers */,
|
||||
72EF30BE2675CF38008CE987 /* SPUAppcastItemStateResolver.h in Headers */,
|
||||
72EF30C7267C716A008CE987 /* SUAppcastItem+Private.h in Headers */,
|
||||
72EE17FB26D1CC8800C58B19 /* SUInstallerLauncher+Private.h in Headers */,
|
||||
61299A5C09CA6D4500B7442F /* SUConstants.h in Headers */,
|
||||
726DF88E1C84277600188804 /* SPUUserUpdateState.h in Headers */,
|
||||
72B767DA1C9CD2E400A07552 /* SPUUIBasedUpdateDriver.h in Headers */,
|
||||
|
||||
Vendored
+13
-26
@@ -47,44 +47,31 @@
|
||||
// The user driver is only used for a termination callback
|
||||
_userDriver = userDriver;
|
||||
_updaterDelegate = updaterDelegate;
|
||||
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updateCheck:SPUUpdateCheckUpdatesInBackground updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
|
||||
{
|
||||
[self.coreDriver prepareCheckForUpdatesWithCompletion:completionBlock];
|
||||
|
||||
[self.coreDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:^(NSError * _Nullable error) {
|
||||
if (error != nil) {
|
||||
[self abortUpdateWithError:error];
|
||||
} else {
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES];
|
||||
}
|
||||
}];
|
||||
[self.coreDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#if __has_warning("-Wcompletion-handler")
|
||||
#pragma clang diagnostic ignored "-Wcompletion-handler"
|
||||
#endif
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)__unused completionBlock
|
||||
#pragma clang diagnostic pop
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
// Nothing really to do here.. this shouldn't be called.
|
||||
SULog(SULogLevelError, @"Error: resumeInstallingUpdateWithCompletion: called on SPUAutomaticUpdateDriver");
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES];
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#if __has_warning("-Wcompletion-handler")
|
||||
#pragma clang diagnostic ignored "-Wcompletion-handler"
|
||||
#endif
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)__unused resumableUpdate completion:(SPUUpdateDriverCompletion)__unused completionBlock
|
||||
#pragma clang diagnostic pop
|
||||
- (void)resumeInstallingUpdate
|
||||
{
|
||||
// Nothing really to do here.. this shouldn't be called.
|
||||
SULog(SULogLevelError, @"Error: resumeDownloadedUpdate:completion: called on SPUAutomaticUpdateDriver");
|
||||
SULog(SULogLevelError, @"Error: resumeInstallingUpdate: called on SPUAutomaticUpdateDriver");
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)__unused resumableUpdate
|
||||
{
|
||||
// Nothing really to do here.. this shouldn't be called.
|
||||
SULog(SULogLevelError, @"Error: resumeDownloadedUpdate: called on SPUAutomaticUpdateDriver");
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem
|
||||
|
||||
Vendored
+5
-4
@@ -8,6 +8,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SPUUpdateDriver.h"
|
||||
#import "SPUUpdateCheck.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -28,15 +29,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUBasicUpdateDriver : NSObject
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate;
|
||||
|
||||
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)resumeInstallingUpdate;
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
|
||||
|
||||
- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate resumableUpdate:(id<SPUResumableUpdate> _Nullable)resumableUpdate error:(nullable NSError *)error;
|
||||
|
||||
|
||||
Vendored
+25
-33
@@ -10,8 +10,6 @@
|
||||
#import "SUAppcastDriver.h"
|
||||
#import "SPUUpdaterDelegate.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SULog.h"
|
||||
#import "SULog+NSError.h"
|
||||
#import "SULocalizations.h"
|
||||
#import "SUHost.h"
|
||||
#import "SUAppcastItem.h"
|
||||
@@ -31,6 +29,7 @@
|
||||
@property (nonatomic, copy) SPUUpdateDriverCompletion completionBlock;
|
||||
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@property (nonatomic, readonly) SPUUpdateCheck updateCheck;
|
||||
@property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this..
|
||||
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate>updaterDelegate;
|
||||
|
||||
@@ -41,6 +40,7 @@
|
||||
@implementation SPUBasicUpdateDriver
|
||||
|
||||
@synthesize host = _host;
|
||||
@synthesize updateCheck = _updateCheck;
|
||||
@synthesize updater = _updater;
|
||||
@synthesize updaterDelegate = _updaterDelegate;
|
||||
@synthesize delegate = _delegate;
|
||||
@@ -48,11 +48,12 @@
|
||||
@synthesize completionBlock = _completionBlock;
|
||||
@synthesize aborted = _aborted;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate
|
||||
- (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_host = host;
|
||||
_updateCheck = updateCheck;
|
||||
_updater = updater;
|
||||
_updaterDelegate = updaterDelegate;
|
||||
_delegate = delegate;
|
||||
@@ -62,7 +63,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
|
||||
{
|
||||
self.completionBlock = completionBlock;
|
||||
}
|
||||
@@ -90,14 +91,12 @@
|
||||
[self notifyFinishLoadingAppcast];
|
||||
|
||||
SUAppcastItem *nonNullUpdateItem = updateItem;
|
||||
[self notifyFoundValidUpdateWithAppcastItem:nonNullUpdateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
|
||||
[self notifyFoundValidUpdateWithAppcastItem:nonNullUpdateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain resuming:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeInstallingUpdate
|
||||
{
|
||||
self.completionBlock = completionBlock;
|
||||
|
||||
NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier;
|
||||
assert(hostBundleIdentifier != nil);
|
||||
[SPUProbeInstallStatus probeInstallerUpdateItemForHostBundleIdentifier:hostBundleIdentifier completion:^(SPUInstallationInfo * _Nullable installationInfo) {
|
||||
@@ -107,10 +106,8 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
|
||||
{
|
||||
self.completionBlock = completionBlock;
|
||||
|
||||
[self notifyResumableUpdateItem:resumableUpdate.updateItem secondaryUpdateItem:resumableUpdate.secondaryUpdateItem systemDomain:nil];
|
||||
}
|
||||
|
||||
@@ -139,24 +136,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain resuming:(BOOL)resuming
|
||||
{
|
||||
if (!self.aborted) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
|
||||
object:self.updater
|
||||
userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }];
|
||||
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) {
|
||||
[self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
|
||||
// If the update is not being resumed from a prior session, give the delegate a chance to bail
|
||||
NSError *shouldNotProceedError = nil;
|
||||
if (!resuming && [self.updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![self.updaterDelegate updater:self.updater shouldProceedWithUpdate:updateItem updateCheck:self.updateCheck error:&shouldNotProceedError]) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
|
||||
object:self.updater
|
||||
userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }];
|
||||
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) {
|
||||
[self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
|
||||
}
|
||||
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
|
||||
}
|
||||
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem
|
||||
{
|
||||
[self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem systemDomain:nil];
|
||||
[self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem systemDomain:nil resuming:NO];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult background:(BOOL)background
|
||||
@@ -258,19 +261,8 @@
|
||||
self.aborted = YES;
|
||||
|
||||
[self.appcastDriver cleanup:^{
|
||||
if (error != nil) {
|
||||
if (error.code != SUNoUpdateError && error.code != SUInstallationCanceledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this.
|
||||
SULogError(error);
|
||||
}
|
||||
|
||||
// Notify host app that updater has aborted
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:didAbortWithError:))]) {
|
||||
[self.updaterDelegate updater:self.updater didAbortWithError:(NSError * _Nonnull)error];
|
||||
}
|
||||
}
|
||||
|
||||
if (self.completionBlock != nil) {
|
||||
self.completionBlock(shouldShowUpdateImmediately, resumableUpdate);
|
||||
self.completionBlock(shouldShowUpdateImmediately, resumableUpdate, error);
|
||||
self.completionBlock = nil;
|
||||
}
|
||||
}];
|
||||
|
||||
Vendored
+5
-6
@@ -9,6 +9,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SPUUpdateDriver.h"
|
||||
#import "SPUUserUpdateState.h"
|
||||
#import "SPUUpdateCheck.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -49,17 +50,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUCoreBasedUpdateDriver : NSObject
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate;
|
||||
|
||||
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply;
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall;
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)resumeInstallingUpdate;
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
|
||||
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background;
|
||||
|
||||
|
||||
Vendored
+11
-52
@@ -39,7 +39,6 @@
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@property (nonatomic) BOOL resumingInstallingUpdate;
|
||||
@property (nonatomic) BOOL silentInstall;
|
||||
@property (nonatomic) BOOL preventsInstallerInteraction;
|
||||
@property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this..
|
||||
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate>updaterDelegate;
|
||||
@property (nonatomic) NSString *userAgent;
|
||||
@@ -58,7 +57,6 @@
|
||||
@synthesize host = _host;
|
||||
@synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
|
||||
@synthesize silentInstall = _silentInstall;
|
||||
@synthesize preventsInstallerInteraction = _preventsInstallerInteraction;
|
||||
@synthesize updater = _updater;
|
||||
@synthesize updaterDelegate = _updaterDelegate;
|
||||
@synthesize userAgent = _userAgent;
|
||||
@@ -66,7 +64,7 @@
|
||||
@synthesize resumableUpdate = _resumableUpdate;
|
||||
@synthesize downloadedUpdateForRemoval = _downloadedUpdateForRemoval;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -75,7 +73,7 @@
|
||||
NSString *bundleIdentifier = host.bundle.bundleIdentifier;
|
||||
assert(bundleIdentifier != nil);
|
||||
|
||||
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updateCheck:updateCheck updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_installerDriver = [[SPUInstallerDriver alloc] initWithHost:host applicationBundle:applicationBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
|
||||
_host = host;
|
||||
@@ -85,33 +83,9 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
|
||||
{
|
||||
[self.basicDriver prepareCheckForUpdatesWithCompletion:completionBlock];
|
||||
}
|
||||
|
||||
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply
|
||||
{
|
||||
// Save for later
|
||||
self.preventsInstallerInteraction = preventsInstallerInteraction;
|
||||
|
||||
// If we don't allow interaction, make sure we have sufficient privileges to update
|
||||
// If we don't, then we should abort early before trying to check for updates
|
||||
// Note if we don't have permission to update an application update without interaction,
|
||||
// then we won't have permission for package type of updates either (converse is not true)
|
||||
|
||||
if (!preventsInstallerInteraction) {
|
||||
reply(nil);
|
||||
} else {
|
||||
// Otherwise check if we have sufficient privileges to update without interaction
|
||||
[self.installerDriver checkIfApplicationInstallationRequiresAuthorizationWithReply:^(BOOL requiresAuthorization) {
|
||||
if (requiresAuthorization) {
|
||||
reply([NSError errorWithDomain:SUSparkleErrorDomain code:SUNotAllowedInteractionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"No new update has been checked because the installation will require interaction, which has been prevented."] }]);
|
||||
} else {
|
||||
reply(nil);
|
||||
}
|
||||
}];
|
||||
}
|
||||
[self.basicDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall
|
||||
@@ -123,23 +97,20 @@
|
||||
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeInstallingUpdate
|
||||
{
|
||||
self.resumingInstallingUpdate = YES;
|
||||
self.silentInstall = NO;
|
||||
|
||||
[self.basicDriver resumeInstallingUpdateWithCompletion:completionBlock];
|
||||
[self.basicDriver resumeInstallingUpdate];
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
|
||||
{
|
||||
self.resumableUpdate = resumableUpdate;
|
||||
self.silentInstall = NO;
|
||||
|
||||
// Note if installer interaction isn't allowed, we shouldn't have downloaded the update, and shouldn't be able to get here
|
||||
// So no need to do a test if we can perform an update without authorization
|
||||
|
||||
[self.basicDriver resumeUpdate:resumableUpdate completion:completionBlock];
|
||||
[self.basicDriver resumeUpdate:resumableUpdate];
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFinishLoadingAppcast
|
||||
@@ -157,21 +128,9 @@
|
||||
if (self.resumingInstallingUpdate) {
|
||||
assert(systemDomain != nil);
|
||||
[self.installerDriver resumeInstallingUpdateWithUpdateItem:updateItem systemDomain:systemDomain.boolValue];
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
|
||||
} else {
|
||||
if (!self.preventsInstallerInteraction) {
|
||||
// Simple case - delegate allows interaction, so we should continue along
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
|
||||
} else {
|
||||
// Package type installations will always require installer interaction as long as we don't support running as root
|
||||
// If it's not a package type installation, we should be okay since we did an auth check before checking for updates above
|
||||
if (![updateItem.installationType isEqualToString:SPUInstallationTypeApplication]) {
|
||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUNotAllowedInteractionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A new update is available but cannot be installed because interaction has been prevented."] }]];
|
||||
} else {
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
|
||||
}
|
||||
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background
|
||||
@@ -265,7 +224,7 @@
|
||||
[self.delegate coreDriverDidStartExtractingUpdate];
|
||||
}
|
||||
|
||||
[self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall preventsInstallerInteraction:self.preventsInstallerInteraction completion:^(NSError * _Nullable error) {
|
||||
[self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall completion:^(NSError * _Nullable error) {
|
||||
if (error != nil) {
|
||||
if (error.code != SUInstallationAuthorizeLaterError) {
|
||||
[self clearDownloadedUpdate];
|
||||
|
||||
Vendored
+1
-3
@@ -34,9 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)resumeInstallingUpdateWithUpdateItem:(SUAppcastItem *)updateItem systemDomain:(BOOL)systemDomain;
|
||||
|
||||
- (void)checkIfApplicationInstallationRequiresAuthorizationWithReply:(void (^)(BOOL requiresAuthorization))reply;
|
||||
|
||||
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently preventsInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(void (^)(NSError * _Nullable))completionHandler;
|
||||
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler;
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI;
|
||||
|
||||
|
||||
Vendored
+4
-71
@@ -141,7 +141,7 @@
|
||||
}
|
||||
|
||||
// This can be called multiple times (eg: if a delta update fails, this may be called again with a regular update item)
|
||||
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently preventsInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(void (^)(NSError * _Nullable))completionHandler
|
||||
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler
|
||||
{
|
||||
self.updateItem = downloadedUpdate.updateItem;
|
||||
self.temporaryDirectory = downloadedUpdate.temporaryDirectory;
|
||||
@@ -150,7 +150,7 @@
|
||||
self.currentStage = SPUInstallerNotStarted;
|
||||
|
||||
if (self.installerConnection == nil) {
|
||||
[self launchAutoUpdateSilently:silently preventsInstallerInteraction:preventsInstallerInteraction completion:completionHandler];
|
||||
[self launchAutoUpdateSilently:silently completion:completionHandler];
|
||||
} else {
|
||||
// The Install tool is already alive; just send out installation input data again
|
||||
[self sendInstallationData];
|
||||
@@ -317,74 +317,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)checkIfApplicationInstallationRequiresAuthorizationWithReply:(void (^)(BOOL requiresAuthorization))reply
|
||||
{
|
||||
id<SUInstallerLauncherProtocol> installerLauncher = nil;
|
||||
__block BOOL madeReply = NO;
|
||||
NSXPCConnection *launcherConnection = nil;
|
||||
|
||||
if (!SPUXPCServiceExists(@INSTALLER_LAUNCHER_BUNDLE_ID)) {
|
||||
installerLauncher = [[SUInstallerLauncher alloc] init];
|
||||
} else {
|
||||
launcherConnection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_LAUNCHER_BUNDLE_ID];
|
||||
launcherConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerLauncherProtocol)];
|
||||
|
||||
launcherConnection.interruptionHandler = ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!madeReply) {
|
||||
// We'll break the retain cycle in the invalidation handler
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
||||
[launcherConnection invalidate];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
launcherConnection.invalidationHandler = ^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
#pragma clang diagnostic push
|
||||
#if __has_warning("-Wcompletion-handler")
|
||||
#pragma clang diagnostic ignored "-Wcompletion-handler"
|
||||
#endif
|
||||
if (!madeReply) {
|
||||
#pragma clang diagnostic pop
|
||||
// If something went horribly wrong, just guess that we won't require authorization
|
||||
reply(NO);
|
||||
|
||||
// Break the retain cycle
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Warc-retain-cycles"
|
||||
launcherConnection.interruptionHandler = nil;
|
||||
launcherConnection.invalidationHandler = nil;
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
[launcherConnection resume];
|
||||
|
||||
installerLauncher = launcherConnection.remoteObjectProxy;
|
||||
}
|
||||
|
||||
[installerLauncher checkIfApplicationInstallationRequiresAuthorizationWithHostBundlePath:self.host.bundlePath reply:^(BOOL requiresAuthorization) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
#pragma clang diagnostic push
|
||||
#if __has_warning("-Wcompletion-handler")
|
||||
#pragma clang diagnostic ignored "-Wcompletion-handler"
|
||||
#endif
|
||||
if (!madeReply) {
|
||||
#pragma clang diagnostic pop
|
||||
madeReply = YES;
|
||||
[launcherConnection invalidate];
|
||||
|
||||
reply(requiresAuthorization);
|
||||
}
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)launchAutoUpdateSilently:(BOOL)silently preventsInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(void (^)(NSError *_Nullable))completionHandler
|
||||
- (void)launchAutoUpdateSilently:(BOOL)silently completion:(void (^)(NSError *_Nullable))completionHandler
|
||||
{
|
||||
id<SUInstallerLauncherProtocol> installerLauncher = nil;
|
||||
__block BOOL retrievedLaunchStatus = NO;
|
||||
@@ -473,7 +406,7 @@
|
||||
mainBundleIdentifier = (bundleIdentifier == nil) ? mainBundleName : bundleIdentifier;
|
||||
}
|
||||
|
||||
[installerLauncher launchInstallerWithHostBundlePath:hostBundlePath updaterIdentifier:mainBundleIdentifier authorizationPrompt:authorizationPrompt installationType:installationType allowingDriverInteraction:driverAllowsInteraction allowingUpdaterInteraction:!preventsInstallerInteraction completion:^(SUInstallerLauncherStatus result, BOOL systemDomain) {
|
||||
[installerLauncher launchInstallerWithHostBundlePath:hostBundlePath updaterIdentifier:mainBundleIdentifier authorizationPrompt:authorizationPrompt installationType:installationType allowingDriverInteraction:driverAllowsInteraction completion:^(SUInstallerLauncherStatus result, BOOL systemDomain) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
retrievedLaunchStatus = YES;
|
||||
[launcherConnection invalidate];
|
||||
|
||||
Vendored
+11
-10
@@ -28,30 +28,31 @@
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_basicDriver = [[SPUBasicUpdateDriver alloc] initWithHost:host updateCheck:SPUUpdateCheckUpdateInformation updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)__unused preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
|
||||
{
|
||||
[self.basicDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
// We don't preflight for update permission in this driver because we are just interested if an update is available
|
||||
|
||||
[self.basicDriver prepareCheckForUpdatesWithCompletion:completionBlock];
|
||||
|
||||
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeInstallingUpdate
|
||||
{
|
||||
[self.basicDriver resumeInstallingUpdateWithCompletion:completionBlock];
|
||||
[self.basicDriver resumeInstallingUpdate];
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
|
||||
{
|
||||
self.resumableUpdate = resumableUpdate;
|
||||
|
||||
[self.basicDriver resumeUpdate:resumableUpdate completion:completionBlock];
|
||||
[self.basicDriver resumeUpdate:resumableUpdate];
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)__unused secondaryAppcastItem systemDomain:(NSNumber * _Nullable)__unused systemDomain
|
||||
|
||||
Vendored
+14
-20
@@ -36,28 +36,24 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
|
||||
{
|
||||
[self.uiDriver prepareCheckForUpdatesWithCompletion:completionBlock];
|
||||
|
||||
[self.uiDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:^(NSError * _Nullable error) {
|
||||
if (error != nil) {
|
||||
// Don't tell the user about the permission error for scheduled update checks
|
||||
[self abortUpdateWithError:nil];
|
||||
} else {
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
|
||||
}
|
||||
}];
|
||||
[self.uiDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
[self.uiDriver resumeInstallingUpdateWithCompletion:completionBlock];
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeInstallingUpdate
|
||||
{
|
||||
[self.uiDriver resumeUpdate:resumableUpdate completion:completionBlock];
|
||||
[self.uiDriver resumeInstallingUpdate];
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
|
||||
{
|
||||
[self.uiDriver resumeUpdate:resumableUpdate];
|
||||
}
|
||||
|
||||
- (void)uiDriverDidShowUpdate
|
||||
@@ -72,14 +68,12 @@
|
||||
|
||||
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *) error
|
||||
{
|
||||
// Don't tell the user that no update was found or some appcast fetch error occurred for scheduled update checks if we haven't shown the update
|
||||
[self abortUpdateWithError:self.showedUpdate ? error : nil];
|
||||
[self abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)coreDriverIsRequestingAbortUpdateWithError:(nullable NSError *) error
|
||||
{
|
||||
// Don't tell the user that an update error occurred for scheduled update checks if we haven't shown the update
|
||||
[self abortUpdateWithError:self.showedUpdate ? error : nil];
|
||||
[self abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)uiDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error
|
||||
@@ -94,7 +88,7 @@
|
||||
|
||||
- (void)abortUpdateWithError:(nullable NSError *)error
|
||||
{
|
||||
[self.uiDriver abortUpdateWithError:error];
|
||||
[self.uiDriver abortUpdateWithError:error showErrorToUser:self.showedUpdate];
|
||||
}
|
||||
|
||||
@end
|
||||
+2
-2
@@ -24,14 +24,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol SPUUserDriver, SPUUpdaterDelegate, SPUStandardUserDriverDelegate;
|
||||
|
||||
/**
|
||||
A controller class that instantiates a `SPUUpdater` and allows binding UI to it.
|
||||
A controller class that instantiates a `SPUUpdater` and allows binding UI to its updater settings.
|
||||
|
||||
This class can be instantiated in a nib or created programatically using `-initWithUpdaterDelegate:userDriverDelegate:` or `-initWithStartingUpdater:updaterDelegate:userDriverDelegate:`.
|
||||
|
||||
The controller's updater targets the application's main bundle and uses Sparkle's standard user interface.
|
||||
Typically, this class is used by sticking it as a custom NSObject subclass in an Interface Builder nib (probably in MainMenu) but it works well programatically too.
|
||||
|
||||
The controller creates an `SPUUpdater` instance and allows hooking up the check for updates action and handling menu item validation.
|
||||
The controller creates an `SPUUpdater` instance using a `SPUStandardUserDriver` and allows hooking up the check for updates action and handling menu item validation.
|
||||
It also allows hooking up the updater's and user driver's delegates.
|
||||
|
||||
If you need more control over what bundle you want to update, or you want to provide a custom user interface (via `SPUUserDriver`), please use `SPUUpdater` directly instead.
|
||||
|
||||
Vendored
+4
-6
@@ -31,17 +31,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver userInitiated:(BOOL)userInitiated updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUUIBasedUpdateDriverDelegate>)delegate;
|
||||
|
||||
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply;
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)resumeInstallingUpdate;
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
|
||||
|
||||
- (void)abortUpdateWithError:(nullable NSError *)error;
|
||||
- (void)abortUpdateWithError:(nullable NSError *)error showErrorToUser:(BOOL)showedUserProgress;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+22
-27
@@ -89,7 +89,6 @@
|
||||
@property (nonatomic) SPUReleaseNotesDriver *releaseNotesDriver;
|
||||
@property (nonatomic) BOOL resumingInstallingUpdate;
|
||||
@property (nonatomic) BOOL resumingDownloadedInfoOrUpdate;
|
||||
@property (nonatomic) BOOL preventsInstallerInteraction;
|
||||
@property (nonatomic, nullable) NSDictionary *httpHeaders;
|
||||
@property (nonatomic, nullable) NSString *userAgent;
|
||||
|
||||
@@ -107,7 +106,6 @@
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
|
||||
@synthesize resumingDownloadedInfoOrUpdate = _resumingDownloadedInfoOrUpdate;
|
||||
@synthesize preventsInstallerInteraction = _preventsInstallerInteraction;
|
||||
@synthesize httpHeaders = _httpHeaders;
|
||||
@synthesize userAgent = _userAgent;
|
||||
|
||||
@@ -122,21 +120,16 @@
|
||||
_updaterDelegate = updaterDelegate;
|
||||
_host = host;
|
||||
|
||||
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
SPUUpdateCheck updateCheck = userInitiated ? SPUUpdateCheckUpdates : SPUUpdateCheckUpdatesInBackground;
|
||||
|
||||
_coreDriver = [[SPUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle updateCheck:updateCheck updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
|
||||
{
|
||||
[self.coreDriver prepareCheckForUpdatesWithCompletion:completionBlock];
|
||||
}
|
||||
|
||||
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply
|
||||
{
|
||||
self.preventsInstallerInteraction = preventsInstallerInteraction;
|
||||
|
||||
[self.coreDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:reply];
|
||||
[self.coreDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
- (void)_clearSkippedUpdatesIfUserInitiated
|
||||
@@ -156,20 +149,20 @@
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background requiresSilentInstall:NO];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeInstallingUpdate
|
||||
{
|
||||
[self _clearSkippedUpdatesIfUserInitiated];
|
||||
|
||||
self.resumingInstallingUpdate = YES;
|
||||
[self.coreDriver resumeInstallingUpdateWithCompletion:completionBlock];
|
||||
[self.coreDriver resumeInstallingUpdate];
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
|
||||
{
|
||||
[self _clearSkippedUpdatesIfUserInitiated];
|
||||
|
||||
self.resumingDownloadedInfoOrUpdate = YES;
|
||||
[self.coreDriver resumeUpdate:resumableUpdate completion:completionBlock];
|
||||
[self.coreDriver resumeUpdate:resumableUpdate];
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFinishLoadingAppcast
|
||||
@@ -213,7 +206,7 @@
|
||||
[self.coreDriver extractDownloadedUpdate];
|
||||
break;
|
||||
case SPUUserUpdateStageInstalling:
|
||||
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
|
||||
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:YES];
|
||||
break;
|
||||
case SPUUserUpdateStageNotDownloaded:
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:NO];
|
||||
@@ -241,7 +234,7 @@
|
||||
|
||||
break;
|
||||
case SPUUserUpdateStageInstalling:
|
||||
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
|
||||
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:YES];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -255,7 +248,7 @@
|
||||
break;
|
||||
}
|
||||
case SPUUserUpdateStageInstalling: {
|
||||
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
|
||||
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:YES];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -270,7 +263,7 @@
|
||||
[self.delegate uiDriverDidShowUpdate];
|
||||
}
|
||||
|
||||
if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updaterShouldDownloadReleaseNotes:)] || [updaterDelegate updaterShouldDownloadReleaseNotes:self.updater])) {
|
||||
if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updater:shouldDownloadReleaseNotesForUpdate:)] || [updaterDelegate updater:self.updater shouldDownloadReleaseNotesForUpdate:updateItem])) {
|
||||
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
self.releaseNotesDriver = [[SPUReleaseNotesDriver alloc] initWithReleaseNotesURL:updateItem.releaseNotesURL httpHeaders:self.httpHeaders userAgent:self.userAgent host:self.host completionHandler:^(SPUDownloadData * _Nullable downloadData, NSError * _Nullable error) {
|
||||
@@ -332,7 +325,7 @@
|
||||
if (!willInstallImmediately) {
|
||||
[self.userDriver showReadyToInstallAndRelaunch:^(SPUUserUpdateChoice choice) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.coreDriver finishInstallationWithResponse:choice displayingUserInterface:!self.preventsInstallerInteraction];
|
||||
[self.coreDriver finishInstallationWithResponse:choice displayingUserInterface:YES];
|
||||
});
|
||||
}];
|
||||
}
|
||||
@@ -367,14 +360,16 @@
|
||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)_abortUpdateWithError:(nullable NSError *)error
|
||||
- (void)_abortUpdateWithError:(nullable NSError *)error showErrorToUser:(BOOL)showErrorToUser
|
||||
{
|
||||
void (^abortUpdate)(void) = ^{
|
||||
[self.userDriver dismissUpdateInstallation];
|
||||
if (showErrorToUser) {
|
||||
[self.userDriver dismissUpdateInstallation];
|
||||
}
|
||||
[self.coreDriver abortUpdateAndShowNextUpdateImmediately:NO error:error];
|
||||
};
|
||||
|
||||
if (error != nil) {
|
||||
if (error != nil && showErrorToUser) {
|
||||
NSError *nonNullError = error;
|
||||
|
||||
if (error.code == SUNoUpdateError) {
|
||||
@@ -409,14 +404,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)abortUpdateWithError:(nullable NSError *)error
|
||||
- (void)abortUpdateWithError:(nullable NSError *)error showErrorToUser:(BOOL)showErrorToUser
|
||||
{
|
||||
if (self.releaseNotesDriver != nil) {
|
||||
[self.releaseNotesDriver cleanup:^{
|
||||
[self _abortUpdateWithError:error];
|
||||
[self _abortUpdateWithError:error showErrorToUser:showErrorToUser];
|
||||
}];
|
||||
} else {
|
||||
[self _abortUpdateWithError:error];
|
||||
[self _abortUpdateWithError:error showErrorToUser:showErrorToUser];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// SPUUpdateCheck.h
|
||||
// SPUUpdateCheck
|
||||
//
|
||||
// Created by Mayur Pawashe on 8/28/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SPUUpdateCheck_h
|
||||
#define SPUUpdateCheck_h
|
||||
|
||||
/**
|
||||
Describes the type of update check being performed.
|
||||
|
||||
Each update check corresponds to an update check method on `SPUUpdater`.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
{
|
||||
/**
|
||||
The user-initiated update check corresponding to `-[SPUUpdater checkForUpdates]`.
|
||||
*/
|
||||
SPUUpdateCheckUpdates = 0,
|
||||
/**
|
||||
The background scheduled update check corresponding to `-[SPUUpdater checkForUpdatesInBackground]`.
|
||||
*/
|
||||
SPUUpdateCheckUpdatesInBackground = 1,
|
||||
/**
|
||||
The informational probe update check corresponding to `-[SPUUpdater checkForUpdateInformation]`.
|
||||
*/
|
||||
SPUUpdateCheckUpdateInformation = 2
|
||||
};
|
||||
|
||||
#endif /* SPUUpdateCheck_h */
|
||||
Vendored
+6
-4
@@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SPUResumableUpdate;
|
||||
|
||||
typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate);
|
||||
typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate, NSError * _Nullable error);
|
||||
|
||||
// This protocol describes an update driver that drives updates
|
||||
// An update driver may have multiple levels of other controller components (eg: basic update driver, core based update driver, ui based update driver, appcast driver, etc)
|
||||
@@ -19,11 +19,13 @@ typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<S
|
||||
// The newer architecture is still complex but should be more reliable to maintain and extend.
|
||||
@protocol SPUUpdateDriver <NSObject>
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders;
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
- (void)resumeInstallingUpdate;
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate;
|
||||
|
||||
@property (nonatomic, readonly) BOOL showingUpdate;
|
||||
|
||||
|
||||
Vendored
+25
-6
@@ -26,10 +26,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
The main API in Sparkle for controlling the update mechanism.
|
||||
|
||||
This class is used to configure the update parameters as well as manually
|
||||
and automatically schedule and control checks for updates.
|
||||
This class is used to configure the update parameters as well as manually and automatically schedule and control checks for updates.
|
||||
|
||||
If you want to use a standard updater or instantiate an updater in a nib, see `SPUStandardUpdaterController` for convenience.
|
||||
For convenience, you can create a standard or nib instantiable updater by using `SPUStandardUpdaterController`.
|
||||
|
||||
Prefer to set initial properties in your bundle's Info.plist as described in [Customizing Sparkle](https://sparkle-project.org/documentation/customization/).
|
||||
|
||||
Otherwise only if you need dynamic behavior (eg. for user preferences) should you set properties on the updater such as:
|
||||
- `automaticallyChecksForUpdates`
|
||||
- `updateCheckInterval`
|
||||
- `automaticallyDownloadsUpdates`
|
||||
- `feedURL`
|
||||
|
||||
Please view the documentation on each of these properties for more detail if you are to configure them dynamically.
|
||||
*/
|
||||
SU_EXPORT @interface SPUUpdater : NSObject
|
||||
|
||||
@@ -83,7 +92,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
This is meant for users initiating a new update check or checking the current update progress.
|
||||
|
||||
If an update hasn't started, the user may be shown that a new check for updates is occurring.
|
||||
If an update has already been downloaded or begun installing, the user may be presented to install that update.
|
||||
If an update has already been downloaded or begun installing from a previous session, the user may be presented to install that update.
|
||||
If the user is already being presented with an update, that update will be shown to the user in active focus.
|
||||
|
||||
This will find updates that the user has previously opted into skipping.
|
||||
@@ -101,6 +110,8 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
|
||||
Note if there is no resumable update found, and automated updating is turned on,
|
||||
the update will be downloaded in the background without disrupting the user.
|
||||
|
||||
This method does not do anything if there is a `sessionInProgress`.
|
||||
*/
|
||||
- (void)checkForUpdatesInBackground;
|
||||
|
||||
@@ -113,7 +124,12 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
`-[SPUUpdaterDelegate updaterDidNotFindUpdate:]` will be called,
|
||||
so you can use that information in your UI.
|
||||
|
||||
`-[SPUUpdaterDelegate updater:didFinishUpdateCycleForUpdateCheck:error:]` will be called when
|
||||
this probing check is completed.
|
||||
|
||||
Updates that have been skipped by the user will not be found.
|
||||
|
||||
This method does not do anything if there is a `sessionInProgress`.
|
||||
*/
|
||||
- (void)checkForUpdateInformation;
|
||||
|
||||
@@ -133,13 +149,16 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
|
||||
An update session is in progress when the appcast is being downloaded, an update is being downloaded,
|
||||
an update is being shown, update permission is being requested, or the installer is being started.
|
||||
|
||||
An active session is when Sparkle's fired scheduler is running.
|
||||
|
||||
Note an update session may be inactive even though Sparkle's installer (ran as a separate process) may be running,
|
||||
Note an update session may not be running even though Sparkle's installer (ran as a separate process) may be running,
|
||||
or even though the update has been downloaded but the installation has been deferred. In both of these cases, a new update session
|
||||
may be activated with the update resumed at a later point (automatically or manually).
|
||||
|
||||
See also `canCheckForUpdates` property which is more suited for menu item validation.
|
||||
See also:
|
||||
- `canCheckForUpdates` property which is more suited for menu item validation.
|
||||
- `-[SPUUpdaterDelegate updater:didFinishUpdateCycleForUpdateCheck:error:]` which lets the updater delegate know when an update cycle and session finishes.
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL sessionInProgress;
|
||||
|
||||
|
||||
Vendored
+103
-58
@@ -15,6 +15,7 @@
|
||||
#import "SPUUpdateDriver.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SULog.h"
|
||||
#import "SULog+NSError.h"
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#import "SUSystemProfiler.h"
|
||||
#import "SPUScheduledUpdateDriver.h"
|
||||
@@ -488,14 +489,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
updaterDelegate:strongSelf.delegate];
|
||||
}
|
||||
|
||||
BOOL preventsInstallerInteraction;
|
||||
if ([strongSelf.delegate respondsToSelector:@selector(updater:shouldAllowInstallerInteractionForUpdateCheck:)]) {
|
||||
preventsInstallerInteraction = ![strongSelf.delegate updater:strongSelf shouldAllowInstallerInteractionForUpdateCheck:SPUUpdateCheckBackgroundScheduled];
|
||||
} else {
|
||||
preventsInstallerInteraction = NO;
|
||||
}
|
||||
|
||||
[strongSelf checkForUpdatesWithDriver:updateDriver installerInProgress:installerIsRunning preventsInstallerInteraction:preventsInstallerInteraction];
|
||||
[strongSelf checkForUpdatesWithDriver:updateDriver updateCheck:SPUUpdateCheckUpdatesInBackground installerInProgress:installerIsRunning];
|
||||
});
|
||||
}];
|
||||
}
|
||||
@@ -535,14 +529,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
SPUUpdater *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
BOOL preventsInstallerInteraction;
|
||||
if ([strongSelf.delegate respondsToSelector:@selector(updater:shouldAllowInstallerInteractionForUpdateCheck:)]) {
|
||||
preventsInstallerInteraction = ![strongSelf.delegate updater:strongSelf shouldAllowInstallerInteractionForUpdateCheck:SPUUpdateCheckUserInitiated];
|
||||
} else {
|
||||
preventsInstallerInteraction = NO;
|
||||
}
|
||||
|
||||
[strongSelf checkForUpdatesWithDriver:theUpdateDriver installerInProgress:installerInProgress preventsInstallerInteraction:preventsInstallerInteraction];
|
||||
[strongSelf checkForUpdatesWithDriver:theUpdateDriver updateCheck:SPUUpdateCheckUpdates installerInProgress:installerInProgress];
|
||||
}
|
||||
});
|
||||
}];
|
||||
@@ -569,13 +556,13 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
SPUUpdater *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
[strongSelf checkForUpdatesWithDriver:[[SPUProbingUpdateDriver alloc] initWithHost:strongSelf.host updater:strongSelf updaterDelegate:strongSelf.delegate] installerInProgress:installerInProgress preventsInstallerInteraction:NO];
|
||||
[strongSelf checkForUpdatesWithDriver:[[SPUProbingUpdateDriver alloc] initWithHost:strongSelf.host updater:strongSelf updaterDelegate:strongSelf.delegate] updateCheck:SPUUpdateCheckUpdateInformation installerInProgress:installerInProgress];
|
||||
}
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesWithDriver:(id <SPUUpdateDriver> )d installerInProgress:(BOOL)installerInProgress preventsInstallerInteraction:(BOOL)preventsInstallerInteraction
|
||||
- (void)checkForUpdatesWithDriver:(id <SPUUpdateDriver> )d updateCheck:(SPUUpdateCheck)updateCheck installerInProgress:(BOOL)installerInProgress
|
||||
{
|
||||
if (self.driver != nil) {
|
||||
return;
|
||||
@@ -585,57 +572,115 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
[self updateLastUpdateCheckDate];
|
||||
|
||||
if( [self.delegate respondsToSelector: @selector((updaterMayCheckForUpdates:))] && ![self.delegate updaterMayCheckForUpdates:self] )
|
||||
{
|
||||
self.sessionInProgress = NO;
|
||||
[self scheduleNextUpdateCheck];
|
||||
return;
|
||||
}
|
||||
|
||||
self.driver = d;
|
||||
assert(self.driver != nil);
|
||||
|
||||
// Because an application can change the configuration (eg: the feed url) at any point, we should always check if it's valid
|
||||
NSError *configurationError = nil;
|
||||
if (![self checkIfConfiguredProperlyAndRequireFeedURL:YES error:&configurationError]) {
|
||||
// Don't think we should schedule a next update check if the bundle has been misconfigured once,
|
||||
// which would mean something is really off
|
||||
SULog(SULogLevelError, @"Sparkle configuration error (%ld): %@", (long)configurationError.code, configurationError.localizedDescription);
|
||||
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
|
||||
|
||||
void (^notifyDelegateOfDriverCompletion)(NSError * _Nullable, BOOL) = ^(NSError * _Nullable error, BOOL shouldShowUpdateImmediately) {
|
||||
if (error != nil) {
|
||||
if (error.code != SUNoUpdateError && error.code != SUInstallationCanceledError && error.code != SUInstallationAuthorizeLaterError) { // Let's not bother logging this.
|
||||
SULogError(error);
|
||||
}
|
||||
|
||||
// Notify host app that update driver has aborted if a non-recoverable error occurs
|
||||
if (error.code != SUInstallationAuthorizeLaterError && [self.delegate respondsToSelector:@selector((updater:didAbortWithError:))]) {
|
||||
[self.delegate updater:self didAbortWithError:(NSError * _Nonnull)error];
|
||||
}
|
||||
}
|
||||
|
||||
self.sessionInProgress = NO;
|
||||
[self.driver abortUpdateWithError:configurationError];
|
||||
self.driver = nil;
|
||||
// Notify host app that update driver has finished
|
||||
// As long as we're not going to immmediately kick off a new check
|
||||
if (!shouldShowUpdateImmediately && [self.delegate respondsToSelector:@selector((updater:didFinishUpdateCycleForUpdateCheck:error:))]) {
|
||||
[self.delegate updater:self didFinishUpdateCycleForUpdateCheck:updateCheck error:error];
|
||||
}
|
||||
};
|
||||
|
||||
void (^abortUpdateDriver)(NSError * _Nullable , BOOL) = ^(NSError * _Nullable abortError, BOOL shouldScheduleNextUpdateCheck) {
|
||||
__weak SPUUpdater *weakSelf = self;
|
||||
[self.driver setCompletionHandler:^(BOOL __unused shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable __unused resumableUpdate, NSError * _Nullable error) {
|
||||
SPUUpdater *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
strongSelf.driver = nil;
|
||||
strongSelf.sessionInProgress = NO;
|
||||
|
||||
[strongSelf updateLastUpdateCheckDate];
|
||||
|
||||
notifyDelegateOfDriverCompletion(error, NO);
|
||||
|
||||
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
|
||||
if (!strongSelf.sessionInProgress) {
|
||||
if (shouldScheduleNextUpdateCheck) {
|
||||
[strongSelf scheduleNextUpdateCheck];
|
||||
} else {
|
||||
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
[self.driver abortUpdateWithError:abortError];
|
||||
};
|
||||
|
||||
// Check if the delegate wants to defer checking for updates
|
||||
NSError *mayCheckForUpdatesError = nil;
|
||||
if (
|
||||
([self.delegate respondsToSelector:@selector(updater:mayPerformUpdateCheck:error:)] && ![self.delegate updater:self mayPerformUpdateCheck:updateCheck error:&mayCheckForUpdatesError]) ||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
([self.delegate respondsToSelector:@selector((updaterMayCheckForUpdates:))] && ![self.delegate updaterMayCheckForUpdates:self]))
|
||||
#pragma clang diagnostic pop
|
||||
{
|
||||
abortUpdateDriver(mayCheckForUpdatesError, YES);
|
||||
return;
|
||||
}
|
||||
|
||||
NSURL *theFeedURL = [self parameterizedFeedURL];
|
||||
if (theFeedURL) {
|
||||
__weak SPUUpdater *weakSelf = self;
|
||||
SPUUpdateDriverCompletion completionBlock = ^(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate) {
|
||||
SPUUpdater *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
strongSelf.resumableUpdate = resumableUpdate;
|
||||
strongSelf.driver = nil;
|
||||
self.sessionInProgress = NO;
|
||||
[strongSelf updateLastUpdateCheckDate];
|
||||
// Because an application can change the configuration (eg: the feed url) at any point, we should always check if it's valid
|
||||
// We will not schedule a next update check if the bundle is misconfigured
|
||||
NSError *configurationError = nil;
|
||||
if (![self checkIfConfiguredProperlyAndRequireFeedURL:YES error:&configurationError]) {
|
||||
SULog(SULogLevelError, @"Sparkle configuration error (%ld): %@", (long)configurationError.code, configurationError.localizedDescription);
|
||||
|
||||
abortUpdateDriver(configurationError, NO);
|
||||
return;
|
||||
}
|
||||
|
||||
// Run our update driver and schedule next update check on its completion
|
||||
__weak SPUUpdater *weakSelf = self;
|
||||
[self.driver setCompletionHandler:^(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate, NSError * _Nullable error) {
|
||||
SPUUpdater *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
strongSelf.resumableUpdate = resumableUpdate;
|
||||
strongSelf.driver = nil;
|
||||
strongSelf.sessionInProgress = NO;
|
||||
[strongSelf updateLastUpdateCheckDate];
|
||||
|
||||
notifyDelegateOfDriverCompletion(error, shouldShowUpdateImmediately);
|
||||
|
||||
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
|
||||
if (!strongSelf.sessionInProgress) {
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately];
|
||||
}
|
||||
};
|
||||
|
||||
if (installerInProgress) {
|
||||
[self.driver resumeInstallingUpdateWithCompletion:completionBlock];
|
||||
} else if (self.resumableUpdate != nil) {
|
||||
[self.driver resumeUpdate:(id<SPUResumableUpdate> _Nonnull)self.resumableUpdate completion:completionBlock];
|
||||
} else {
|
||||
[self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:[self userAgentString] httpHeaders:[self httpHeaders] preventingInstallerInteraction:preventsInstallerInteraction completion:completionBlock];
|
||||
}
|
||||
}];
|
||||
|
||||
if (installerInProgress) {
|
||||
// Resume an update that has already begun installing in the background
|
||||
[self.driver resumeInstallingUpdate];
|
||||
} else if (self.resumableUpdate != nil) {
|
||||
// Resume an update or info that has already been downloaded
|
||||
[self.driver resumeUpdate:(id<SPUResumableUpdate> _Nonnull)self.resumableUpdate];
|
||||
} else {
|
||||
// I think this is really unlikely to occur but better be safe
|
||||
[self.driver abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot form a valid feed URL." }]];
|
||||
self.sessionInProgress = NO;
|
||||
self.driver = nil;
|
||||
// Check that the parameterized feed URL is valid
|
||||
NSURL *theFeedURL = [self parameterizedFeedURL];
|
||||
if (theFeedURL == nil) {
|
||||
// I think this is really unlikely to occur but better be safe
|
||||
// We will not schedule a next update check if the feed URL cannot be formed
|
||||
SULog(SULogLevelError, @"Error: failed to retrieve feed URL for bundle");
|
||||
|
||||
abortUpdateDriver([NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot form a valid feed URL." }], NO);
|
||||
} else {
|
||||
// Check for new updates
|
||||
[self.driver checkForUpdatesAtAppcastURL:theFeedURL withUserAgent:[self userAgentString] httpHeaders:[self httpHeaders]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+65
-41
@@ -15,6 +15,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
#import <Sparkle/SPUUpdateCheck.h>
|
||||
|
||||
@protocol SUVersionComparison;
|
||||
@class SPUUpdater, SUAppcast, SUAppcastItem;
|
||||
@@ -57,12 +58,6 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
|
||||
// SPUUpdater Delegate:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
{
|
||||
SPUUpdateCheckUserInitiated = 0,
|
||||
SPUUpdateCheckBackgroundScheduled = 1
|
||||
};
|
||||
|
||||
/**
|
||||
Provides delegation methods to control the behavior of an `SPUUpdater` object.
|
||||
*/
|
||||
@@ -70,15 +65,17 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
@optional
|
||||
|
||||
/**
|
||||
Returns whether to allow Sparkle to pop up.
|
||||
Returns whether to allow Sparkle to check for updates.
|
||||
|
||||
For example, this may be used to prevent Sparkle from interrupting a setup assistant.
|
||||
Alternatively, you may want to consider starting the updater after eg: the setup assistant finishes
|
||||
|
||||
@param updater The updater instance.
|
||||
@return @c YES if the updater may check for updates otherwise @c NO
|
||||
*/
|
||||
- (BOOL)updaterMayCheckForUpdates:(SPUUpdater *)updater;
|
||||
@param updateCheck The type of update check that will be performed if the updater is allowed to check for updates.
|
||||
@param error The (optionally) populated error object if the updater may not perform a new update check.
|
||||
@return @c YES if the updater is allowed to check for updates, otherwise @c NO
|
||||
*/
|
||||
- (BOOL)updater:(SPUUpdater *)updater mayPerformUpdateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error;
|
||||
|
||||
/**
|
||||
Returns the set of Sparkle channels the updater is allowed to find new updates from.
|
||||
@@ -107,12 +104,12 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
- (NSSet<NSString *> *)allowedChannelsForUpdater:(SPUUpdater *)updater;
|
||||
|
||||
/**
|
||||
Returns a custom appcast URL.
|
||||
Returns a custom appcast URL used for checking for new updates.
|
||||
|
||||
Override this to dynamically specify the feed URL.
|
||||
|
||||
@param updater The updater instance.
|
||||
@return An appcast feed URL to check for new updates in. Return @c nil for the default behavior and if you don't want to be delegated this task.
|
||||
@return An appcast feed URL to check for new updates in, or @c nil for the default behavior and if you don't want to be delegated this task.
|
||||
*/
|
||||
- (nullable NSString *)feedURLStringForUpdater:(SPUUpdater *)updater;
|
||||
|
||||
@@ -128,14 +125,13 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
*/
|
||||
- (NSArray<NSDictionary<NSString *, NSString *> *> *)feedParametersForUpdater:(SPUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
|
||||
|
||||
|
||||
/**
|
||||
Returns whether Sparkle should prompt the user about automatic update checks.
|
||||
Returns whether Sparkle should prompt the user about checking for new updates automatically.
|
||||
|
||||
Use this to override the default behavior.
|
||||
|
||||
@param updater The updater instance.
|
||||
@return @c YES if the updater should prompt for permission to check for updates, otherwise @c NO
|
||||
@return @c YES if the updater should prompt for permission to check for new updates automatically, otherwise @c NO
|
||||
*/
|
||||
- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SPUUpdater *)updater;
|
||||
|
||||
@@ -224,6 +220,21 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
*/
|
||||
- (nullable SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SPUUpdater *)updater;
|
||||
|
||||
/**
|
||||
Returns whether or not the updater should proceed with the new chosen update from the appcast.
|
||||
|
||||
By default, the updater will always proceed with the best selected update found in an appcast. Override this to override this behavior.
|
||||
|
||||
If you return @c NO and populate the @c error, the user is not shown this @c updateItem nor is the update downloaded or installed.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param updateItem The selected update item to proceed with.
|
||||
@param updateCheck The type of update check that would be performed if proceeded.
|
||||
@param error An error object that must be populated by the delegate if the updater should not proceed with the update.
|
||||
@return @c YES if the updater should proceed with @c updateItem, otherwise @c NO if the updater should not proceed with the update with an @c error populated.
|
||||
*/
|
||||
- (BOOL)updater:(SPUUpdater *)updater shouldProceedWithUpdate:(SUAppcastItem *)updateItem updateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error;
|
||||
|
||||
/**
|
||||
Called when an update is skipped by the user.
|
||||
|
||||
@@ -238,10 +249,11 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
This is specifically for the @c <releaseNotesLink> element in the appcast item.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param updateItem The update item to download and show release notes from.
|
||||
|
||||
@return @c YES to download and show the release notes if available, otherwise @c NO. The default behavior is @c YES.
|
||||
*/
|
||||
- (BOOL)updaterShouldDownloadReleaseNotes:(SPUUpdater *)updater;
|
||||
- (BOOL)updater:(SPUUpdater *)updater shouldDownloadReleaseNotesForUpdate:(SUAppcastItem *)updateItem;
|
||||
|
||||
/**
|
||||
Called immediately before downloading the specified update.
|
||||
@@ -270,7 +282,7 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
- (void)updater:(SPUUpdater *)updater failedToDownloadUpdate:(SUAppcastItem *)item error:(NSError *)error;
|
||||
|
||||
/**
|
||||
Called when the user clicks the cancel button while and update is being downloaded.
|
||||
Called when the user cancels an update while it is being downloaded.
|
||||
|
||||
@param updater The updater instance.
|
||||
*/
|
||||
@@ -312,14 +324,14 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
@param item The appcast item corresponding to the update that is proposed to be installed.
|
||||
@param installHandler The install handler that must be completed before continuing with the relaunch.
|
||||
|
||||
@return @c YES to delay the relaunch until @p installHandler is invoked.
|
||||
@return @c YES to delay the relaunch until @c installHandler is invoked.
|
||||
*/
|
||||
- (BOOL)updater:(SPUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)item untilInvokingBlock:(void (^)(void))installHandler;
|
||||
|
||||
/**
|
||||
Returns whether the application should be relaunched at all.
|
||||
|
||||
Some apps @b cannot be relaunched under certain circumstances.
|
||||
Some apps **cannot** be relaunched under certain circumstances.
|
||||
This method can be used to explicitly prevent a relaunch.
|
||||
|
||||
@param updater The updater instance.
|
||||
@@ -369,25 +381,6 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
*/
|
||||
- (void)updaterWillNotScheduleUpdateCheck:(SPUUpdater *)updater;
|
||||
|
||||
/**
|
||||
Returns whether or not the updater should allow interaction from the installer
|
||||
|
||||
Use this to override the default behavior which is to allow interaction with the installer.
|
||||
|
||||
If interaction is allowed, then an authorization prompt may show up to the user if they do
|
||||
not curently have sufficient privileges to perform the installation of the new update.
|
||||
The installer may also show UI and progress when interaction is allowed.
|
||||
|
||||
On the other hand, if interaction is not allowed, then an installation may fail if the user does not
|
||||
have sufficient privileges to perform the installation. In this case, the feed and update may not even be downloaded.
|
||||
|
||||
Note this has no effect if the update has already been downloaded in the background silently and ready to be resumed.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param updateCheck The type of update check being performed.
|
||||
*/
|
||||
- (BOOL)updater:(SPUUpdater *)updater shouldAllowInstallerInteractionForUpdateCheck:(SPUUpdateCheck)updateCheck;
|
||||
|
||||
/**
|
||||
Returns the decryption password (if any) which is used to extract the update archive DMG.
|
||||
|
||||
@@ -405,7 +398,7 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
|
||||
Also if the updater is given responsibility and the update item is marked critical, the new update will be presented to the user immediately after.
|
||||
|
||||
Even if the @p immediateInstallHandler is not invoked, the installer will attempt to install the update on termination.
|
||||
Even if the @c immediateInstallHandler is not invoked, the installer will attempt to install the update on termination.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param item The appcast item corresponding to the update that is proposed to be installed.
|
||||
@@ -415,13 +408,44 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
|
||||
- (BOOL)updater:(SPUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)item immediateInstallationBlock:(void (^)(void))immediateInstallHandler;
|
||||
|
||||
/**
|
||||
Called after an update is aborted due to an error.
|
||||
Called after the update driver aborts due to an error.
|
||||
|
||||
The update driver runs when checking for updates. This delegate method is called an error occurs during this process.
|
||||
|
||||
Some special possible values of `error.code` are:
|
||||
|
||||
- `SUNoUpdateError`: No new update was found.
|
||||
- `SUInstallationCanceledError`: The user canceled installing the update when requested for authorization.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param error The error that caused the abort
|
||||
@param error The error that caused the update driver to abort.
|
||||
*/
|
||||
- (void)updater:(SPUUpdater *)updater didAbortWithError:(NSError *)error;
|
||||
|
||||
/**
|
||||
Called after the update driver finishes.
|
||||
|
||||
The update driver runs when checking for updates. This delegate method is called when that check is finished.
|
||||
|
||||
An update may be scheduled to be installed during the update cycle, or no updates may be found, or an available update may be dismissed or skipped (which is the same as no error).
|
||||
|
||||
If the @c error is @c nil, no error has occurred.
|
||||
|
||||
Some special possible values of `error.code` are:
|
||||
|
||||
- `SUNoUpdateError`: No new update was found.
|
||||
- `SUInstallationCanceledError`: The user canceled installing the update when requested for authorization.
|
||||
|
||||
@param updater The updater instance.
|
||||
@param updateCheck The type of update check was performed.
|
||||
@param error The error that caused the update driver to abort. This is @c nil if the update driver finished normally and there is no error.
|
||||
*/
|
||||
- (void)updater:(SPUUpdater *)updater didFinishUpdateCycleForUpdateCheck:(SPUUpdateCheck)updateCheck error:(nullable NSError *)error;
|
||||
|
||||
/* Deprecated methods */
|
||||
|
||||
- (BOOL)updaterMayCheckForUpdates:(SPUUpdater *)updater __deprecated_msg("Please use -[SPUUpdaterDelegate updater:mayPerformUpdateCheck:error:] instead.");
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+20
-25
@@ -41,40 +41,35 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
|
||||
{
|
||||
[self.uiDriver prepareCheckForUpdatesWithCompletion:completionBlock];
|
||||
[self.uiDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
self.showingUserInitiatedProgress = YES;
|
||||
self.showingUpdate = YES;
|
||||
|
||||
[self.uiDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:^(NSError * _Nullable error) {
|
||||
if (!self.aborted) {
|
||||
if (error != nil) {
|
||||
[self abortUpdateWithError:error];
|
||||
} else {
|
||||
self.showingUserInitiatedProgress = YES;
|
||||
self.showingUpdate = YES;
|
||||
|
||||
[self.userDriver showUserInitiatedUpdateCheckWithCancellation:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.showingUserInitiatedProgress) {
|
||||
[self abortUpdate];
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:NO];
|
||||
[self.userDriver showUserInitiatedUpdateCheckWithCancellation:^{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.showingUserInitiatedProgress) {
|
||||
[self abortUpdate];
|
||||
}
|
||||
}
|
||||
});
|
||||
}];
|
||||
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:NO];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeInstallingUpdate
|
||||
{
|
||||
[self.uiDriver resumeInstallingUpdateWithCompletion:completionBlock];
|
||||
[self.uiDriver resumeInstallingUpdate];
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
|
||||
{
|
||||
[self.uiDriver resumeUpdate:resumableUpdate completion:completionBlock];
|
||||
[self.uiDriver resumeUpdate:resumableUpdate];
|
||||
}
|
||||
|
||||
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error
|
||||
@@ -122,7 +117,7 @@
|
||||
self.showingUserInitiatedProgress = NO;
|
||||
}
|
||||
self.aborted = YES;
|
||||
[self.uiDriver abortUpdateWithError:error];
|
||||
[self.uiDriver abortUpdateWithError:error showErrorToUser:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ BOOL SPUXPCValidateServiceIfBundleExists(NSString *bundleName, NSBundle *sparkle
|
||||
return YES;
|
||||
}
|
||||
|
||||
#if !DEBUG
|
||||
#if DEBUG
|
||||
// Post install scripts for appending git hash info to CFBundleShortVersionString are too unreliable to verify for debug/development
|
||||
// Fortunately debug builds of Sparkle are not usable in a production environment
|
||||
(void)sparkleBundle; // Mark parameter as used
|
||||
|
||||
Vendored
+1
-1
@@ -71,7 +71,7 @@ typedef NS_ENUM(OSStatus, SUError) {
|
||||
SUDowngradeError = 4006,
|
||||
SUInstallationCanceledError = 4007,
|
||||
SUInstallationAuthorizeLaterError = 4008,
|
||||
SUNotAllowedInteractionError = 4009,
|
||||
SUNotValidUpdateError = 4009,
|
||||
SUAgentInvalidationError = 4010,
|
||||
|
||||
// API misuse errors.
|
||||
|
||||
Vendored
+1
-1
@@ -256,7 +256,7 @@ static NSMutableDictionary *sharedUpdaters = nil;
|
||||
return versionDisplayer;
|
||||
}
|
||||
|
||||
- (BOOL)updaterMayCheckForUpdates:(SPUUpdater *)__unused updater
|
||||
- (BOOL)updater:(SPUUpdater *)__unused updater mayPerformUpdateCheck:(SPUUpdateCheck)__unused updateCheck error:(NSError *__autoreleasing _Nullable *)error
|
||||
{
|
||||
BOOL updaterMayCheck = YES;
|
||||
if ([self.delegate respondsToSelector:@selector(updaterMayCheckForUpdates:)]) {
|
||||
|
||||
Vendored
+3
-3
@@ -2,11 +2,11 @@
|
||||
|
||||
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde geladen und steht zur Installation bereit! Möchtest du %1$@ jetzt durch die neue Version ersetzen und neu starten?";
|
||||
|
||||
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG Datei oder Laufwerk ohne Schreibzugriff gestartet wurde.";
|
||||
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG-Datei oder einem Laufwerk ohne Schreibzugriff gestartet wurde.";
|
||||
|
||||
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Kopiere %1$@ in den Programmeordner, starte es von dort aus und versuche es erneut zu aktualisieren.";
|
||||
|
||||
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Beenden Sie „%1$@“, bewegen Sie es in den Ordner „Programme“, starten Sie das Programm von dort erneut und versuchen Sie es noch einmal.";
|
||||
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Beende „%1$@“, bewege es in den Ordner „Programme“, starte das Programm von dort erneut und versuche es noch einmal.";
|
||||
|
||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "„%1$@“ kann nicht aktualisiert werden, wenn das Programm von dem Ort ausgeführt wird, an den es heruntergeladen wurde.";
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
"A new version of %@ is ready to install!" = "Eine neue Version von %@ steht zur Installation bereit!";
|
||||
|
||||
"An error occurred in retrieving update information. Please try again later." = "Beim Laden der Updateinformationen trat ein Fehler auf. Bitte versuche es später erneut.";
|
||||
"An error occurred in retrieving update information. Please try again later." = "Beim Laden der Updateinformationen ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
|
||||
|
||||
"An error occurred while downloading the update. Please try again later." = "Beim Laden des Updates ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<item>
|
||||
<title>Version 2.0</title>
|
||||
<sparkle:version>2.0</sparkle:version>
|
||||
<link>https://sparkle-project.org</link>
|
||||
<description>
|
||||
<![CDATA[
|
||||
<ul>
|
||||
|
||||
@@ -8,8 +8,25 @@
|
||||
|
||||
#import "SPUCommandLineDriver.h"
|
||||
#import <Sparkle/Sparkle.h>
|
||||
#import <Sparkle/SUInstallerLauncher+Private.h>
|
||||
#import "SPUCommandLineUserDriver.h"
|
||||
|
||||
#define SPARKLE_CLI_ERROR_DOMAIN @"sparkle-cli"
|
||||
|
||||
typedef NS_ENUM(NSInteger, CLIErrorCode) {
|
||||
CLIErrorCodeCannotPerformCheck = 1,
|
||||
CLIErrorCodeCannotInstallPackage,
|
||||
CLIErrorCodeCannotInstallMajorUpgrade
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int, CLIErrorExitStatus) {
|
||||
CLIErrorExitStatusMajorUpgradeNotAllowed = 2,
|
||||
CLIErrorExitStatusInstallerInteractionNotAllowed = 3,
|
||||
CLIErrorExitStatusUpdateNotFound = 4,
|
||||
CLIErrorExitStatusUpdateCancelledAuthorization = 5,
|
||||
CLIErrorExitStatusUpdatePermissionRequested = 6
|
||||
};
|
||||
|
||||
@interface SPUCommandLineDriver () <SPUUpdaterDelegate>
|
||||
|
||||
@property (nonatomic, readonly) SPUUpdater *updater;
|
||||
@@ -19,6 +36,7 @@
|
||||
@property (nonatomic, readonly) BOOL allowMajorUpgrades;
|
||||
@property (nonatomic, readonly) NSSet<NSString *> *allowedChannels;
|
||||
@property (nonatomic, copy, readonly, nullable) NSString *customFeedURL;
|
||||
@property (nonatomic, readonly) SUUpdatePermissionResponse *updatePermissionResponse;
|
||||
|
||||
@end
|
||||
|
||||
@@ -31,6 +49,7 @@
|
||||
@synthesize allowMajorUpgrades = _allowMajorUpgrades;
|
||||
@synthesize allowedChannels = _allowedChannels;
|
||||
@synthesize customFeedURL = _customFeedURL;
|
||||
@synthesize updatePermissionResponse = _updatePermissionResponse;
|
||||
|
||||
- (instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath allowedChannels:(NSSet<NSString *> *)allowedChannels customFeedURL:(nullable NSString *)customFeedURL updatePermissionResponse:(nullable SUUpdatePermissionResponse *)updatePermissionResponse deferInstallation:(BOOL)deferInstallation interactiveInstallation:(BOOL)interactiveInstallation allowMajorUpgrades:(BOOL)allowMajorUpgrades verbose:(BOOL)verbose
|
||||
{
|
||||
@@ -56,6 +75,7 @@
|
||||
_allowMajorUpgrades = allowMajorUpgrades;
|
||||
_allowedChannels = allowedChannels;
|
||||
_customFeedURL = [customFeedURL copy];
|
||||
_updatePermissionResponse = updatePermissionResponse;
|
||||
|
||||
id <SPUUserDriver> userDriver = [[SPUCommandLineUserDriver alloc] initWithUpdatePermissionResponse:updatePermissionResponse deferInstallation:deferInstallation verbose:verbose];
|
||||
_updater = [[SPUUpdater alloc] initWithHostBundle:updateBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
|
||||
@@ -79,17 +99,65 @@
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
// If the installation is interactive, we can show an authorization prompt for requesting additional privileges,
|
||||
// along with allowing the installer to show UI when installing
|
||||
- (BOOL)updater:(SPUUpdater *)__unused updater shouldAllowInstallerInteractionForUpdateCheck:(SPUUpdateCheck)updateCheck
|
||||
- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SPUUpdater *)__unused updater
|
||||
{
|
||||
if (self.updatePermissionResponse == nil) {
|
||||
// We don't want to make this decision on behalf of the user.
|
||||
fprintf(stderr, "Error: Asked to grant update permission and --grant-automatic-checks is not specified. Exiting.\n");
|
||||
exit(CLIErrorExitStatusUpdatePermissionRequested);
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// If the installation is not interactive, we should not perform an update check if we don't have permission to update the bundle path
|
||||
- (BOOL)updater:(SPUUpdater *)updater mayPerformUpdateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
switch (updateCheck) {
|
||||
case SPUUpdateCheckUserInitiated:
|
||||
case SPUUpdateCheckBackgroundScheduled:
|
||||
return self.interactive;
|
||||
case SPUUpdateCheckUpdates:
|
||||
case SPUUpdateCheckUpdatesInBackground:
|
||||
if (self.interactive || !SPUSystemNeedsAuthorizationAccessForBundlePath(self.updater.hostBundle.bundlePath)) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SPARKLE_CLI_ERROR_DOMAIN code:CLIErrorCodeCannotPerformCheck userInfo:@{ NSLocalizedDescriptionKey: @"A new update check cannot be performed because updating this bundle will require user authorization. Please use --interactive to allow this." }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
case SPUUpdateCheckUpdateInformation:
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
// If the installation is not interactive, we should only proceed with application based updates and not package-based ones
|
||||
- (BOOL)updater:(SPUUpdater *)updater shouldProceedWithUpdate:(nonnull SUAppcastItem *)updateItem updateCheck:(SPUUpdateCheck)updateCheck error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
// We can always probe for update information
|
||||
if (updateCheck == SPUUpdateCheckUpdateInformation) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// If we encounter a major upgrade and not allowed to act on it, then error
|
||||
if (updateItem.majorUpgrade && !self.allowMajorUpgrades) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SPARKLE_CLI_ERROR_DOMAIN code:CLIErrorCodeCannotInstallMajorUpgrade userInfo:@{ NSLocalizedDescriptionKey: @"Major upgrade available but not allowed to install it. Pass --allow-major-upgrades to allow this." }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (!self.interactive && ![updateItem.installationType isEqualToString:SPUInstallationTypeApplication]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SPARKLE_CLI_ERROR_DOMAIN code:CLIErrorCodeCannotInstallPackage userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A new package-based update has been found (%@), but installing it will require user authorization. Please use --interactive to allow this.", updateItem.versionString] }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSSet<NSString *> *)allowedChannelsForUpdater:(SPUUpdater *)__unused updater
|
||||
{
|
||||
return self.allowedChannels;
|
||||
@@ -100,47 +168,56 @@
|
||||
return self.customFeedURL;
|
||||
}
|
||||
|
||||
// In case we find an update during probing, otherwise we leave this to the user driver
|
||||
// In case we find an update during probing
|
||||
- (void)updater:(SPUUpdater *)__unused updater didFindValidUpdate:(SUAppcastItem *)item
|
||||
{
|
||||
// If we encounter a major upgrade and not allowed to act on it, then exit(2)
|
||||
if (item.majorUpgrade && !self.allowMajorUpgrades) {
|
||||
if (self.probingForUpdates) {
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Major upgrade available");
|
||||
if (self.probingForUpdates) {
|
||||
fprintf(stderr, "\n");
|
||||
if (item.majorUpgrade) {
|
||||
fprintf(stderr, "Major upgrade available.\n");
|
||||
} else {
|
||||
fprintf(stderr, " but not allowed to install it.\n");
|
||||
fprintf(stderr, "Update available!\n");
|
||||
}
|
||||
}
|
||||
exit(2);
|
||||
} else if (self.probingForUpdates) {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updater:(SPUUpdater *)updater didFinishUpdateCycleForUpdateCheck:(SPUUpdateCheck)__unused updateCheck error:(nullable NSError *)error __attribute__((noreturn))
|
||||
{
|
||||
if (error == nil) {
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Update available!\n");
|
||||
fprintf(stderr, "Exiting.\n");
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updaterDidNotFindUpdate:(SPUUpdater *)__unused updater __attribute__((noreturn))
|
||||
{
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "No update available!\n");
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
- (void)updater:(SPUUpdater *)__unused updater didAbortWithError:(NSError *)error
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Aborted update with error (%ld): %s\n", (long)error.code, error.localizedDescription.UTF8String);
|
||||
} else if ([error.domain isEqualToString:SPARKLE_CLI_ERROR_DOMAIN]) {
|
||||
fprintf(stderr, "%s\n", error.localizedDescription.UTF8String);
|
||||
|
||||
if (error.code == CLIErrorCodeCannotInstallMajorUpgrade) {
|
||||
// Major upgrades are not allowed
|
||||
exit(CLIErrorExitStatusMajorUpgradeNotAllowed);
|
||||
} else {
|
||||
// This is one of our own interactive update failures
|
||||
exit(CLIErrorExitStatusInstallerInteractionNotAllowed);
|
||||
}
|
||||
} else if (error.code == SUNoUpdateError) {
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "No new update available!\n");
|
||||
}
|
||||
exit(CLIErrorExitStatusUpdateNotFound);
|
||||
} else if (error.code == SUInstallationCanceledError) {
|
||||
// User canceled authorization themselves
|
||||
assert(self.interactive);
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Update was cancelled.\n");
|
||||
}
|
||||
exit(CLIErrorExitStatusUpdateCancelledAuthorization);
|
||||
} else {
|
||||
fprintf(stderr, "Error: Update has failed due to error %ld (%s). %s\n", (long)error.code, error.domain.UTF8String, error.localizedDescription.UTF8String);
|
||||
exit(EXIT_FAILURE);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)updaterShouldDownloadReleaseNotes:(SPUUpdater *)__unused updater
|
||||
- (BOOL)updater:(SPUUpdater *)updater shouldDownloadReleaseNotesForUpdate:(nonnull SUAppcastItem *)__unused item
|
||||
{
|
||||
return self.verbose;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Sparkle/Sparkle.h>
|
||||
|
||||
#define SCHEDULED_UPDATE_TIMER_THRESHOLD 2.0 // seconds
|
||||
|
||||
@interface SPUCommandLineUserDriver ()
|
||||
|
||||
@property (nonatomic, nullable, readonly) SUUpdatePermissionResponse *updatePermissionResponse;
|
||||
@@ -43,16 +41,10 @@
|
||||
|
||||
- (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)__unused request reply:(void (^)(SUUpdatePermissionResponse *))reply
|
||||
{
|
||||
if (self.updatePermissionResponse == nil) {
|
||||
// We don't want to make this decision on behalf of the user.
|
||||
fprintf(stderr, "Error: Asked to grant update permission. Exiting.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Granting permission for automatic update checks with sending system profile %s...\n", self.updatePermissionResponse.sendSystemProfile ? "enabled" : "disabled");
|
||||
}
|
||||
reply(self.updatePermissionResponse);
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Granting permission for automatic update checks with sending system profile %s...\n", self.updatePermissionResponse.sendSystemProfile ? "enabled" : "disabled");
|
||||
}
|
||||
reply(self.updatePermissionResponse);
|
||||
}
|
||||
|
||||
- (void)showUserInitiatedUpdateCheckWithCancellation:(void (^)(void))__unused cancellation
|
||||
@@ -159,18 +151,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showUpdateNotFoundWithError:(NSError *)error acknowledgement:(void (^)(void))__unused acknowledgement __attribute__((noreturn))
|
||||
- (void)showUpdateNotFoundWithError:(NSError *)__unused error acknowledgement:(void (^)(void))acknowledgement
|
||||
{
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "No new update available!\n");
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
acknowledgement();
|
||||
}
|
||||
|
||||
- (void)showUpdaterError:(NSError *)error acknowledgement:(void (^)(void))__unused acknowledgement __attribute__((noreturn))
|
||||
- (void)showUpdaterError:(NSError *)__unused error acknowledgement:(void (^)(void))acknowledgement
|
||||
{
|
||||
fprintf(stderr, "Error: Update has failed: %s\n", error.localizedDescription.UTF8String);
|
||||
exit(EXIT_FAILURE);
|
||||
acknowledgement();
|
||||
}
|
||||
|
||||
- (void)showDownloadInitiatedWithCancellation:(void (^)(void))__unused cancellation
|
||||
@@ -245,12 +233,8 @@
|
||||
acknowledgement();
|
||||
}
|
||||
|
||||
- (void)dismissUpdateInstallation __attribute__((noreturn))
|
||||
- (void)dismissUpdateInstallation
|
||||
{
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Exiting.\n");
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
- (void)showSendingTerminationSignal
|
||||
|
||||
+2
-2
@@ -41,8 +41,8 @@ static void printUsage(char **argv)
|
||||
fprintf(stderr, " --%s\n Allows probing and installing major upgrades. Without passing this, an exit\n status of 2 is returned if a major upgrade is found.\n", ALLOW_MAJOR_UPGRADES_FLAG);
|
||||
fprintf(stderr, " --%s\n List of allowed Sparkle channels to look for updates in. By default,\n only the default channel is used.\n", CHANNELS_FLAG);
|
||||
fprintf(stderr, " --%s\n URL for appcast feed. This URL will be used for the feed instead of the one\n in the bundle's Info.plist or in the bundle's user defaults.\n", FEED_URL_FLAG);
|
||||
fprintf(stderr, " --%s\n Allows prompting the user for an authorization dialog prompt if the\n installer needs elevated privileges, or allows performing an interactive\n installer package.\n", INTERACTIVE_FLAG);
|
||||
fprintf(stderr, " --%s\n If update permission is requested, this enables automatic update checks.\n Note that this behavior may overwrite the user's defaults for the bundle.\n This option has no effect if --%s is passed, or if the\n user has replied to this request already, or if the developer configured\n to skip it.\n", GRANT_AUTOMATIC_CHECKING_FLAG, CHECK_NOW_FLAG);
|
||||
fprintf(stderr, " --%s\n Allows prompting the user for an authorization dialog prompt if the\n installer needs elevated privileges, or allows performing an interactive\n installer package. Without passing this, an exit status of 3 is returned\n if an update requires user interaction. An exit status of 5 is returned\n if the user cancels the authorization prompt.\n", INTERACTIVE_FLAG);
|
||||
fprintf(stderr, " --%s\n If update permission is requested, this enables automatic update checks.\n Note that this behavior may overwrite the user's defaults for the bundle.\n This option has no effect if --%s is passed, or if the\n user has replied to this request already, or if the developer configured\n to skip it. Without passing this, an exit status of 6 is returned\n if permission is needed.\n", GRANT_AUTOMATIC_CHECKING_FLAG, CHECK_NOW_FLAG);
|
||||
fprintf(stderr, " --%s\n Choose to send system profile information if update permission is requested.\n This option can only take effect if --%s is passed.\n", SEND_PROFILE_FLAG, GRANT_AUTOMATIC_CHECKING_FLAG);
|
||||
fprintf(stderr, " --%s\n Defer installation until after the application terminates on its own. The\n application will not be relaunched unless the installation is resumed later.\n", DEFER_FLAG);
|
||||
fprintf(stderr, " --%s\n Enable verbose logging.\n", VERBOSE_FLAG);
|
||||
|
||||
Reference in new issue
Block a user