This repository has been archived by the owner on Apr 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathABVolumeHUDViewSettings.m
76 lines (62 loc) · 1.77 KB
/
ABVolumeHUDViewSettings.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// ABVolumeHUDViewSettings.m
// Ultrasound
//
// Created by Ayden Panhuyzen on 8/28/18.
// Copyright © 2018 Ayden Panhuyzen. All rights reserved.
//
#import "ABVolumeHUDViewSettings.h"
@implementation ABVolumeHUDViewSettings
+ (instancetype)sharedSettings {
static ABVolumeHUDViewSettings *sharedSettings = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedSettings = [[self alloc] init];
});
return sharedSettings;
}
- (instancetype)init {
self = [super init];
if (self) {
_showVolumeIcon = YES;
_showVolumePercentage = YES;
_timeout = 3;
_showOLEDVolumeIcon = YES;
_showOLEDVolumePercentage = YES;
_enableHapticFeedback = YES;
}
return self;
}
- (void)settingsChanged {
[[NSNotificationCenter defaultCenter] postNotificationName:kHUDSettingsChanged object:nil];
}
// MARK: - Observers
- (void)setShowVolumeIcon:(BOOL)showVolumeIcon {
_showVolumeIcon = showVolumeIcon;
[self settingsChanged];
}
- (void)setShowVolumePercentage:(BOOL)showVolumePercentage {
_showVolumePercentage = showVolumePercentage;
[self settingsChanged];
}
- (void)setTimeout:(CGFloat)timeout {
_timeout = timeout;
[self settingsChanged];
}
- (void)setShowOLEDVolumeIcon:(BOOL)showOLEDVolumeIcon {
_showOLEDVolumeIcon = showOLEDVolumeIcon;
[self settingsChanged];
}
- (void)setShowOLEDVolumePercentage:(BOOL)showOLEDVolumePercentage {
_showOLEDVolumePercentage = showOLEDVolumePercentage;
[self settingsChanged];
}
- (void)setEnableHapticFeedback:(BOOL)enableHapticFeedback {
_enableHapticFeedback = enableHapticFeedback;
[self settingsChanged];
}
- (void)setStyle:(ABVolumeHUDStyle)style {
_style = style;
[self settingsChanged];
}
@end