Skip to content
Snippets Groups Projects
Commit b2ab172a authored by Ewann Pelle's avatar Ewann Pelle Committed by Chromium LUCI CQ
Browse files

[iOS][SK] Adds errors alert util

Adds an util that contains alerts for  shareKit flows.

Bug: 375587446
Change-Id: I64b17a0fdf42c9d7e759ca60c4cad58fbdd210ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5993850


Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1378936}
parent f58db435
No related branches found
No related tags found
No related merge requests found
# Copyright 2024 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("ui") {
sources = [
"share_kit_errors_alert_util.h",
"share_kit_errors_alert_util.mm",
]
deps = [
"//base",
"//ios/chrome/app/strings",
"//ui/base",
]
}
ewannpv@chromium.org
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_SHARE_KIT_UI_SHARE_KIT_ERRORS_ALERT_UTIL_H_
#define IOS_CHROME_BROWSER_SHARE_KIT_UI_SHARE_KIT_ERRORS_ALERT_UTIL_H_
#import <UIKit/UIKit.h>
namespace share_kit {
// Returns the alert displayed when the shared link is invalid.
UIAlertController* InvalidLinkAlert();
} // namespace share_kit
#endif // IOS_CHROME_BROWSER_SHARE_KIT_UI_SHARE_KIT_ERRORS_ALERT_UTIL_H_
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/share_kit/ui/share_kit_errors_alert_util.h"
#import "base/strings/sys_string_conversions.h"
#import "ios/chrome/grit/ios_strings.h"
#import "ui/base/l10n/l10n_util.h"
namespace share_kit {
namespace {
// Returns an UIAlertController for the given parameters.
UIAlertController* ConfigureAlertController(
int title,
int message,
int action_title,
void (^action_handler)(UIAlertAction*)) {
UIAlertController* alert = [UIAlertController
alertControllerWithTitle:l10n_util::GetNSString(title)
message:l10n_util::GetNSString(message)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* action =
[UIAlertAction actionWithTitle:l10n_util::GetNSString(action_title)
style:UIAlertActionStyleDefault
handler:action_handler];
[alert addAction:action];
return alert;
}
} // namespace
UIAlertController* InvalidLinkAlert() {
return ConfigureAlertController(
IDS_IOS_SHARE_KIT_JOIN_ALERT_EXPIRED_TITLE,
IDS_IOS_SHARE_KIT_JOIN_ALERT_EXPIRED_MESSAGE,
IDS_IOS_SHARE_KIT_JOIN_ALERT_EXPIRED_ACTION_TITLE,
/*action_handler*/ nil);
}
} // namespace share_kit
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment