Add a Mac Word plugin Sequoia permissions warning banner (#4660)

Also refactor some banner rules.
This commit is contained in:
Adomas Venčkauskas 2024-09-03 10:17:28 +03:00 committed by Dan Stillman
parent 8fbed0b62b
commit 564b1766aa
5 changed files with 96 additions and 37 deletions

@ -1 +1 @@
Subproject commit de8ab22db748bef42f3730c20b9da1c0563de6c2
Subproject commit 31f5d8d145a231713cfb27e3477e774c29942c81

View file

@ -6125,6 +6125,43 @@ var ZoteroPane = new function()
}
};
/**
* Shows a Mac Word plugin installation warning (intended to be used with Sequoia and up)
* before the installer displays the "scary" OS prompt to access other application data.
* @returns {Promise<Object>} Object with either install, dismiss or remindLater set to true.
*/
this.showMacWordPluginInstallWarning = function () {
return new Promise((resolve) => {
const panel = document.querySelector('#mac-word-plugin-install-warning');
const action = panel.querySelector('.link');
const close = panel.querySelector('.close-link');
const remind = panel.querySelector('.remind-later-link');
const dontAskAgain = panel.querySelector('.dont-ask-again-link');
panel.removeAttribute('collapsed');
action.onclick = () => {
this.hideMacWordPluginInstallWarning();
resolve({ install: true });
};
close.onclick = () => {
this.hideMacWordPluginInstallWarning();
resolve({ dismiss: true });
};
remind.onclick = () => {
this.hideMacWordPluginInstallWarning();
resolve({ remindLater: true });
};
dontAskAgain.onclick = () => {
this.hideMacWordPluginInstallWarning();
resolve({ dontAskAgain: true });
};
});
};
this.hideMacWordPluginInstallWarning = function () {
document.querySelector('#mac-word-plugin-install-warning').setAttribute('collapsed', true);
};
this.showArchitectureWarning = async function () {
const remindInterval = 60 * 60 * 24 * 30;
const lastDisplayed = Zotero.Prefs.get('architecture.warning.lastDisplayed') ?? 0;

View file

@ -1081,8 +1081,8 @@
onkeyup="ZoteroPane_Local.handleKeyUp(event, this.id)"
onkeypress="ZoteroPane_Local.handleKeyPress(event)">
<vbox id="post-upgrade-container" collapsed="true" role="status">
<html:div id="post-upgrade-banner">
<vbox id="post-upgrade-container" class="banner-container" collapsed="true" role="status">
<html:div id="post-upgrade-banner" class="banner">
<html:div id="post-upgrade-centered">
<html:div
data-l10n-id="post-upgrade-message"
@ -1120,8 +1120,8 @@
</html:div>
</vbox>
<vbox id="sync-reminder-container" collapsed="true" role="status">
<html:div id="sync-reminder-banner">
<vbox id="sync-reminder-container" class="banner-container" collapsed="true" role="status">
<html:div id="sync-reminder-banner" class="banner">
<html:div id="sync-reminder-message" class="message"/>
<html:a id="sync-reminder-action" class="link"/>
<html:a id="sync-reminder-learn-more" class="link"/>
@ -1132,16 +1132,27 @@
</html:div>
</vbox>
<vbox id="retracted-items-container" collapsed="true" role="status">
<html:div id="retracted-items-banner">
<vbox id="mac-word-plugin-install-warning" class="banner-container" collapsed="true" role="status">
<html:div class="banner">
<html:div class="message" data-l10n-id="mac-word-plugin-install-message" />
<html:a class="link" data-l10n-id="mac-word-plugin-install-action" />
<html:div class="spacer" />
<label is="text-link" class="remind-later-link" data-l10n-id="general-remind-me-later" />
<label is="text-link" class="dont-ask-again-link" data-l10n-id="general-dont-ask-again" />
<label is="text-link" class="close-link">×</label>
</html:div>
</vbox>
<vbox id="retracted-items-container" class="banner-container" collapsed="true" role="status">
<html:div id="retracted-items-banner" class="banner">
<html:div id="retracted-items-message" class="message"/>
<label is="text-link" id="retracted-items-link"/>
<label is="text-link" id="retracted-items-close" class="close-link">×</label>
</html:div>
</vbox>
<vbox id="architecture-warning-container" collapsed="true" role="status">
<html:div id="architecture-warning-banner">
<vbox id="architecture-warning-container" class="banner-container" collapsed="true" role="status">
<html:div id="architecture-warning-banner" class="banner">
<html:div id="architecture-warning-message" class="message" data-l10n-id="architecture-win32-warning-message" />
<html:a id="architecture-warning-action" data-l10n-id="architecture-warning-action" class="link" />
<html:div class="spacer" />
@ -1149,6 +1160,7 @@
<label is="text-link" id="architecture-warning-close" class="close-link">×</label>
</html:div>
</vbox>
<hbox id="zotero-trees" flex="1">
<vbox id="zotero-collections-pane" zotero-persist="width">

View file

@ -8,6 +8,7 @@ return-or-enter =
general-remove = Remove
general-add = Add
general-remind-me-later = Remind Me Later
general-dont-ask-again = Don't Ask Again
general-choose-file = Choose File…
general-open-settings = Open Settings
general-help = Help
@ -674,3 +675,6 @@ post-upgrade-done =
text-action-paste-and-search =
.label = Paste and Search
mac-word-plugin-install-message = Zotero requires access to Word data to install the Word plugin.
mac-word-plugin-install-action = Install Word plugin

View file

@ -1,5 +1,5 @@
#post-upgrade-banner, #retracted-items-banner, #sync-reminder-banner, #architecture-warning-banner {
@include macOS-normalize-controls;
.banner-container > .banner {
@include macOS-normalize-controls;;
display: flex;
justify-content: center;
@ -12,6 +12,31 @@
color: inherit;
border: none;
margin: 0;
padding-inline: 0.5em;
}
label[is="text-link"].close-link {
text-decoration: none;
cursor: pointer;
font-size: 22px;
line-height: 26px;
margin-inline-end: -1.2em;
}
.message {
margin-inline-end: .8em;
}
.spacer {
flex: 1;
}
.link {
padding-inline: 0.5em;
&:active {
color: #4b4b4b;
}
}
}
@ -69,28 +94,12 @@
}
}
#retracted-items-banner, #sync-reminder-banner, #architecture-warning-banner {
#retracted-items-banner, #sync-reminder-banner, #architecture-warning-banner,
#mac-word-plugin-install-warning > .banner {
line-height: 2.2em;
font-size: 13.5px;
padding: 0 2em;
font-weight: 600;
.message {
margin-inline-end: .8em;
}
.spacer {
flex: 1;
}
.close-link {
text-decoration: none;
position: absolute;
cursor: pointer;
top: -2px;
inset-inline-end: 9px;
font-size: 22px;
}
}
#retracted-items-banner {
@ -106,18 +115,15 @@
}
}
#mac-word-plugin-install-warning {
background: #ffea50;
border-bottom: #a9a9a9 .5px solid;
}
#sync-reminder-banner {
background: rgb(255, 234, 80);
border-bottom: #a9a9a9 .5px solid;
color: black;
.link {
padding-inline: 0.5em;
&:active {
color: #4b4b4b;
}
}
}
#architecture-warning-container {