Commit 274ff8fe authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Create Default Browser Fullscreen promo UI

Creates DefaultBrowserPromoCoordinator, which will manage
new DefaultBrowserPromoViewController to show the fullscreen
promotion modal for users that may want to set Chromium as
their default browser.

Screenshot: https://drive.google.com/file/d/1wGlAB88CA-vokoBnolz59a4lvaFrKXfc/view?usp=sharing

Bug: 1107489
Change-Id: Ia937bdbdb5bb275435dfe234a2019455b1ffdff9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2318687Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792372}
parent ba73538c
......@@ -181,6 +181,21 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_CLEAR_BROWSING_DATA_HISTORY_NOTICE_TITLE" desc="Title of a dialog that informs the user that the deletion of Chromium's browsing data has been completed.">
Cleared Chromium data
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_TITLE" desc="Title of the default browser promotion modal. [iOS only]">
Make Chromium Your Default
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_DESCRIPTION" desc="Description of the default browser promotion modal. [iOS only]">
You can now use Chromium any time you tap links in messages, documents, and other apps.
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_LEARN_MORE_MESSAGE" desc="Message when the user taps the addition information button in the default browser promotion modal. [iOS only]">
To make Chromium your default:
1. Open Settings.
2. Tap Default Browser App.
3. Select Chromium.
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_MAIN_BUTTON_TEXT" desc="Text of the button that will take the user to the Settings page to configure the default browser [iOS only]">
Open Settings
</message>
<message name="IDS_IOS_DISCONNECT_DIALOG_TITLE" desc="The title of the disconnect dialog [Length: 30em].">
Sign out of Chromium?
</message>
......
8f4f682e99b73b337546e94ca4da5036742af5e0
\ No newline at end of file
a3fbd2d8a7594b246fbe1a53eb8f4d3d770fbdba
\ No newline at end of file
7aae04d002cdaa1231f1c8e7b4bfc9e206de5d20
\ No newline at end of file
7aae04d002cdaa1231f1c8e7b4bfc9e206de5d20
\ No newline at end of file
......@@ -181,6 +181,21 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_CLEAR_BROWSING_DATA_HISTORY_NOTICE_TITLE" desc="Title of a dialog that informs the user that the deletion of Chrome's browsing data has been completed.">
Cleared Chrome data
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_TITLE" desc="Title of the default browser promotion modal. [iOS only]">
Make Chrome Your Default
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_DESCRIPTION" desc="Description of the default browser promotion modal. [iOS only]">
You can now use Chrome any time you tap links in messages, documents, and other apps.
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_LEARN_MORE_MESSAGE" desc="Message when the user taps the addition information button in the default browser promotion modal. [iOS only]">
To make Chrome your default:
1. Open Settings.
2. Tap Default Browser App.
3. Select Chrome.
</message>
<message name="IDS_IOS_DEFAULT_BROWSER_MAIN_BUTTON_TEXT" desc="Text of the button that will take the user to the Settings page to configure the default browser [iOS only]">
Open Settings
</message>
<message name="IDS_IOS_DISCONNECT_DIALOG_TITLE" desc="The title of the disconnect dialog [Length: 30em].">
Sign out of Chrome?
</message>
......
8f4f682e99b73b337546e94ca4da5036742af5e0
\ No newline at end of file
e1e58ae4b84528a857549e1e78e290e2a9e73b4f
\ No newline at end of file
# Copyright 2015 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.
source_set("whats_new") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"default_browser_promo_commands.h",
"default_browser_promo_coordinator.h",
"default_browser_promo_coordinator.mm",
"default_browser_promo_view_controller.h",
"default_browser_promo_view_controller.mm",
]
deps = [
"//base",
"//ios/chrome/app/strings:ios_google_chrome_strings",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/chrome/browser/ui/whats_new/resources",
"//ios/chrome/common/ui/confirmation_alert",
"//ui/base",
]
}
// 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_WHATS_NEW_DEFAULT_BROWSER_PROMO_COMMANDS_H_
#define IOS_CHROME_BROWSER_UI_WHATS_NEW_DEFAULT_BROWSER_PROMO_COMMANDS_H_
@protocol DefaultBrowserPromoCommands <NSObject>
// Command the promo to be hidden.
- (void)hidePromo;
@end
#endif // IOS_CHROME_BROWSER_UI_WHATS_NEW_DEFAULT_BROWSER_PROMO_COMMANDS_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_WHATS_NEW_DEFAULT_BROWSER_PROMO_COORDINATOR_H_
#define IOS_CHROME_BROWSER_UI_WHATS_NEW_DEFAULT_BROWSER_PROMO_COORDINATOR_H_
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
#import "ios/chrome/browser/ui/whats_new/default_browser_promo_commands.h"
@interface DefaultBrowserPromoCoordinator : ChromeCoordinator
// Handler for all actions of this coordinator.
@property(nonatomic, weak) id<DefaultBrowserPromoCommands> handler;
@end
#endif // IOS_CHROME_BROWSER_UI_WHATS_NEW_DEFAULT_BROWSER_PROMO_COORDINATOR_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/whats_new/default_browser_promo_coordinator.h"
#import "ios/chrome/browser/ui/whats_new/default_browser_promo_view_controller.h"
#import "ios/chrome/common/ui/confirmation_alert/confirmation_alert_action_handler.h"
#import "ios/chrome/common/ui/elements/popover_label_view_controller.h"
#include "ios/chrome/grit/ios_google_chrome_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface DefaultBrowserPromoCoordinator () <ConfirmationAlertActionHandler>
// The fullscreen confirmation modal promo view controller this coordiantor
// manages.
@property(nonatomic, strong)
DefaultBrowserPromoViewController* defaultBrowerPromoViewController;
// Popover used to show learn more info, not nil when presented.
@property(nonatomic, strong)
PopoverLabelViewController* learnMoreViewController;
@end
@implementation DefaultBrowserPromoCoordinator
#pragma mark - Public Methods.
- (void)start {
[super start];
self.defaultBrowerPromoViewController =
[[DefaultBrowserPromoViewController alloc] init];
self.defaultBrowerPromoViewController.actionHandler = self;
[self.baseViewController
presentViewController:self.defaultBrowerPromoViewController
animated:YES
completion:nil];
}
- (void)stop {
[self.defaultBrowerPromoViewController.presentingViewController
dismissViewControllerAnimated:YES
completion:nil];
self.defaultBrowerPromoViewController = nil;
[super stop];
}
#pragma mark - ConfirmationAlertActionHandler
- (void)confirmationAlertDismissAction {
[self.handler hidePromo];
}
- (void)confirmationAlertPrimaryAction {
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]
options:{}
completionHandler:nil];
[self.handler hidePromo];
}
- (void)confirmationAlertLearnMoreAction {
NSString* message =
l10n_util::GetNSString(IDS_IOS_DEFAULT_BROWSER_LEARN_MORE_MESSAGE);
self.learnMoreViewController =
[[PopoverLabelViewController alloc] initWithMessage:message];
self.learnMoreViewController.popoverPresentationController.barButtonItem =
self.defaultBrowerPromoViewController.helpButton;
self.learnMoreViewController.popoverPresentationController
.permittedArrowDirections = UIPopoverArrowDirectionUp;
[self.defaultBrowerPromoViewController
presentViewController:self.learnMoreViewController
animated:YES
completion:nil];
}
@end
// 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_WHATS_NEW_DEFAULT_BROWSER_PROMO_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_WHATS_NEW_DEFAULT_BROWSER_PROMO_VIEW_CONTROLLER_H_
#import "ios/chrome/common/ui/confirmation_alert/confirmation_alert_view_controller.h"
@interface DefaultBrowserPromoViewController : ConfirmationAlertViewController
@end
#endif // IOS_CHROME_BROWSER_UI_WHATS_NEW_DEFAULT_BROWSER_PROMO_VIEW_CONTROLLER_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/whats_new/default_browser_promo_view_controller.h"
#include "ios/chrome/grit/ios_google_chrome_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation DefaultBrowserPromoViewController
#pragma mark - Public
- (void)loadView {
self.image = [UIImage imageNamed:@"default_browser_illustration"];
self.customSpacingAfterImage = 30;
self.helpButtonAvailable = YES;
self.primaryActionAvailable = YES;
self.titleString = l10n_util::GetNSString(IDS_IOS_DEFAULT_BROWSER_TITLE);
self.subtitleString =
l10n_util::GetNSString(IDS_IOS_DEFAULT_BROWSER_DESCRIPTION);
self.primaryActionString =
l10n_util::GetNSString(IDS_IOS_DEFAULT_BROWSER_MAIN_BUTTON_TEXT);
self.dismissBarButtonSystemItem = UIBarButtonSystemItemCancel;
#if defined(__IPHONE_13_4)
if (@available(iOS 13.4, *)) {
self.pointerInteractionEnabled = YES;
}
#endif // defined(__IPHONE_13_4)
[super loadView];
}
@end
# 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("//build/config/ios/asset_catalog.gni")
import("//build/config/ios/rules.gni")
group("resources") {
deps = [ ":default_browser_illustration" ]
}
imageset("default_browser_illustration") {
sources = [
"default_browser_illustration.imageset/Contents.json",
"default_browser_illustration.imageset/default_browser_dark@2x.png",
"default_browser_illustration.imageset/default_browser_dark@3x.png",
"default_browser_illustration.imageset/default_browser_light@2x.png",
"default_browser_illustration.imageset/default_browser_light@3x.png",
]
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "default_browser_light@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "default_browser_dark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "default_browser_light@3x.png",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "default_browser_dark@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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