PushSetting.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2018-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. #import "BaseMessage.h"
  22. typedef NS_ENUM(NSInteger, PushSettingType) {
  23. kPushSettingTypeOn = 0,
  24. kPushSettingTypeOff,
  25. kPushSettingTypeOffPeriod
  26. };
  27. typedef NS_ENUM(NSInteger, PeriodOffTime) {
  28. kPeriodOffTime1Hour = 0,
  29. kPeriodOffTime2Hours = 1,
  30. kPeriodOffTime3Hours = 2,
  31. kPeriodOffTime4Hours = 3,
  32. kPeriodOffTime8Hours = 4,
  33. kPeriodOffTime1Day = 5,
  34. kPeriodOffTime1Week = 6
  35. };
  36. @interface PushSetting : NSObject
  37. @property (nonatomic, strong) NSString *identity;
  38. @property (nonatomic) PushSettingType type;
  39. @property (nonatomic) PeriodOffTime periodOffTime;
  40. @property (nonatomic, strong) NSDate *periodOffTillDate;
  41. @property (nonatomic) BOOL silent;
  42. @property (nonatomic) BOOL mentions;
  43. + (PushSetting *)findPushSettingForIdentity:(NSString *)identity pushSettingList:(NSOrderedSet *)pushSettingList;
  44. + (PushSetting *)findPushSettingForConversation:(Conversation *)conversation;
  45. + (NSDictionary *)findPushSettingDictForIdentity:(NSString *)identity;
  46. + (NSDictionary *)findPushSettingDictForConversation:(Conversation *)conversation;
  47. + (PushSetting *)findPushSettingForIdentity:(NSString *)identity;
  48. + (PushSetting *)findPushSettingForGroupId:(NSData *)groupId;
  49. - (id)initWithDictionary:(NSDictionary *)dict;
  50. - (NSDictionary *)buildDict;
  51. - (BOOL)canSendPushForBaseMessage:(BaseMessage *)baseMessage;
  52. - (BOOL)canSendPush;
  53. - (UIImage *)imageForEditedPushSetting;
  54. - (UIImage *)imageForPushSetting;
  55. @end