Add launch-on login option

See [#5244][0].

[0]: https://github.com/signalapp/Signal-Desktop/pull/5244
This commit is contained in:
Jacob Kiesel 2021-05-11 15:59:21 -05:00 committed by Evan Hahn
parent b41dab2704
commit 75d54e7737
10 changed files with 44 additions and 2 deletions

View File

@ -1383,7 +1383,7 @@
},
"spellCheckDescription": {
"message": "Enable spell check of text entered in message composition box",
"description": "Description of the media permission description"
"description": "Description of the spell check setting"
},
"spellCheckWillBeEnabled": {
"message": "Spell check will be enabled the next time Signal starts.",
@ -1393,6 +1393,10 @@
"message": "Spell check will be disabled the next time Signal starts.",
"description": "Shown when the user disables spellcheck to indicate that they must restart Signal."
},
"autoLaunchDescription": {
"message": "Open at computer login",
"description": "Description for the automatic launch setting"
},
"clearDataHeader": {
"message": "Clear Data",
"description": "Header in the settings dialog for the section dealing with data deletion"

View File

@ -36,6 +36,7 @@ const getInitialData = async () => ({
countMutedConversations: await window.getCountMutedConversations(),
spellCheck: await window.getSpellCheck(),
autoLaunch: await window.getAutoLaunch(),
incomingCallNotification: await window.getIncomingCallNotification(),
callRingtoneNotification: await window.getCallRingtoneNotification(),

View File

@ -152,6 +152,12 @@
window.setSpellCheck(val);
},
});
new CheckboxView({
el: this.$('.auto-launch-setting'),
name: 'auto-launch-setting',
value: window.initialData.autoLaunch,
setFn: window.setAutoLaunch,
});
if (Settings.isHideMenuBarSupported()) {
new CheckboxView({
el: this.$('.menu-bar-setting'),
@ -259,6 +265,7 @@
spellCheckDirtyText: appStartSpellCheck
? i18n('spellCheckWillBeDisabled')
: i18n('spellCheckWillBeEnabled'),
autoLaunchDescription: i18n('autoLaunchDescription'),
};
},
onClose() {

View File

@ -1554,6 +1554,9 @@ installSettingsSetter('badge-count-muted-conversations');
installSettingsGetter('spell-check');
installSettingsSetter('spell-check', true);
installSettingsGetter('auto-launch');
installSettingsSetter('auto-launch');
installSettingsGetter('always-relay-calls');
installSettingsSetter('always-relay-calls');
installSettingsGetter('call-ringtone-notification');

View File

@ -68,6 +68,10 @@ try {
window.getServerPublicParams = () => config.serverPublicParams;
window.getSfuUrl = () => config.sfuUrl;
window.isBehindProxy = () => Boolean(config.proxyUrl);
window.getAutoLaunch = () => app.getLoginItemSettings().openAtLogin;
window.setAutoLaunch = value => {
app.setLoginItemSettings({ openAtLogin: Boolean(value) });
};
function setSystemTheme() {
window.systemTheme = nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
@ -251,6 +255,9 @@ try {
installGetter('spell-check', 'getSpellCheck');
installSetter('spell-check', 'setSpellCheck');
installGetter('auto-launch', 'getAutoLaunch');
installSetter('auto-launch', 'setAutoLaunch');
installGetter('always-relay-calls', 'getAlwaysRelayCalls');
installSetter('always-relay-calls', 'setAlwaysRelayCalls');

View File

@ -118,6 +118,10 @@
{{ spellCheckDirtyText }}
</p>
</div>
<div class='auto-launch-setting'>
<input type='checkbox' name='auto-launch-setting' id='auto-launch-setting' />
<label for='auto-launch-setting'>{{ autoLaunchDescription }}</label>
</div>
<hr>
<div class='calling-setting'>
<h3>{{ calling }}</h3>

View File

@ -64,6 +64,9 @@ window.setHideMenuBar = makeSetter('hide-menu-bar');
window.getSpellCheck = makeGetter('spell-check');
window.setSpellCheck = makeSetter('spell-check');
window.getAutoLaunch = makeGetter('auto-launch');
window.setAutoLaunch = makeSetter('auto-launch');
window.getAlwaysRelayCalls = makeGetter('always-relay-calls');
window.setAlwaysRelayCalls = makeSetter('always-relay-calls');

View File

@ -431,6 +431,9 @@ export async function startApp(): Promise<void> {
setAlwaysRelayCalls: (value: boolean) =>
window.storage.put('always-relay-calls', value),
getAutoLaunch: () => window.getAutoLaunch(),
setAutoLaunch: (value: boolean) => window.setAutoLaunch(value),
// eslint-disable-next-line eqeqeq
isPrimary: () => window.textsecure.storage.user.getDeviceId() == '1',
getSyncRequest: () =>

View File

@ -1225,6 +1225,14 @@
"updated": "2021-02-26T18:44:56.450Z",
"reasonDetail": "Static selector, read-only access"
},
{
"rule": "jQuery-$(",
"path": "js/views/settings_view.js",
"line": " el: this.$('.auto-launch-setting'),",
"reasonCategory": "usageTrusted",
"updated": "2021-05-11T20:38:03.542Z",
"reasonDetail": "Protected from arbitrary input"
},
{
"rule": "jQuery-append(",
"path": "js/views/settings_view.js",
@ -14233,4 +14241,4 @@
"updated": "2021-03-18T21:41:28.361Z",
"reasonDetail": "A generic hook. Typically not to be used with non-DOM values."
}
]
]

2
ts/window.d.ts vendored
View File

@ -133,6 +133,8 @@ declare global {
dataURLToBlobSync: any;
loadImage: any;
isBehindProxy: () => boolean;
getAutoLaunch: () => boolean;
setAutoLaunch: (value: boolean) => void;
PQueue: typeof PQueue;
PQueueType: PQueue;