mirror of
https://github.com/felvesthe/Note-Locker.git
synced 2026-07-22 05:44:06 +00:00
Add setting for note lock/unlock notifications
Signed-off-by: Felvesthe <23108389+Felvesthe@users.noreply.github.com>
This commit is contained in:
parent
09a6673606
commit
688142f84e
3 changed files with 19 additions and 5 deletions
10
src/main.ts
10
src/main.ts
|
|
@ -147,11 +147,13 @@ export default class NoteLockerPlugin extends Plugin {
|
|||
return;
|
||||
}
|
||||
|
||||
const fileName = file instanceof TFile ? file.basename :
|
||||
notePath.split('/').pop()?.replace(/\..+$/, '') || notePath;
|
||||
const displayName = this.truncateFileName(fileName);
|
||||
if (this.settings.showNotifications) {
|
||||
const fileName = file instanceof TFile ? file.basename :
|
||||
notePath.split('/').pop()?.replace(/\..+$/, '') || notePath;
|
||||
const displayName = this.truncateFileName(fileName);
|
||||
|
||||
new Notice(`${isLocked ? '🔓 Unlocked' : '🔒 Locked'}: ${displayName}`);
|
||||
new Notice(`${isLocked ? '🔓 Unlocked' : '🔒 Locked'}: ${displayName}`);
|
||||
}
|
||||
|
||||
this.updateAllNoteInstances(notePath);
|
||||
this.statusBarUI.updateStatusBarButton();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ export interface NoteLockerSettings {
|
|||
desktopNotificationMaxLength: number;
|
||||
showFileExplorerIcons: boolean;
|
||||
showStatusBarButton: boolean;
|
||||
showNotifications: boolean;
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: NoteLockerSettings = {
|
||||
|
|
@ -11,5 +12,6 @@ export const DEFAULT_SETTINGS: NoteLockerSettings = {
|
|||
mobileNotificationMaxLength: 18,
|
||||
desktopNotificationMaxLength: 22,
|
||||
showFileExplorerIcons: true,
|
||||
showStatusBarButton: true
|
||||
showStatusBarButton: true,
|
||||
showNotifications: true
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,6 +31,16 @@ export class NoteLockerSettingTab extends PluginSettingTab {
|
|||
await this.plugin.updateStatusBarVisibility(value);
|
||||
}));
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Show notifications')
|
||||
.setDesc('Show notifications when locking or unlocking notes')
|
||||
.addToggle(toggle => toggle
|
||||
.setValue(this.plugin.settings.showNotifications)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.showNotifications = value;
|
||||
await this.plugin.saveSettings();
|
||||
}));
|
||||
|
||||
const mobileNotificationSetting = new Setting(containerEl)
|
||||
.setName('Mobile notification max length')
|
||||
.setDesc('Maximum length of file names in notifications on mobile devices')
|
||||
|
|
|
|||
Loading…
Reference in a new issue