mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-02-09 20:26:37 +01:00
Merge pull request #1396 from ychin/sparkle-more-descriptive-version-string
Use more descriptive version string in Sparkle 2
This commit is contained in:
@@ -8,14 +8,23 @@
|
||||
|
||||
#import "Sparkle.framework/Headers/Sparkle.h"
|
||||
|
||||
@interface MMSparkle2Delegate : NSObject <SPUUpdaterDelegate, SPUStandardUserDriverDelegate>;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MMSparkle2Delegate : NSObject <SPUUpdaterDelegate, SPUStandardUserDriverDelegate, SUVersionDisplay>;
|
||||
|
||||
// SPUUpdaterDelegate
|
||||
- (nonnull NSSet<NSString *> *)allowedChannelsForUpdater:(nonnull SPUUpdater *)updater;
|
||||
- (NSSet<NSString *> *)allowedChannelsForUpdater:(SPUUpdater *)updater;
|
||||
|
||||
// SPUStandardUserDriverDelegate
|
||||
// No need to implement anything for now. Default behaviors work fine.
|
||||
- (_Nullable id <SUVersionDisplay>)standardUserDriverRequestsVersionDisplayer;
|
||||
|
||||
// SUVersionDisplay
|
||||
- (NSString *)formatUpdateDisplayVersionFromUpdate:(SUAppcastItem *)update andBundleDisplayVersion:(NSString * _Nonnull __autoreleasing * _Nonnull)inOutBundleDisplayVersion withBundleVersion:(NSString *)bundleVersion;
|
||||
|
||||
- (NSString *)formatBundleDisplayVersion:(NSString *)bundleDisplayVersion withBundleVersion:(NSString *)bundleVersion matchingUpdate:(SUAppcastItem * _Nullable)matchingUpdate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,35 @@
|
||||
return [NSSet<NSString *> set];
|
||||
}
|
||||
|
||||
- (_Nullable id <SUVersionDisplay>)standardUserDriverRequestsVersionDisplayer
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
/// MacVim has a non-standard way of using "bundle version" and "display version",
|
||||
/// where the display version is the upstream Vim version, and the bundle version
|
||||
/// is the release number of MacVim itself. The release number is more useful to
|
||||
/// know when updating MacVim, but both should be displayed. Format them nicely so
|
||||
/// it's clear to the user which is which. By default Sparkle would only show display
|
||||
/// version which is problematic as that wouldn't show the release number which we
|
||||
/// care about.
|
||||
NSString* formatVersionString(NSString* bundleVersion, NSString* displayVersion)
|
||||
{
|
||||
return [NSString stringWithFormat:@"r%@ (Vim %@)", bundleVersion, displayVersion];
|
||||
}
|
||||
|
||||
- (NSString *)formatUpdateDisplayVersionFromUpdate:(SUAppcastItem *)update andBundleDisplayVersion:(NSString * _Nonnull __autoreleasing * _Nonnull)inOutBundleDisplayVersion withBundleVersion:(NSString *)bundleVersion
|
||||
{
|
||||
*inOutBundleDisplayVersion = formatVersionString(bundleVersion, *inOutBundleDisplayVersion);
|
||||
return formatVersionString(update.versionString, update.displayVersionString);
|
||||
}
|
||||
|
||||
- (NSString *)formatBundleDisplayVersion:(NSString *)bundleDisplayVersion withBundleVersion:(NSString *)bundleVersion matchingUpdate:(SUAppcastItem * _Nullable)matchingUpdate
|
||||
{
|
||||
return formatVersionString(bundleVersion, bundleDisplayVersion);
|
||||
}
|
||||
|
||||
|
||||
@end;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user