From 2e242431ecee4cad3513931bcecec7045cedccab Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Wed, 9 May 2018 01:15:31 +0900 Subject: [PATCH 1/3] fixes #287 Add asar unpacked resource for sounds in electron packager --- appStore.sh | 7 ++++++- package.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/appStore.sh b/appStore.sh index 1f0cbdb1..de07d0d4 100755 --- a/appStore.sh +++ b/appStore.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/zsh -f # Name of your app. APP="Whalebird for Mastodon" @@ -16,6 +16,11 @@ LOGINHELPER_PLIST="./plist/loginhelper.plist" FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks" +# At first, rename app.asar.unpacked directory. +# Because electron-builder does not store app.asar.unpacked directory. +# I want to store unpacked files at the same directory as electron-builder. +mv $APP_PATH/Contents/Resources/app.asar.unpacked/* $APP_PATH/Contents/Resources/ + codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib" codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libnode.dylib" diff --git a/package.json b/package.json index 817ee70e..aa25787d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build:mac": "node .electron-vue/build.js && electron-builder --mac --x64", "build:linux": "node .electron-vue/build.js && electron-builder --linux --x64", "build:windows": "node .electron-vue/build.js && electron-builder --win --x64", - "build:mas": "npm run pack && electron-packager ./ 'Whalebird for Mastodon' --platform=mas --arch=x64 --electron-version=1.8.3 --asar --out=packages --ignore='^/src' --ignore='^/test' --ignore='^/.electron-vue' --ignore='^/.envrc' --ignore='^/packages' --ignore='^/build' --ignore='^/plist' --ignore='^/static' --ignore='^/whalebird.db' --ignore='^/screenshot.png' --prune=true --icon=./build/icons/icon.icns --overwrite --app-bundle-id=org.whalebird.desktop --app-version=$npm_package_config_appVersion --build-version=$npm_package_config_buildVersion --extend-info='./plist/team.plist' --osx-sign", + "build:mas": "npm run pack && electron-packager ./ 'Whalebird for Mastodon' --platform=mas --arch=x64 --electron-version=1.8.3 --asar.unpackDir='build/sounds' --out=packages --ignore='^/src' --ignore='^/test' --ignore='^/.electron-vue' --ignore='^/.envrc' --ignore='^/packages' --ignore='^/plist' --ignore='^/static' --ignore='^/whalebird.db' --ignore='^/screenshot.png' --prune=true --icon=./build/icons/icon.icns --overwrite --app-bundle-id=org.whalebird.desktop --app-version=$npm_package_config_appVersion --build-version=$npm_package_config_buildVersion --extend-info='./plist/team.plist' --osx-sign --app-category-type=public.app-category.social-networking", "dev": "node .electron-vue/dev-runner.js", "e2e": "npm run pack && mocha test/e2e", "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test", From 604f1a27238288b704f68efac24143fc9531c060 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Thu, 10 May 2018 00:04:01 +0900 Subject: [PATCH 2/3] refs #286 Update toot status in AccountProfile's timeline --- .../SideBar/AccountProfile/Timeline.vue | 8 +++++- .../SideBar/AccountProfile/Timeline.js | 26 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.vue b/src/renderer/components/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.vue index ba926c5a..96579879 100644 --- a/src/renderer/components/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.vue +++ b/src/renderer/components/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.vue @@ -1,7 +1,7 @@ @@ -36,6 +36,12 @@ export default { type: 'error' }) }) + }, + updateToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/updateToot', message) + }, + deleteToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/AccountProfile/Timeline/deleteToot', message) } } } diff --git a/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js b/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js index ecc15dd7..9eb5dd53 100644 --- a/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js +++ b/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js @@ -8,6 +8,32 @@ const Timeline = { mutations: { updateTimeline (state, timeline) { state.timeline = timeline + }, + updateToot (state, message) { + // Replace target message in homeTimeline and notifications + state.timeline = state.timeline.map((toot) => { + if (toot.id === message.id) { + return message + } else if (toot.reblog !== null && toot.reblog.id === message.id) { + // When user reblog/favourite a reblogged toot, target message is a original toot. + // So, a message which is received now is original toot. + const reblog = { + reblog: message + } + return Object.assign(toot, reblog) + } else { + return toot + } + }) + }, + deleteToot (state, message) { + state.timeline = state.timeline.filter((toot) => { + if (toot.reblog !== null && toot.reblog.id === message.id) { + return false + } else { + return toot.id !== message.id + } + }) } }, actions: { From 62863a200d25b75e1f3767585503fa19988b2c60 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Thu, 10 May 2018 00:23:27 +0900 Subject: [PATCH 3/3] refs #286 Update toot status in TootDetail --- .../Contents/SideBar/TootDetail.vue | 24 ++++++- .../SideBar/AccountProfile/Timeline.js | 2 +- .../Contents/SideBar/TootDetail.js | 69 +++++++++++++++++++ 3 files changed, 91 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Contents/SideBar/TootDetail.vue b/src/renderer/components/TimelineSpace/Contents/SideBar/TootDetail.vue index e7deb533..7ecf1e63 100644 --- a/src/renderer/components/TimelineSpace/Contents/SideBar/TootDetail.vue +++ b/src/renderer/components/TimelineSpace/Contents/SideBar/TootDetail.vue @@ -1,13 +1,13 @@ @@ -47,6 +47,24 @@ export default { type: 'error' }) }) + }, + updateAncestorsToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/updateAncestorsToot', message) + }, + deleteAncestorsToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/deleteAncestorsToot', message) + }, + updateToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/updateToot', message) + }, + deleteToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/deleteToot', message) + }, + updateDescendantsToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/updateDescendantsToot', message) + }, + deleteDescendantsToot (message) { + this.$store.commit('TimelineSpace/Contents/SideBar/TootDetail/deleteDescendantsToot', message) } } } diff --git a/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js b/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js index 9eb5dd53..4b2bc95a 100644 --- a/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js +++ b/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile/Timeline.js @@ -10,7 +10,7 @@ const Timeline = { state.timeline = timeline }, updateToot (state, message) { - // Replace target message in homeTimeline and notifications + // Replace target message in timeline state.timeline = state.timeline.map((toot) => { if (toot.id === message.id) { return message diff --git a/src/renderer/store/TimelineSpace/Contents/SideBar/TootDetail.js b/src/renderer/store/TimelineSpace/Contents/SideBar/TootDetail.js index 0ecfd7db..0beaa615 100644 --- a/src/renderer/store/TimelineSpace/Contents/SideBar/TootDetail.js +++ b/src/renderer/store/TimelineSpace/Contents/SideBar/TootDetail.js @@ -16,6 +16,75 @@ const TootDetail = { }, updateDescendants (state, descendants) { state.descendants = descendants + }, + updateAncestorsToot (state, message) { + // Replace target message in ancestors + state.ancestors = state.ancestors.map((toot) => { + if (toot.id === message.id) { + return message + } else if (toot.reblog !== null && toot.reblog.id === message.id) { + // When user reblog/favourite a reblogged toot, target message is a original toot. + // So, a message which is received now is original toot. + const reblog = { + reblog: message + } + return Object.assign(toot, reblog) + } else { + return toot + } + }) + }, + deleteAncestorsToot (state, message) { + state.ancestors = state.ancestors.filter((toot) => { + if (toot.reblog !== null && toot.reblog.id === message.id) { + return false + } else { + return toot.id !== message.id + } + }) + }, + updateToot (state, message) { + if (state.message.id === message.id) { + state.message = message + } else if (state.message.reblog !== null && state.message.reblog.id === message.id) { + // When user reblog/favourite a reblogged toot, target message is a original toot. + // So, a message which is received now is original toot. + const reblog = { + reblog: message + } + state.message = Object.assign({}, state.message, reblog) + } + }, + deleteToot (state, message) { + if (state.message.id === message.id) { + state.message = null + } + }, + updateDescendantsToot (state, message) { + // Replace target message in descendants + state.descendants = state.descendants.map((toot) => { + if (toot.id === message.id) { + return message + } else if (toot.reblog !== null && toot.reblog.id === message.id) { + // When user reblog/favourite a reblogged toot, target message is a original toot. + // So, a message which is received now is original toot. + const reblog = { + reblog: message + } + return Object.assign(toot, reblog) + } else { + return toot + } + }) + }, + deleteDescendantsToot (state, message) { + state.descendants = state.descendants.filter((toot) => { + if (toot.reblog !== null && toot.reblog.id === message.id) { + return false + } else { + return toot.id !== message.id + } + }) } }, actions: {