Skip to content

Commit

Permalink
Merge pull request #162 from TankNee/rebuild/fix
Browse files Browse the repository at this point in the history
2.2.0 Float Search Bar and Auto Update Checking as launching
  • Loading branch information
TankNee authored Sep 3, 2021
2 parents 9c7bfa9 + 722f2f8 commit 1c81aef
Show file tree
Hide file tree
Showing 36 changed files with 22,753 additions and 134 deletions.
22,115 changes: 22,082 additions & 33 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cn.memocast.app",
"version": "2.1.9",
"version": "2.2.0",
"description": "An Awesome WizNote Desktop Application",
"productName": "Memocast",
"author": "tanknee <[email protected]>",
Expand Down
Binary file removed screenshot/image-20200925170200202.png
Binary file not shown.
Binary file removed screenshot/image-20200925170301170.png
Binary file not shown.
Binary file removed screenshot/image-20200925170327136.png
Binary file not shown.
Binary file removed screenshot/image-20201011103144579.png
Binary file not shown.
6 changes: 5 additions & 1 deletion src-electron/main-process/assets/css/Default-Dark.dark.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:root {
--backgroundColor: #35373e;
--backgroundColor: rgba(53, 55, 62, .83);
--editorAreaWidth: 90%;
--activeItemBgColor: rgb(41, 42, 44);
/*editor*/
Expand Down Expand Up @@ -139,6 +139,10 @@ SOFTWARE.
background: transparent;
}

.q-drawer {
background: rgba(66, 67, 74, .83);
}

code[class*="language-"],
pre.ag-paragraph {
color: #ABB2BF;
Expand Down
6 changes: 5 additions & 1 deletion src-electron/main-process/assets/css/Default-Light.light.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:root {
--titleBarHeight: 32px;
--editorAreaWidth: 90%;
--backgroundColor: #ffffff;
--backgroundColor: rgba(255, 255, 255, .7);
--activeItemBgColor: rgb(204, 207, 214);
/*Theme color cluster*/
--themeColor: rgba(25, 118, 210, 1);
Expand Down Expand Up @@ -67,6 +67,10 @@
background: transparent;
}

.q-drawer {
background: rgba(243, 243, 243, .7);
}

code[class*="language-"],
pre.ag-paragraph {
color: black;
Expand Down
1 change: 1 addition & 0 deletions src-electron/main-process/electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function createWindow () {
height: mainWindowState.height < 400 ? 400 : mainWindowState.height,
useContentSize: true,
// transparent: true,
vibrancy: ThemeManager.colorMode, // 'light', 'medium-light' etc
webPreferences: {
// Change from /quasar.conf.js > electron > nodeIntegration;
// More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration
Expand Down
1 change: 1 addition & 0 deletions src-electron/main-process/i18n/src/en-us/menu/note.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
note: 'Note',
searchNote: 'Search Note',
save: 'Save',
export: 'Export'
}
1 change: 1 addition & 0 deletions src-electron/main-process/i18n/src/zh-cn/menu/note.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
note: '笔记',
searchNote: '搜索笔记',
save: '保存',
export: '导出'
}
3 changes: 2 additions & 1 deletion src-electron/main-process/keyboard/shortcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default class KeyBindings {
['view.lock-mode', 'CmdOrCtrl+Shift+L'],
['view.devtool', 'CmdOrCtrl+Shift+P'],
// Note Shortcut
['note.save', 'CmdOrCtrl+S']
['note.save', 'CmdOrCtrl+S'],
['note.search-note', 'CmdOrCtrl+Shift+F']
])
}

Expand Down
5 changes: 4 additions & 1 deletion src-electron/main-process/menu/actions/memocast.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { autoUpdater } from 'electron-updater'
import { ipcMain, BrowserWindow } from 'electron'

let runningUpdate = false
let win = null
Expand Down Expand Up @@ -40,6 +39,9 @@ autoUpdater.on('update-downloaded', (info) => {
// not just force close the application.

if (win) {
win.setProgressBar(1.0, {
mode: 'none'
})
win.webContents.send(
'updater-update-downloaded',
info
Expand All @@ -50,6 +52,7 @@ autoUpdater.on('update-downloaded', (info) => {

autoUpdater.on('download-progress', (progress) => {
if (win) {
win.setProgressBar(progress.percent / 100)
win.webContents.send(
'updater-update-downloading',
progress
Expand Down
7 changes: 7 additions & 0 deletions src-electron/main-process/menu/templates/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export default function (keybindings) {
click (menuItem, browserWindow) {
actions.note(browserWindow, 'save')
}
}, {
id: 'searchNote',
label: i18n.t('searchNote'),
accelerator: keybindings.getAccelerator('note.search-note'),
click (menuItem, browserWindow) {
actions.note(browserWindow, 'searchNote')
}
}, {
id: 'exportNote',
label: i18n.t('export'),
Expand Down
3 changes: 2 additions & 1 deletion src-electron/main-process/utlis/resource-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const ClientStorage = new Store({

console.log = log.log
console.error = log.error
log.transports.file.resolvePath = () => path.join(app.getPath('appData'), 'logs/main.log')
log.transports.file.resolvePath = () => path.join(app.getPath('userData'), 'logs', new Date().getFullYear().toString(), (new Date().getMonth() + 1).toString(), 'main.log')

async function resourceProtocolHandler (request, callback) {
// eslint-disable-next-line node/no-deprecated-api
Expand All @@ -32,6 +32,7 @@ async function resourceProtocolHandler (request, callback) {
if (!isResourceExist(kbGuid, docGuid, resName)) {
const resources = ClientStorage.get('currentResources') || []
const resource = resources.find(r => r.name === resName)
if (!resource) throw new Error('Resource Not Found')
resourcePath = await cacheNoteImage(resource.url, kbGuid, docGuid, resName)
} else {
resourcePath = path.join(getTempNoteDir(kbGuid, docGuid, 'appData'), resName)
Expand Down
9 changes: 8 additions & 1 deletion src-electron/main-process/utlis/theme-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Store from 'electron-store'
import { app, shell } from 'electron'
import { app, shell, BrowserWindow } from 'electron'
import path from 'path'
import fs from 'fs'
import _ from 'lodash'
Expand All @@ -14,6 +14,7 @@ const ClientStorage = new Store({
class ThemeManager {
themePath
themes = []
currentTheme = {}
constructor () {
this.themePath = path.join(app.getPath('userData'), 'themes')
console.log(this.themePath)
Expand Down Expand Up @@ -62,8 +63,14 @@ class ThemeManager {
}
}

get colorMode () {
return this.currentTheme.dark ? 'dark' : 'light'
}

loadThemeHandler (event, { name }) {
const theme = this.themes.find(t => t.name === name)
this.currentTheme = theme
BrowserWindow.getAllWindows().forEach(win => win.setVibrancy(this.colorMode))
return fs.readFileSync(path.join(this.themePath, theme.fileName)).toString('utf-8')
}

Expand Down
15 changes: 14 additions & 1 deletion src/ApiHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import bus from 'components/bus'
import events from 'src/constants/events'
import { i18n } from '../src/boot/i18n'
import debugLogger from './utils/debugLogger'
import { quitAndUpdate } from './ApiInvoker'

/**
* 在本地注册对应的事件句柄,用于解决对应的事件
Expand Down Expand Up @@ -93,7 +94,7 @@ export default {
}).catch(err => throw err)

handleApi('updater-update-not-available', (event, info) => {
debugLogger.Log(info)
debugLogger.Log('Update Not available', info)
bus.$emit(events.UPDATE_EVENTS.updateNotAvailable, info)
}).catch(err => throw err)

Expand All @@ -104,6 +105,18 @@ export default {

handleApi('updater-update-downloaded', (event, info) => {
debugLogger.Log(info)
Notify.create({
color: 'positive',
icon: 'check',
message: i18n.t('downloadSuccessfully'),
actions: [{
icon: 'play_for_work',
color: 'white',
handler: () => {
quitAndUpdate()
}
}]
})
bus.$emit(events.UPDATE_EVENTS.updateDownloaded)
}).catch(err => throw err)

Expand Down
4 changes: 3 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ApiHandler from 'src/ApiHandler'
import { createNamespacedHelpers } from 'vuex'
import bus from './components/bus'
import events from './constants/events'
import { checkUpdate } from './ApiInvoker'
const { RegisterErrorHandler } = ErrorHandler
const { RegisterScheduleJobs } = ScheduleHandler
Expand All @@ -34,9 +35,10 @@ export default {
RegisterErrorHandler()
RegisterScheduleJobs(this)
RegisterApiHandler()
bus.$on(events.RELOGIN, this.reLogin)
checkUpdate()
this.initClientStore().then()
this.initServerStore().then()
bus.$on(events.RELOGIN, this.reLogin)
this.setupAutoSaveInterval(this.autoSaveGap)
},
methods: {
Expand Down
69 changes: 69 additions & 0 deletions src/assets/loading-background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 13 additions & 39 deletions src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,16 @@
>
<img :src="avatarUrl ? avatarUrl : defaultAvatar" />
</q-avatar>
<q-input
dark
dense
borderless
v-model="searchText"
input-class="text-right text-grey"
class="q-ml-md q-electron-drag--exception search-input"
ref="searchInput"
style="width: 100px"
spellcheck="false"

<q-avatar
size="36px"
class="cursor-pointer q-electron-drag--exception"
:title="$t('search')"
@keydown.enter="searchNoteHandler"
v-ripple
@click="() => $refs.searchDialog.toggle()"
>
<template v-slot:append>
<q-icon
class="text-grey cursor-pointer"
size="19px"
v-if="searchText === ''"
name="search"
@click="$refs.searchInput.focus()"
/>
<q-icon
size="19px"
v-else
name="clear"
class="cursor-pointer text-grey"
@click="clearInputHandler"
/>
</template>
</q-input>
<q-icon style="font-size: 1.1em;" name="pageview" />
</q-avatar>
<q-space v-if="!$q.platform.is.mac" />
<div
v-if="!$q.platform.is.mac && dataLoaded"
Expand Down Expand Up @@ -146,6 +126,7 @@
</div>
<LoginDialog ref="loginDialog" />
<SettingsDialog ref="settingsDialog" />
<SearchDialog ref='searchDialog' />
<TagDialog ref="tagDialog" />
<SideDrawer ref="sideDrawer" :type="drawerType" />
</q-bar>
Expand All @@ -161,6 +142,7 @@ import defaultAvatarBase64 from 'src/assets/default-avatar'
import TagDialog from 'components/ui/dialog/TagDialog'
import bus from 'components/bus'
import events from 'src/constants/events'
import SearchDialog from 'components/ui/dialog/SearchDialog'
const {
mapState: mapServerState,
mapGetters: mapServerGetters,
Expand Down Expand Up @@ -217,10 +199,9 @@ export default {
return this.tagsOfCurrentNote.map(t => t.name)
}
},
components: { TagDialog, SideDrawer, SettingsDialog, LoginDialog },
components: { SearchDialog, TagDialog, SideDrawer, SettingsDialog, LoginDialog },
data () {
return {
searchText: '',
drawerType: 'category'
}
},
Expand Down Expand Up @@ -262,34 +243,27 @@ export default {
})
}
},
searchNoteHandler: function () {
if (helper.isNullOrEmpty(this.searchText)) return
this.searchNote(this.searchText)
},
switchViewHandler: function () {
this.toggleChanged({
key: 'noteListVisible',
value: !this.noteListVisible
})
this.$refs.sideDrawer.hide()
},
clearInputHandler: function () {
this.searchText = ''
this.getCategoryNotes({ category: this.currentCategory })
},
macDoubleClickHandler: function () {
if (this.$q.platform.is.mac) {
this.maximize()
}
},
...mapServerActions(['logout', 'searchNote', 'getCategoryNotes']),
...mapServerActions(['logout', 'getCategoryNotes']),
...mapClientActions(['toggleChanged'])
},
mounted () {
if (!this.autoLogin && !this.isLogin) {
this.$refs.loginDialog.toggle()
}
bus.$on(events.VIEW_SHORTCUT_CALL.switchView, this.switchViewHandler)
bus.$on(events.NOTE_SHORTCUT_CALL.searchNote, () => this.$refs.searchDialog.toggle())
},
watch: {
isLogin: function (currentData) {
Expand Down
Loading

0 comments on commit 1c81aef

Please sign in to comment.