Skip to content

Commit bbb1de3

Browse files
committed
comments
1 parent 42bdc44 commit bbb1de3

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
namespace {
2323

2424
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
2527
const UInt32 kKeyPressClickSoundId = 1306;
26-
const UInt32 kPickerTickSoundId = 1157;
28+
const UInt32 kWheelsOfTimeSoundId = 1157;
2729

2830
NSString* const kSearchURLPrefix = @"x-web-search://?";
2931

@@ -245,7 +247,7 @@ - (void)playSystemSound:(NSString*)soundType {
245247
// iOS.
246248
AudioServicesPlaySystemSound(kKeyPressClickSoundId);
247249
} else if ([soundType isEqualToString:@"SystemSoundType.tick"]) {
248-
AudioServicesPlaySystemSound(kPickerTickSoundId);
250+
AudioServicesPlaySystemSound(kWheelsOfTimeSoundId);
249251
}
250252
}
251253

engine/src/flutter/shell/platform/windows/platform_handler.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ void PlatformHandler::SystemSoundPlay(
368368
if (sound_type.compare(kSoundTypeAlert) == 0) {
369369
MessageBeep(MB_OK);
370370
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();
371377
} else {
372378
result->NotImplemented();
373379
}

engine/src/flutter/shell/platform/windows/platform_handler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class PlatformHandler {
104104
static constexpr char kClipboardError[] = "Clipboard error";
105105

106106
static constexpr char kSoundTypeAlert[] = "SystemSoundType.alert";
107+
static constexpr char kSoundTypeClick[] = "SystemSoundType.click";
108+
static constexpr char kSoundTypeTick[] = "SystemSoundType.tick";
107109

108110
private:
109111
// Called when a method is called on |channel_|;

packages/flutter/lib/src/services/system_sound.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ enum SystemSoundType {
2424
/// ignored on the web as well.
2525
alert,
2626

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);
2933
}
3034

3135
/// Provides access to the library of short system specific sounds for common

packages/flutter/test/cupertino/picker_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ void main() {
398398
});
399399

400400
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',
402402
(WidgetTester tester) async {
403403
final List<int> selectedItems = <int>[];
404404
final List<MethodCall> systemCalls = <MethodCall>[];
@@ -444,7 +444,7 @@ void main() {
444444
);
445445

446446
testWidgets(
447-
'do not trigger haptic and sound effects on non-iOS devices',
447+
'do not trigger haptic or sounds on non-iOS devices',
448448
(WidgetTester tester) async {
449449
final List<int> selectedItems = <int>[];
450450
final List<MethodCall> systemCalls = <MethodCall>[];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy