File tree Expand file tree Collapse file tree 5 files changed +20
-6
lines changed
engine/src/flutter/shell/platform
darwin/ios/framework/Source Expand file tree Collapse file tree 5 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 22
22
namespace {
23
23
24
24
constexpr char kTextPlainFormat [] = " text/plain" ;
25
+ // Some of the official iOS system sounds. A full list can be found in many places online, such as:
26
+ // https://github.com/p-x9/swift-system-sound/blob/cb4327b223d55d01e9156539c8442db16f4b1f85/SystemSoundTable.md
25
27
const UInt32 kKeyPressClickSoundId = 1306 ;
26
- const UInt32 kPickerTickSoundId = 1157 ;
28
+ const UInt32 kWheelsOfTimeSoundId = 1157 ;
27
29
28
30
NSString * const kSearchURLPrefix = @" x-web-search://?" ;
29
31
@@ -245,7 +247,7 @@ - (void)playSystemSound:(NSString*)soundType {
245
247
// iOS.
246
248
AudioServicesPlaySystemSound (kKeyPressClickSoundId );
247
249
} else if ([soundType isEqualToString: @" SystemSoundType.tick" ]) {
248
- AudioServicesPlaySystemSound (kPickerTickSoundId );
250
+ AudioServicesPlaySystemSound (kWheelsOfTimeSoundId );
249
251
}
250
252
}
251
253
Original file line number Diff line number Diff line change @@ -368,6 +368,12 @@ void PlatformHandler::SystemSoundPlay(
368
368
if (sound_type.compare (kSoundTypeAlert ) == 0 ) {
369
369
MessageBeep (MB_OK);
370
370
result->Success ();
371
+ } else if (sound_type.compare (kSoundTypeClick ) == 0 ) {
372
+ // No-op, as there is no system sound for key presses.
373
+ result->Success ();
374
+ } else if (sound_type.compare (kSoundTypeTick ) == 0 ) {
375
+ // No-op, as there is no system sound for ticks.
376
+ result->Success ();
371
377
} else {
372
378
result->NotImplemented ();
373
379
}
Original file line number Diff line number Diff line change @@ -104,6 +104,8 @@ class PlatformHandler {
104
104
static constexpr char kClipboardError [] = " Clipboard error" ;
105
105
106
106
static constexpr char kSoundTypeAlert [] = " SystemSoundType.alert" ;
107
+ static constexpr char kSoundTypeClick [] = " SystemSoundType.click" ;
108
+ static constexpr char kSoundTypeTick [] = " SystemSoundType.tick" ;
107
109
108
110
private:
109
111
// Called when a method is called on |channel_|;
Original file line number Diff line number Diff line change @@ -24,8 +24,12 @@ enum SystemSoundType {
24
24
/// ignored on the web as well.
25
25
alert,
26
26
27
- // If you add new values here, you also need to update the `SoundType` Java
28
- // enum in `PlatformChannel.java`.
27
+ // If you add new values here, you also need to update:
28
+ // - the `SoundType` Java enum in `PlatformChannel.java` (Android);
29
+ // - `FlutterPlatformPlugin.mm` (iOS);
30
+ // - `FlutterPlatformPlugin.mm` (macOS);
31
+ // - `fl_platform_handler.cc` (Linux);
32
+ // - `platform_handler.cc` (Windows);
29
33
}
30
34
31
35
/// Provides access to the library of short system specific sounds for common
Original file line number Diff line number Diff line change @@ -398,7 +398,7 @@ void main() {
398
398
});
399
399
400
400
testWidgets (
401
- 'does not trigger haptics and sound when scrolling by tapping on the item' ,
401
+ 'does not trigger haptics or sounds when scrolling by tapping on the item' ,
402
402
(WidgetTester tester) async {
403
403
final List <int > selectedItems = < int > [];
404
404
final List <MethodCall > systemCalls = < MethodCall > [];
@@ -444,7 +444,7 @@ void main() {
444
444
);
445
445
446
446
testWidgets (
447
- 'do not trigger haptic and sound effects on non-iOS devices' ,
447
+ 'do not trigger haptic or sounds on non-iOS devices' ,
448
448
(WidgetTester tester) async {
449
449
final List <int > selectedItems = < int > [];
450
450
final List <MethodCall > systemCalls = < MethodCall > [];
You can’t perform that action at this time.
0 commit comments