1

Archive Project

This commit is contained in:
Kim Wittenburg
2017-07-25 17:21:13 +02:00
parent 7d4f001502
commit 15062dfb27
66 changed files with 14172 additions and 4692 deletions

View File

@@ -0,0 +1,69 @@
//
// NYTChannelRestrictions.m
// Notifications for YouTube
//
// Created by Kim Wittenburg on 21.07.13.
// Copyright (c) 2013 Kim Wittenburg. All rights reserved.
//
#import "NYTChannelRestriction.h"
// Core Imports
#import "NYTUtil.h"
@implementation NYTChannelRestriction
+ (NSSet *)keyPathsForValuesAffectingLocalizedRestrictionSummary
{
return [NSSet setWithObjects:@"disableAllNotifications", @"predicate", nil];
}
- (id)init
{
self = [super init];
if (self) {
// Default values
_positivePredicate = YES;
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [self init];
if (self) {
// Do not decode the user
_disableAllNotifications = [aDecoder decodeBoolForKey:@"Disable All Notifications"];
_predicate = [aDecoder decodeObjectForKey:@"Predicate"];
_positivePredicate = [aDecoder decodeBoolForKey:@"Positive Predicate"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
// Do not encode the user
[aCoder encodeBool:self.disableAllNotifications forKey:@"Disable All Notifications"];
[aCoder encodeObject:self.predicate forKey:@"Predicate"];
[aCoder encodeBool:self.positivePredicate forKey:@"Positive Predicate"];
}
- (NSString *)localizedRestrictionSummary
{
if (self.disableAllNotifications) {
return NSLocalizedString(@"No notifications", nil);
} else {
if (!self.predicate) {
return NSLocalizedString(@"Show all notifications", nil);
} else {
return NSLocalizedString(@"Restrict notifications", nil);
}
}
}
- (BOOL)differsFromDefaultValues
{
return self.disableAllNotifications == YES || self.predicate != nil;
}
@end