зеркало из https://github.com/mozilla/gecko-dev.git
Bug 516362 p2. Add a localized helper to notify the user if installation fails. r=mstange,zbraniecki
Depends on D122476 Differential Revision: https://phabricator.services.mozilla.com/D122685
This commit is contained in:
Родитель
f6ffe2bd7b
Коммит
103c8ac225
|
@ -11,3 +11,8 @@ prompt-to-install-title = Finish installing { -brand-short-name }?
|
|||
prompt-to-install-message = Complete this one-step installation to help keep { -brand-short-name } up to date and prevent data loss. { -brand-short-name } will be added to your Applications folder and Dock.
|
||||
prompt-to-install-yes-button = Install
|
||||
prompt-to-install-no-button = Don’t Install
|
||||
|
||||
## Strings for a dialog that opens if the installation failed.
|
||||
|
||||
install-failed-title = { -brand-short-name } installation failed.
|
||||
install-failed-message = { -brand-short-name } failed to install but will continue to run.
|
||||
|
|
|
@ -95,6 +95,42 @@ static bool AskUserIfWeShouldInstall() {
|
|||
NS_OBJC_END_TRY_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
static void ShowInstallFailedDialog() {
|
||||
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
|
||||
|
||||
// Try to get the localized strings:
|
||||
nsTArray<nsCString> resIds = {
|
||||
"branding/brand.ftl"_ns,
|
||||
"toolkit/global/run-from-dmg.ftl"_ns,
|
||||
};
|
||||
RefPtr<intl::Localization> l10n = intl::Localization::Create(resIds, true);
|
||||
|
||||
ErrorResult rv;
|
||||
nsAutoCString mozTitle, mozMessage;
|
||||
l10n->FormatValueSync("install-failed-title"_ns, {}, mozTitle, rv);
|
||||
if (rv.Failed()) {
|
||||
return;
|
||||
}
|
||||
l10n->FormatValueSync("install-failed-message"_ns, {}, mozMessage, rv);
|
||||
if (rv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString* title = [NSString stringWithUTF8String:reinterpret_cast<const char*>(mozTitle.get())];
|
||||
NSString* message =
|
||||
[NSString stringWithUTF8String:reinterpret_cast<const char*>(mozMessage.get())];
|
||||
|
||||
NSAlert* alert = [[[NSAlert alloc] init] autorelease];
|
||||
|
||||
[alert setAlertStyle:NSAlertStyleWarning];
|
||||
[alert setMessageText:title];
|
||||
[alert setInformativeText:message];
|
||||
|
||||
[alert runModal];
|
||||
|
||||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||
}
|
||||
|
||||
bool IsAppRunningFromDmg() {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче