Commit cf155c5c authored by Ewann's avatar Ewann Committed by Commit Bot

[iOS] Updates link label to texts view in welcome screen

based on: https://crrev.com/c/2300383
This CL updates the link label used to display the TOS string to an UITextView.
A sublcass is needed to override the |canBecomeFirstResponder| method.

On iOS 13,we can't override |canBecomeFirstResponder| or the whole
string will responds to a tap.

On iOS 12, the whole string responds to a tap if we use this current
implementation.

Bug: 1102996
Change-Id: Id9c9e3089d07a056c365043e1d60b1b558586ccf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2302900
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarJavier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791755}
parent 2474fd40
...@@ -18,6 +18,8 @@ source_set("elements") { ...@@ -18,6 +18,8 @@ source_set("elements") {
"selector_view_controller_delegate.h", "selector_view_controller_delegate.h",
"text_field_configuration.h", "text_field_configuration.h",
"text_field_configuration.mm", "text_field_configuration.mm",
"text_view_selection_disabled.h",
"text_view_selection_disabled.mm",
"top_aligned_image_view.h", "top_aligned_image_view.h",
"top_aligned_image_view.mm", "top_aligned_image_view.mm",
"windowed_container_view.h", "windowed_container_view.h",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_ELEMENTS_TEXT_VIEW_SELECTION_DISABLED_H_
#define IOS_CHROME_BROWSER_UI_ELEMENTS_TEXT_VIEW_SELECTION_DISABLED_H_
#import <UIKit/UIKit.h>
// UITextView subclass is needed to override -canBecomeFirstResponder to prevent
// text selection while maintaining clickable link.
@interface TextViewSelectionDisabled : UITextView
@end
#endif // IOS_CHROME_BROWSER_UI_ELEMENTS_TEXT_VIEW_SELECTION_DISABLED_H_
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/elements/text_view_selection_disabled.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation TextViewSelectionDisabled
- (BOOL)canBecomeFirstResponder {
if (@available(iOS 14.0, *))
return NO;
// On iOS 13, the whole string responds to a tap if
// canBecomeFirstResponder returns NO.
return YES;
}
@end
...@@ -37,6 +37,7 @@ source_set("first_run") { ...@@ -37,6 +37,7 @@ source_set("first_run") {
"//ios/chrome/browser/ui/authentication", "//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication/signin", "//ios/chrome/browser/ui/authentication/signin",
"//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/elements",
"//ios/chrome/browser/ui/fancy_ui", "//ios/chrome/browser/ui/fancy_ui",
"//ios/chrome/browser/ui/icons", "//ios/chrome/browser/ui/icons",
"//ios/chrome/browser/ui/material_components", "//ios/chrome/browser/ui/material_components",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment