From f017bced359119b3426c9cd1ac095ffc394fafe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B5=A9=E8=BF=9C?= Date: Mon, 15 Jun 2020 17:25:55 +0800 Subject: [PATCH] alpha release build 0.2.0 --- package.json | 10 ++++++++-- src/components/settings/about.tsx | 3 ++- src/electron.ts | 4 +++- src/scripts/config-schema.ts | 1 + src/scripts/models/app.ts | 12 +++++++++--- src/scripts/settings.ts | 8 ++++++++ webpack.config.js | 3 +++ 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index a20c7d3..645ce84 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "fluent-reader", - "version": "0.1.0", + "version": "0.2.0", "description": "A simplistic, modern desktop RSS reader", "main": "./dist/electron.js", "scripts": { "build": "webpack --config ./webpack.config.js", "electron": "electron ./dist/electron.js", "start": "npm run build && npm run electron", - "package-win": "electron-builder -w --x64 && electron-builder -w --ia32 && electron-builder -w --arm64", + "package-win": "electron-builder -w --x64 && electron-builder -w --ia32 && electron-builder -w appx:arm64", "package-mac": "sudo electron-builder --mac" }, "keywords": [], @@ -36,6 +36,12 @@ "showNameOnTiles": true, "setBuildNumber": true }, + "nsis": { + "oneClick": false, + "perMachine": true, + "allowToChangeInstallationDirectory": true, + "deleteAppDataOnUninstall": true + }, "mac": { "target": [ "dmg" ] } diff --git a/src/components/settings/about.tsx b/src/components/settings/about.tsx index acb476e..79ab282 100644 --- a/src/components/settings/about.tsx +++ b/src/components/settings/about.tsx @@ -2,6 +2,7 @@ import * as React from "react" import intl = require("react-intl-universal") import { Stack, Link } from "@fluentui/react" import { openExternal } from "../../scripts/utils" +import { remote } from "electron" class AboutTab extends React.Component { render = () => ( @@ -9,7 +10,7 @@ class AboutTab extends React.Component {

Fluent Reader

- {intl.get("settings.version")} 0.1.0 + {intl.get("settings.version")} {remote.app.getVersion()}

Copyright © 2020 Haoyuan Liu. All rights reserved.

openExternal("https://github.com/yang991178/fluent-reader")}>{intl.get("settings.openSource")} diff --git a/src/electron.ts b/src/electron.ts index 563bcf7..510d0cf 100644 --- a/src/electron.ts +++ b/src/electron.ts @@ -1,10 +1,12 @@ import { app, ipcMain, BrowserWindow, Menu, nativeTheme } from "electron" import windowStateKeeper = require("electron-window-state") import Store = require("electron-store") +import performUpdate from "./scripts/update-scripts" let mainWindow: BrowserWindow let store = new Store() let restarting = false +performUpdate(store) nativeTheme.themeSource = store.get("theme", "system") function createWindow() { @@ -35,7 +37,7 @@ function createWindow() { mainWindow.on("ready-to-show", () => { mainWindow.show() mainWindow.focus() - mainWindow.webContents.openDevTools() + if (!app.isPackaged) mainWindow.webContents.openDevTools() }); // and load the index.html of the app. mainWindow.loadFile((app.isPackaged ? "dist/" : "") + "index.html") diff --git a/src/scripts/config-schema.ts b/src/scripts/config-schema.ts index 29ced55..935b2de 100644 --- a/src/scripts/config-schema.ts +++ b/src/scripts/config-schema.ts @@ -20,4 +20,5 @@ export type schemaTypes = { locale: string sourceGroups: SourceGroup[] fontSize: number + menuOn: boolean } diff --git a/src/scripts/models/app.ts b/src/scripts/models/app.ts index 9b2dfd2..3f286a8 100644 --- a/src/scripts/models/app.ts +++ b/src/scripts/models/app.ts @@ -5,7 +5,7 @@ import { ActionStatus, AppThunk, getWindowBreakpoint } from "../utils" import { INIT_FEEDS, FeedActionTypes, ALL, initFeeds } from "./feed" import { SourceGroupActionTypes, UPDATE_SOURCE_GROUP, ADD_SOURCE_TO_GROUP, DELETE_SOURCE_GROUP, REMOVE_SOURCE_FROM_GROUP, REORDER_SOURCE_GROUPS } from "./group" import { PageActionTypes, SELECT_PAGE, PageType, selectAllArticles } from "./page" -import { getCurrentLocale } from "../settings" +import { getCurrentLocale, setDefaultMenu, getDefaultMenu } from "../settings" import locales from "../i18n/_locales" import * as db from "../db" @@ -38,7 +38,7 @@ export class AppState { fetchingItems = false fetchingProgress = 0 fetchingTotal = 0 - menu = getWindowBreakpoint() + menu = getWindowBreakpoint() && getDefaultMenu() menuKey = ALL title = "" settings = { @@ -149,7 +149,13 @@ export function openGroupMenu(sids: number[], event: React.MouseEvent): ContextM } } -export const toggleMenu = () => ({ type: TOGGLE_MENU }) +export function toggleMenu(): AppThunk { + return (dispatch, getState) => { + dispatch({ type: TOGGLE_MENU }) + setDefaultMenu(getState().app.menu) + } +} + export const toggleLogMenu = () => ({ type: TOGGLE_LOGS }) export const toggleSettings = () => ({ type: TOGGLE_SETTINGS }) export const saveSettings = () => ({ type: SAVE_SETTINGS }) diff --git a/src/scripts/settings.ts b/src/scripts/settings.ts index 2015714..830d800 100644 --- a/src/scripts/settings.ts +++ b/src/scripts/settings.ts @@ -9,6 +9,14 @@ import intl = require("react-intl-universal") export const store = new Store() +const MENU_STORE_KEY = "menuOn" +export function getDefaultMenu() { + return store.get(MENU_STORE_KEY, false) +} +export function setDefaultMenu(state: boolean) { + store.set(MENU_STORE_KEY, state) +} + const PAC_STORE_KEY = "pac" const PAC_STATUS_KEY = "pacOn" export function getProxyStatus() { diff --git a/webpack.config.js b/webpack.config.js index b993195..4b00d3b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,6 +9,9 @@ module.exports = [ rules: [{ test: /\.ts$/, include: /src/, + resolve: { + extensions: ['.ts', '.js'] + }, use: [{ loader: 'ts-loader' }] }] },