Commit 994823a0 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] Add the credits page

This CL:

* Makes the build target generate the credits page for the app.
* Adds the credits page to the help view.

Bug: 745233
Change-Id: Id612c7140fbdcc9433854d26f8c33509c28ac3c2
Reviewed-on: https://chromium-review.googlesource.com/575041Reviewed-by: default avatarScott Nichols <nicholss@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487620}
parent 3eaa9967
......@@ -26,6 +26,8 @@ source_set("common_source_set") {
"first_launch_view_presenter.mm",
"help_and_feedback.h",
"help_and_feedback.mm",
"help_view_controller.h",
"help_view_controller.mm",
"host_collection_header_view.h",
"host_collection_header_view.mm",
"host_collection_view_cell.h",
......
......@@ -15,6 +15,7 @@
#import "remoting/ios/app/app_view_controller.h"
#import "remoting/ios/app/first_launch_view_presenter.h"
#import "remoting/ios/app/help_and_feedback.h"
#import "remoting/ios/app/help_view_controller.h"
#import "remoting/ios/app/remoting_view_controller.h"
#import "remoting/ios/app/user_status_presenter.h"
#import "remoting/ios/app/web_view_controller.h"
......@@ -26,9 +27,6 @@
}
@end
// TODO(nicholss): These urls should come from a global config.
static NSString* const kHelpCenterUrl =
@"https://support.google.com/chrome/answer/1649523?co=GENIE.Platform%3DiOS";
// TODO(nicholss): There is no FAQ page at the moment.
static NSString* const kFAQsUrl =
@"https://support.google.com/chrome/answer/1649523?co=GENIE.Platform%3DiOS";
......@@ -123,13 +121,13 @@ static NSString* const kFAQsUrl =
}
- (void)navigateToHelpCenter:(UINavigationController*)navigationController {
[navigationController pushViewController:[self createHelpViewController]
[navigationController pushViewController:[[HelpViewController alloc] init]
animated:YES];
}
- (void)presentHelpCenter {
UINavigationController* navController = [[UINavigationController alloc]
initWithRootViewController:[self createHelpViewController]];
initWithRootViewController:[[HelpViewController alloc] init]];
[AppDelegate.topPresentingVC presentViewController:navController
animated:YES
completion:nil];
......@@ -152,22 +150,6 @@ static NSString* const kFAQsUrl =
#pragma mark - Private
- (WebViewController*)createHelpViewController {
WebViewController* viewController =
[[WebViewController alloc] initWithUrl:kHelpCenterUrl
title:@"Help Center"];
viewController.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:@"Credits"
style:UIBarButtonItemStylePlain
target:self
action:@selector(onTapCredits:)];
return viewController;
}
- (void)onTapCredits:(id)button {
NSLog(@"tap credits");
}
+ (UIViewController*)topPresentingVC {
UIViewController* topController =
UIApplication.sharedApplication.keyWindow.rootViewController;
......
// Copyright 2017 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 REMOTING_IOS_APP_HELP_VIEW_CONTROLLER_H_
#define REMOTING_IOS_APP_HELP_VIEW_CONTROLLER_H_
#import <UIKit/UIKit.h>
#import "remoting/ios/app/web_view_controller.h"
// A VC that shows the help center.
@interface HelpViewController : WebViewController
- (instancetype)init;
@end
#endif // REMOTING_IOS_APP_HELP_VIEW_CONTROLLER_H_
// Copyright 2017 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.
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
#import "remoting/ios/app/help_view_controller.h"
// TODO(nicholss): These urls should come from a global config.
static NSString* const kHelpCenterUrl =
@"https://support.google.com/chrome/answer/1649523?co=GENIE.Platform%3DiOS";
static NSString* const kCreditsUrlString =
[[NSBundle mainBundle] URLForResource:@"credits" withExtension:@"html"]
.absoluteString;
@implementation HelpViewController
- (instancetype)init {
if (self = [super initWithUrl:kHelpCenterUrl title:@"Help Center"]) {
self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:@"Credits"
style:UIBarButtonItemStylePlain
target:self
action:@selector(onTapCredits:)];
}
return self;
}
#pragma mark - Private
- (void)onTapCredits:(id)button {
WebViewController* creditsVC =
[[WebViewController alloc] initWithUrl:kCreditsUrlString
title:@"Credits"];
[self.navigationController pushViewController:creditsVC animated:YES];
}
@end
......@@ -7,8 +7,9 @@ import("//build/config/ios/rules.gni")
import("//build/mac/tweak_info_plist.gni")
import("//build/util/process_version.gni")
import("//remoting/build/config/remoting_build.gni")
import("//remoting/credits/credits.gni")
remoting_ios_app_source_dir = get_path_info("./", "abspath")
_remoting_ios_app_source_dir = get_path_info("./", "abspath")
# Arguments
#
......@@ -28,24 +29,47 @@ remoting_ios_app_source_dir = get_path_info("./", "abspath")
# (optional) string, the bundle_id. If this is not set, it will come from
# either branding_Chromium or branding_Chrome
template("ios_remoting_app_tmpl") {
info_plist_target_name = "${target_name}_tweak_info_plist"
tweak_info_plist(info_plist_target_name) {
_app_target_name = target_name
_info_plist_target_name = "${target_name}_tweak_info_plist"
tweak_info_plist(_info_plist_target_name) {
info_plist = invoker.info_plist_path
args = [ "--platform=ios" ]
}
launchscreen_storyboard_target_name = "${target_name}_launchscreen_storyboard"
bundle_data_ib_file(launchscreen_storyboard_target_name) {
_launchscreen_storyboard_target_name = "${target_name}_launchscreen_storyboard"
bundle_data_ib_file(_launchscreen_storyboard_target_name) {
source = rebase_path("resources/LaunchScreen.storyboard",
".",
remoting_ios_app_source_dir)
_remoting_ios_app_source_dir)
}
# Compiles the credits files into the gen directory.
_credits_resources_target_name = "${target_name}_credits_resources"
remoting_credits(_credits_resources_target_name) {
app_target_gen_dir = get_label_info(":$_app_target_name", "target_gen_dir")
credits_gen_dir =
"${app_target_gen_dir}/${_app_target_name}_credits_resources"
target_dir = get_path_info("./", "abspath")
gn_target = "${target_dir}:${_app_target_name}"
}
# Adds the compiled credits files into the bundle.
_credits_bundle_target_name = "${target_name}_credits_bundle"
bundle_data(_credits_bundle_target_name) {
sources = get_target_outputs(":$_credits_resources_target_name")
public_deps = [
":$_credits_resources_target_name",
]
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
}
ios_app_bundle(target_name) {
output_name = invoker.output_name
entitlements_path = invoker.entitlements_path
info_plist_target = ":$info_plist_target_name"
info_plist_target = ":$_info_plist_target_name"
if (defined(invoker.bundle_id)) {
bundle_id = invoker.bundle_id
......@@ -79,6 +103,11 @@ template("ios_remoting_app_tmpl") {
deps = invoker.deps
bundle_deps = [ ":$launchscreen_storyboard_target_name" ]
bundle_deps = [
":$_launchscreen_storyboard_target_name",
":$_credits_bundle_target_name",
]
assert_no_deps = [ "//third_party/ffmpeg:*" ]
}
}
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