A platform for community discussion. Free, open, simple.
DEV: Remove lib/utilities isiPad (#37471)
Martin Brennana2b8fc8dceec
diff --git a/frontend/discourse/app/components/composer-body.js b/frontend/discourse/app/components/composer-body.jsindex 61542c90bcf..ab072d5d04d 100644--- a/frontend/discourse/app/components/composer-body.js+++ b/frontend/discourse/app/components/composer-body.js@@ -1,13 +1,13 @@/* eslint-disable ember/no-classic-components, ember/no-observers, ember/require-tagless-components */import Component from "@ember/component";import { cancel, schedule } from "@ember/runloop";+import { service } from "@ember/service";import { dasherize } from "@ember/string";import { classNameBindings } from "@ember-decorators/component";import { observes } from "@ember-decorators/object";import discourseDebounce from "discourse/lib/debounce";import discourseComputed from "discourse/lib/decorators";import discourseLater from "discourse/lib/later";-import { isiPad } from "discourse/lib/utilities";import Composer from "discourse/models/composer";@classNameBindings(@@ -24,6 +24,8 @@ import Composer from "discourse/models/composer";"currentUserPrimaryGroupClass")export default class ComposerBody extends Component {+ @service capabilities;+elementId = "reply-control";@discourseComputed("composer.action")@@ -105,7 +107,7 @@ export default class ComposerBody extends Component {this.cancelled();} else if (e.key === "Enter" &&- (e.ctrlKey || e.metaKey || (isiPad() && e.altKey))+ (e.ctrlKey || e.metaKey || (this.capabilities.isIpadOS && e.altKey))) {// Ctrl+Enter or Cmd+Enter// iPad physical keyboard does not offer Command or Ctrl detectiondiff --git a/frontend/discourse/app/components/search-menu/search-term.gjs b/frontend/discourse/app/components/search-menu/search-term.gjsindex 32284f267c2..d43f825a6b8 100644--- a/frontend/discourse/app/components/search-menu/search-term.gjs+++ b/frontend/discourse/app/components/search-menu/search-term.gjs@@ -5,7 +5,6 @@ import { action } from "@ember/object";import didInsert from "@ember/render-modifiers/modifiers/did-insert";import { service } from "@ember/service";import { DEFAULT_TYPE_FILTER } from "discourse/components/search-menu";-import { isiPad } from "discourse/lib/utilities";import { i18n } from "discourse-i18n";const SECOND_ENTER_MAX_DELAY = 15000;@@ -21,6 +20,7 @@ export function resetOnKeyUpCallbacks() {export default class SearchTerm extends Component {@service search;+ @service capabilities;@tracked lastEnterTimestamp = null;@tracked searchCleared = !this.search.activeGlobalSearchTerm;@@ -78,7 +78,7 @@ export default class SearchTerm extends Component {if (e.ctrlKey ||e.metaKey ||- (isiPad() && e.altKey) ||+ (this.capabilities.isIpadOS && e.altKey) ||(this.args.typeFilter !== DEFAULT_TYPE_FILTER && recentEnterHit)) {this.args.fullSearch();diff --git a/frontend/discourse/app/components/topic-title.gjs b/frontend/discourse/app/components/topic-title.gjsindex f1a13415f36..753515b9622 100644--- a/frontend/discourse/app/components/topic-title.gjs+++ b/frontend/discourse/app/components/topic-title.gjs@@ -5,11 +5,11 @@ import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";import { service } from "@ember/service";import PluginOutlet from "discourse/components/plugin-outlet";import lazyHash from "discourse/helpers/lazy-hash";-import { isiPad } from "discourse/lib/utilities";import observeIntersection from "discourse/modifiers/observe-intersection";export default class TopicTitle extends Component {@service header;+ @service capabilities;@actionkeyDown(e) {@@ -18,7 +18,7 @@ export default class TopicTitle extends Component {this.args.cancelled();} else if (e.key === "Enter" &&- (e.ctrlKey || e.metaKey || (isiPad() && e.altKey))+ (e.ctrlKey || e.metaKey || (this.capabilities.isIpadOS && e.altKey))) {// Ctrl+Enter or Cmd+Enter// iPad physical keyboard does not offer Command or Ctrl detectiondiff --git a/frontend/discourse/app/lib/utilities.js b/frontend/discourse/app/lib/utilities.jsindex 71871a0ba49..e563ca18a8b 100644--- a/frontend/discourse/app/lib/utilities.js+++ b/frontend/discourse/app/lib/utilities.js@@ -279,17 +279,6 @@ export function isAppleDevice() {return caps.isIOS && !window.navigator.userAgent.match(/Trident/g);}-let iPadDetected = undefined;--export function isiPad() {- if (iPadDetected === undefined) {- iPadDetected =- window.navigator.userAgent.match(/iPad/g) &&- !window.navigator.userAgent.match(/Trident/g);- }- return iPadDetected;-}-export function safariHacksDisabled() {deprecated("`safariHacksDisabled()` is deprecated, it now always returns `false`",