From 5983455849dbe33045168a8c53b4e92b1f54428c Mon Sep 17 00:00:00 2001 From: CMK Date: Mon, 7 Jun 2021 14:30:42 +0800 Subject: [PATCH] feat: add keyboard click sound for custom emoji picker --- .../mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist | 4 ++-- Mastodon/Scene/Compose/ComposeViewController.swift | 3 +++ .../Scene/Compose/View/CustomEmojiPickerInputView.swift | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 5fbf06844..217fe1993 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ CoreDataStack.xcscheme_^#shared#^_ orderHint - 16 + 15 Mastodon - RTL.xcscheme_^#shared#^_ @@ -32,7 +32,7 @@ NotificationService.xcscheme_^#shared#^_ orderHint - 15 + 16 SuppressBuildableAutocreation diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 595c8743b..90f3e4487 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -1031,6 +1031,9 @@ extension ComposeViewController: UICollectionViewDelegate { DispatchQueue.main.async { [weak self] in guard let self = self else { return } self.collectionView.collectionViewLayout.invalidateLayout() + + // make click sound + UIDevice.current.playInputClick() } } } else { diff --git a/Mastodon/Scene/Compose/View/CustomEmojiPickerInputView.swift b/Mastodon/Scene/Compose/View/CustomEmojiPickerInputView.swift index 6bfe31d34..2fa582883 100644 --- a/Mastodon/Scene/Compose/View/CustomEmojiPickerInputView.swift +++ b/Mastodon/Scene/Compose/View/CustomEmojiPickerInputView.swift @@ -84,3 +84,9 @@ extension CustomEmojiPickerInputView { return layout } } + +extension CustomEmojiPickerInputView: UIInputViewAudioFeedback { + var enableInputClicksWhenVisible: Bool { + return true + } +}