Merge pull request #2509 from h3poteto/iss-574

refs #574 Add use marker settings
This commit is contained in:
AkiraFukushima 2021-06-11 23:16:46 +09:00 committed by GitHub
commit da59fb5633
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 8 deletions

View File

@ -16,7 +16,8 @@ const state = (): GeneralState => {
timeline: {
cw: false,
nsfw: false,
hideAllAttachments: false
hideAllAttachments: false,
useMarker: false
},
other: {
launch: false

View File

@ -12,7 +12,8 @@ describe('Preferences/General', () => {
timeline: {
cw: false,
nsfw: false,
hideAllAttachments: false
hideAllAttachments: false,
useMarker: false
},
other: {
launch: false

View File

@ -162,7 +162,9 @@
"description": "Customize view in your timelines.",
"cw": "Always ignore contents warnings",
"nsfw": "Always ignore NSFW of medias",
"hideAllAttachments": "Hide all medias"
"hideAllAttachments": "Hide all medias",
"useMarker": "Load timeline from the last reading position",
"useMarkerNotice": "This feature only supports home and notifications"
},
"other": {
"title": "Other options",

View File

@ -1147,6 +1147,16 @@ ipcMain.handle('update-spellchecker-languages', async (_: IpcMainInvokeEvent, la
})
// marker
ipcMain.handle('get-home-marker', async (_: IpcMainInvokeEvent, ownerID: string) => {
const marker = await markerRepo.get(ownerID, 'home')
return marker
})
ipcMain.handle('get-notifications-marker', async (_: IpcMainInvokeEvent, ownerID: string) => {
const marker = await markerRepo.get(ownerID, 'notifications')
return marker
})
ipcMain.handle('save-marker', async (_: IpcMainInvokeEvent, marker: LocalMarker) => {
if (marker.owner_id === null || marker.owner_id === undefined || marker.owner_id === '') {
return

View File

@ -23,7 +23,8 @@ const sound: Sound = {
const timeline: Timeline = {
cw: false,
nsfw: false,
hideAllAttachments: false
hideAllAttachments: false,
useMarker: false
}
const other: Other = {

View File

@ -11,7 +11,7 @@
<el-switch id="sound_toot" v-model="sound_toot" active-color="#13ce66"> </el-switch>
</el-form-item>
</el-form>
<el-form class="timeline section" label-potision="right" label-width="250px" size="samll">
<el-form class="timeline section" label-potision="right" label-width="302px" size="samll">
<h3>{{ $t('preferences.general.timeline.title') }}</h3>
<p class="description">{{ $t('preferences.general.timeline.description') }}</p>
<el-form-item for="cw" :label="$t('preferences.general.timeline.cw')">
@ -23,6 +23,12 @@
<el-form-item for="hideAllAttachments" :label="$t('preferences.general.timeline.hideAllAttachments')">
<el-switch id="hideAllAttachments" v-model="timeline_hide_attachments" active-color="#13ce66"> </el-switch>
</el-form-item>
<el-form-item for="useMarker" :label="$t('preferences.general.timeline.useMarker')">
<el-switch id="useMarker" v-model="timeline_use_marker" active-color="#13ce66"> </el-switch>
</el-form-item>
<p class="notice">
{{ $t('preferences.general.timeline.useMarkerNotice') }}
</p>
</el-form>
<el-form class="other section" label-position="right" label-width="250px" size="small" v-if="notDarwin">
<h3>{{ $t('preferences.general.other.title') }}</h3>
@ -96,6 +102,16 @@ export default {
})
}
},
timeline_use_marker: {
get() {
return this.$store.state.Preferences.General.general.timeline.useMarker
},
set(value) {
this.$store.dispatch('Preferences/General/updateTimeline', {
useMarker: value
})
}
},
other_launch: {
get() {
return this.$store.state.Preferences.General.general.other.launch

View File

@ -21,7 +21,8 @@ const state = (): GeneralState => ({
timeline: {
cw: false,
nsfw: false,
hideAllAttachments: false
hideAllAttachments: false,
useMarker: false
},
other: {
launch: false

View File

@ -1,5 +1,6 @@
export type Timeline = {
cw: boolean,
nsfw: boolean,
cw: boolean
nsfw: boolean
hideAllAttachments: boolean
useMarker: boolean
}