Skip to content

Commit 26f21c4

Browse files
committed
feat: feedback controls more
Signed-off-by: Lessica <82flex@gmail.com>
1 parent afdddbd commit 26f21c4

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

Tweak/Core/KayokoCore.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ static void load_preferences() {
210210

211211
if (kayokoView) {
212212
[kayokoView setAutomaticallyPaste:kayokoPrefsAutomaticallyPaste];
213+
[kayokoView setShouldPlayFeedback:kayokoPrefsPlayHapticFeedback];
213214
CGRect bounds = [[UIScreen mainScreen] bounds];
214215
CGRect newFrame =
215216
CGRectMake(0, bounds.size.height - kayokoPrefsHeightInPoints, bounds.size.width, kayokoPrefsHeightInPoints);

Tweak/Core/Views/KayokoView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static NSUInteger const kBackButtonImageSize = 20;
3939
@property(nonatomic, strong) KayokoPreviewView *previewView;
4040
@property(nonatomic, strong) UIImpactFeedbackGenerator *feedbackGenerator;
4141
@property(nonatomic, assign) BOOL automaticallyPaste;
42+
@property(nonatomic, assign) BOOL shouldPlayFeedback;
4243
- (void)showPreviewWithItem:(PasteboardItem *)item;
4344
- (void)show;
4445
- (void)hide;

Tweak/Core/Views/KayokoView.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ - (void)showContentView:(UIView *)viewToShow andHideContentView:(UIView *)viewTo
441441
* @param style The feedback type/strength to use.
442442
*/
443443
- (void)triggerHapticFeedbackWithStyle:(UIImpactFeedbackStyle)style {
444+
if (!self.shouldPlayFeedback) {
445+
return;
446+
}
444447
[self setFeedbackGenerator:[[UIImpactFeedbackGenerator alloc] initWithStyle:style]];
445448
[[self feedbackGenerator] prepare];
446449
[[self feedbackGenerator] impactOccurred];

0 commit comments

Comments
 (0)