mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Refactor ios play input sound logic. (flutter/engine#7783)
As there are extra requirement to use playInputClick in iOS, use AudioServicesPlaySystemSound instead to play input sound.
This commit is contained in:
parent
c80b91dcde
commit
c7754e142b
@ -13,6 +13,7 @@
|
||||
namespace {
|
||||
|
||||
constexpr char kTextPlainFormat[] = "text/plain";
|
||||
const UInt32 kKeyPressClickSoundId = 1306;
|
||||
|
||||
} // namespaces
|
||||
|
||||
@ -93,9 +94,8 @@ using namespace shell;
|
||||
- (void)playSystemSound:(NSString*)soundType {
|
||||
if ([soundType isEqualToString:@"SystemSoundType.click"]) {
|
||||
// All feedback types are specific to Android and are treated as equal on
|
||||
// iOS. The surface must (and does) adopt the UIInputViewAudioFeedback
|
||||
// protocol
|
||||
[[UIDevice currentDevice] playInputClick];
|
||||
// iOS.
|
||||
AudioServicesPlaySystemSound(kKeyPressClickSoundId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,10 +17,6 @@
|
||||
#include "flutter/shell/platform/darwin/ios/ios_surface_software.h"
|
||||
#include "third_party/skia/include/utils/mac/SkCGUtils.h"
|
||||
|
||||
@interface FlutterView () <UIInputViewAudioFeedback>
|
||||
|
||||
@end
|
||||
|
||||
@implementation FlutterView
|
||||
|
||||
id<FlutterViewEngineDelegate> _delegate;
|
||||
@ -97,10 +93,6 @@ id<FlutterViewEngineDelegate> _delegate;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)enableInputClicksWhenVisible {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context {
|
||||
TRACE_EVENT0("flutter", "SnapshotFlutterView");
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user