This commit is contained in:
Raafat Akkad
2022-12-03 14:51:28 +00:00
parent 23b6083523
commit 8a68395f96
178 changed files with 1110 additions and 1540 deletions

View File

@ -6,14 +6,7 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
#if __has_feature(modules)
#if __has_warning("-Watimport-in-framework-header")
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
#endif
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#import <Sparkle/SUExport.h>
#import <Sparkle/SPUUserDriver.h>
@ -32,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
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:
Otherwise only if you need dynamic behavior for user settings should you set properties on the updater such as:
- `automaticallyChecksForUpdates`
- `updateCheckInterval`
- `automaticallyDownloadsUpdates`
@ -102,19 +95,24 @@ SU_EXPORT @interface SPUUpdater : NSObject
- (void)checkForUpdates;
/**
Checks for updates, but does not display any UI unless an update is found.
Checks for updates, but does not show any UI unless an update is found.
You usually do not need to call this method directly. If `automaticallyChecksForUpdates` is @c YES,
Sparkle calls this method automatically according to its update schedule using the `updateCheckInterval`
and the `lastUpdateCheckDate`.
and the `lastUpdateCheckDate`. Therefore, you should typically only consider calling this method directly if you
opt out of automatic update checks.
This is meant for programmatically initating a check for updates in the background without the user initiating it.
This check will not show UI if no new updates are found.
If a new update is found, the updater's user driver may handle showing it at an appropriate (but not necessarily immediate) time.
If you want control over when and how a new update is shown, please see https://sparkle-project.org/documentation/gentle-reminders/
Note if automated updating is turned on, either a new update may be downloaded in the background to be installed silently,
or an already downloaded update may be shown.
This is meant for programmatically initating a check for updates.
That is, it will display no UI unless it finds an update, in which case it proceeds as usual.
This will not find updates that the user has opted into skipping.
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;
@ -177,7 +175,11 @@ SU_EXPORT @interface SPUUpdater : NSObject
this permission request is not performed however.
Setting this property will persist in the host bundle's user defaults.
Only set this property if you need dynamic behavior (e.g. user preferences).
Hence developers shouldn't maintain an additional user default for this property.
Only set this property if the user wants to change the default via a user settings option.
Do not always set it on launch unless you want to ignore the user's preference.
For testing environments, you can disable update checks by passing `-SUEnableAutomaticChecks NO`
to your app's command line arguments instead of setting this property.
The update schedule cycle will be reset in a short delay after the property's new value is set.
This is to allow reverting this property without kicking off a schedule change immediately
@ -187,9 +189,12 @@ SU_EXPORT @interface SPUUpdater : NSObject
/**
A property indicating the current automatic update check interval in seconds.
Prefer to set SUScheduledCheckInterval directly in your Info.plist for setting the initial value.
Setting this property will persist in the host bundle's user defaults.
For this reason, only set this property if you need dynamic behavior (eg user preferences).
Otherwise prefer to set SUScheduledCheckInterval directly in your Info.plist.
Hence developers shouldn't maintain an additional user default for this property.
Only set this property if the user wants to change the default via a user settings option.
Do not always set it on launch unless you want to ignore the user's preference.
The update schedule cycle will be reset in a short delay after the property's new value is set.
This is to allow reverting this property without kicking off a schedule change immediately
@ -201,12 +206,15 @@ SU_EXPORT @interface SPUUpdater : NSObject
By default, updates are not automatically downloaded.
Note that the developer can disallow automatic downloading of updates from being enabled.
Note that the developer can disallow automatic downloading of updates from being enabled (via `SUAllowsAutomaticUpdates` Info.plist key).
In this case, this property will return NO regardless of how this property is set.
Prefer to set SUAutomaticallyUpdate directly in your Info.plist for setting the initial value.
Setting this property will persist in the host bundle's user defaults.
For this reason, only set this property if you need dynamic behavior (eg user preferences).
Otherwise prefer to set SUAutomaticallyUpdate directly in your Info.plist.
Hence developers shouldn't maintain an additional user default for this property.
Only set this property if the user wants to change the default via a user settings option.
Do not always set it on launch unless you want to ignore the user's preference.
*/
@property (nonatomic) BOOL automaticallyDownloadsUpdates;
@ -218,6 +226,9 @@ SU_EXPORT @interface SPUUpdater : NSObject
Otherwise the feed URL in the host bundle's Info.plist will be returned.
If no feed URL can be retrieved, returns nil.
For setting a primary feed URL, please set the `SUFeedURL` property in your Info.plist.
For setting an alternative feed URL, please prefer `-[SPUUpdaterDelegate feedURLStringForUpdater:]` over `-setFeedURL:`
This property must be called on the main thread; calls from background threads will return nil.
*/
@property (nonatomic, readonly, nullable) NSURL *feedURL;
@ -281,7 +292,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
@property (nonatomic, readonly, copy, nullable) NSDate *lastUpdateCheckDate;
/**
Appropriately schedules or cancels the update checking timer according to the preferences for time interval and automatic checks.
Appropriately schedules or cancels the update checking timer according to the settings for the time interval and automatic checks.
If you change the `updateCheckInterval` or `automaticallyChecksForUpdates` properties, the update cycle will be reset automatically after a short delay.
The update cycle is also started automatically after the updater is started. In all these cases, this method should not be called directly.