mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Added delegate methods that interacts with DevMate (beta updates, test mode).
This commit is contained in:
1 parent
7797a8f58c
commit
9119d287ab
2 files changed
+48
-1
No files matched your search
+15
@@ -142,6 +142,21 @@
|
||||
|
||||
@end
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// SUUpdater Delegate: DevMate Interaction
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// NOTE!!! Implemented delegate methods have higher priority than values saved in user preferences
|
||||
|
||||
FOUNDATION_EXPORT NSString *const SUUpdaterChecksForBetaUpdatesPrefKey; // bool value
|
||||
FOUNDATION_EXPORT NSString *const SUUpdaterIsInTestModePrefKey; // bool value
|
||||
|
||||
@interface NSObject (SUUpdaterDelegate_DevMateInteraction)
|
||||
|
||||
- (BOOL)updaterShouldCheckForBetaUpdates:(SUUpdater *)updater;
|
||||
- (BOOL)isUpdaterInTestMode:(SUUpdater *)updater;
|
||||
|
||||
@end
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constants:
|
||||
|
||||
+33
-1
@@ -479,7 +479,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
const NSTimeInterval oneWeek = 60 * 60 * 24 * 7;
|
||||
sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek);
|
||||
|
||||
NSArray *parameters = [NSArray array];
|
||||
NSArray *parameters = [self devmateFeedParameters];
|
||||
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)])
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]];
|
||||
if (sendingSystemProfile)
|
||||
@@ -564,4 +564,36 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
return [[NSFileManager defaultManager] fileExistsAtPath:[xpcServicePrefixPath stringByAppendingPathComponent:xpcServiceSuffixPath]];
|
||||
}
|
||||
|
||||
#pragma mark - DevMate Interaction
|
||||
|
||||
NSString *const SUUpdaterChecksForBetaUpdatesPrefKey = @"SUUpdaterChecksForBetaUpdates";
|
||||
NSString *const SUUpdaterIsInTestModePrefKey = @"SUUpdaterIsInTestMode";
|
||||
|
||||
- (NSArray *)devmateFeedParameters
|
||||
{
|
||||
NSMutableArray *parameters = [NSMutableArray array];
|
||||
|
||||
BOOL isInTestMode = [host boolForUserDefaultsKey:SUUpdaterIsInTestModePrefKey];
|
||||
if ([delegate respondsToSelector:@selector(isUpdaterInTestMode:)])
|
||||
{
|
||||
isInTestMode = [delegate isUpdaterInTestMode:self];
|
||||
}
|
||||
if (isInTestMode)
|
||||
{
|
||||
[parameters addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"test", @"key", @"1", @"value", nil]];
|
||||
}
|
||||
|
||||
BOOL shouldCheckBeta = [host boolForUserDefaultsKey:SUUpdaterChecksForBetaUpdatesPrefKey];
|
||||
if ([delegate respondsToSelector:@selector(updaterShouldCheckForBetaUpdates:)])
|
||||
{
|
||||
shouldCheckBeta = [delegate updaterShouldCheckForBetaUpdates:self];
|
||||
}
|
||||
if (shouldCheckBeta)
|
||||
{
|
||||
[parameters addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"beta", @"key", @"1", @"value", nil]];
|
||||
}
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user