Skip to content

Commit

Permalink
Removing iOS9 code remnants (14)
Browse files Browse the repository at this point in the history
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ie22c785d7ffafe67aa790bb80a7bc4b2c4e0ec7c
Reviewed-on: https://chromium-review.googlesource.com/986383
Reviewed-by: Mark Cogan <marq@chromium.org>
Commit-Queue: Eric Noyau <noyau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546818}
  • Loading branch information
e-noyau authored and Commit Bot committed Mar 29, 2018
1 parent 3be5335 commit d3e1b20
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 46 deletions.
4 changes: 2 additions & 2 deletions ios/chrome/browser/ui/uikit_ui_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ bool IsSplitToolbarMode(id<UITraitEnvironment> environment);
// Returns the current first responder.
UIResponder* GetFirstResponder();

// On iOS10 and above, trigger a haptic vibration for various types of
// actions. This is a no-op for devices that do not support haptic feedback.
// Trigger a haptic vibration for various types of actions. This is a no-op for
// devices that do not support haptic feedback.
void TriggerHapticFeedbackForAction();
void TriggerHapticFeedbackForSelectionChange();
void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type);
Expand Down
80 changes: 36 additions & 44 deletions ios/chrome/browser/ui/uikit_ui_util.mm
Original file line number Diff line number Diff line change
Expand Up @@ -577,59 +577,51 @@ bool IsSplitToolbarMode(id<UITraitEnvironment> environment) {
return firstResponder;
}

// On iOS10 and above, trigger a haptic vibration for the user selecting an
// action. This is a no-op for devices that do not support it.
// Trigger a haptic vibration for the user selecting an action. This is a no-op
// for devices that do not support it.
void TriggerHapticFeedbackForAction() {
if (@available(iOS 10, *)) {
// Although Apple documentation claims that UIFeedbackGenerator and its
// concrete subclasses are available on iOS 10+, they are not really
// available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are
// okay) and Chrome will fail at dynamic link time and instantly crash.
// NSClassFromString() checks if Objective-C run-time has the class before
// using it.
Class generatorClass = NSClassFromString(@"UIImpactFeedbackGenerator");
if (generatorClass) {
UIImpactFeedbackGenerator* generator = [[generatorClass alloc] init];
[generator impactOccurred];
}
// Although Apple documentation claims that UIFeedbackGenerator and its
// concrete subclasses are available on iOS 10+, they are not really
// available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are
// okay) and Chrome will fail at dynamic link time and instantly crash.
// NSClassFromString() checks if Objective-C run-time has the class before
// using it.
Class generatorClass = NSClassFromString(@"UIImpactFeedbackGenerator");
if (generatorClass) {
UIImpactFeedbackGenerator* generator = [[generatorClass alloc] init];
[generator impactOccurred];
}
}

// On iOS10 and above, trigger a haptic vibration for the change in selection.
// This is a no-op for devices that do not support it.
// Trigger a haptic vibration for the change in selection. This is a no-op for
// devices that do not support it.
void TriggerHapticFeedbackForSelectionChange() {
if (@available(iOS 10, *)) {
// Although Apple documentation claims that UIFeedbackGenerator and its
// concrete subclasses are available on iOS 10+, they are not really
// available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are
// okay) and Chrome will fail at dynamic link time and instantly crash.
// NSClassFromString() checks if Objective-C run-time has the class before
// using it.
Class generatorClass = NSClassFromString(@"UISelectionFeedbackGenerator");
if (generatorClass) {
UISelectionFeedbackGenerator* generator = [[generatorClass alloc] init];
[generator selectionChanged];
}
// Although Apple documentation claims that UIFeedbackGenerator and its
// concrete subclasses are available on iOS 10+, they are not really
// available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are
// okay) and Chrome will fail at dynamic link time and instantly crash.
// NSClassFromString() checks if Objective-C run-time has the class before
// using it.
Class generatorClass = NSClassFromString(@"UISelectionFeedbackGenerator");
if (generatorClass) {
UISelectionFeedbackGenerator* generator = [[generatorClass alloc] init];
[generator selectionChanged];
}
}

// On iOS10 and above, trigger a haptic vibration for a notification.
// This is a no-op for devices that do not support it.
// Trigger a haptic vibration for a notification. This is a no-op for devices
// that do not support it.
void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type) {
if (@available(iOS 10, *)) {
// Although Apple documentation claims that UIFeedbackGenerator and its
// concrete subclasses are available on iOS 10+, they are not really
// available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are
// okay) and Chrome will fail at dynamic link time and instantly crash.
// NSClassFromString() checks if Objective-C run-time has the class before
// using it.
Class generatorClass =
NSClassFromString(@"UINotificationFeedbackGenerator");
if (generatorClass) {
UINotificationFeedbackGenerator* generator =
[[generatorClass alloc] init];
[generator notificationOccurred:type];
}
// Although Apple documentation claims that UIFeedbackGenerator and its
// concrete subclasses are available on iOS 10+, they are not really
// available on an app whose deployment target is iOS 10.0 (iOS 10.1+ are
// okay) and Chrome will fail at dynamic link time and instantly crash.
// NSClassFromString() checks if Objective-C run-time has the class before
// using it.
Class generatorClass = NSClassFromString(@"UINotificationFeedbackGenerator");
if (generatorClass) {
UINotificationFeedbackGenerator* generator = [[generatorClass alloc] init];
[generator notificationOccurred:type];
}
}

Expand Down

0 comments on commit d3e1b20

Please sign in to comment.