Skip to content

Commit

Permalink
Merge pull request #156 from mowolf/sebi-fix-sharing
Browse files Browse the repository at this point in the history
Sebi fix sharing
  • Loading branch information
fellnerse authored Mar 5, 2021
2 parents d111e4f + 613a1a0 commit d225048
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
push:
branches:
- main
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand All @@ -22,3 +24,4 @@ jobs:
token: ${{ secrets.DEPLOY_KEY }}
branch: gh-pages # The branch the action should deploy to.
folder: dist # The folder the action should deploy.
clean-exclude: "CNAME"
2 changes: 1 addition & 1 deletion .github/workflows/husky.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
lint-and-prettify:
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand Down
13 changes: 7 additions & 6 deletions components/FileHandler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default {
.async("string");
},
readMultipleFiles(files) {
readSharedFiles(files) {
function findChatFile(files) {
let chatRegex = new RegExp(/.*(?:chat|whatsapp).*\.txt$/i);
return files.find((file) => {
Expand Down Expand Up @@ -200,14 +200,15 @@ export default {
value: "0",
});
},
processFileList(fileList) {
processFileList(fileList, shared = false) {
this.isDragging = false;
this.processing = true;
this.isSuccess = false;
this.wrongFile = false;
if (fileList.length > 1) {
if (shared || fileList.length > 1) {
//do multiple here
this.readMultipleFiles(fileList);
this.readSharedFiles(fileList);
} else {
let file = fileList[0];
// do singles here
Expand Down Expand Up @@ -243,12 +244,12 @@ export default {
this.processFileList(fileList);
},
},
mounted() {
created() {
fetch("/chat_example.txt")
.then((response) => response.text())
.then(parseString)
.then((messages) => {
messages = { messages: messages };
messages = { messages: messages, default: true };
this.extendDataStructure(messages);
return messages;
})
Expand Down
2 changes: 1 addition & 1 deletion components/charts/ExampleGraphs.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div v-if="chat_">
<v-col v-if="$vuetify.breakpoint.smAndUp">
<v-row>
<v-col cols="12" sm="6">
Expand Down
2 changes: 1 addition & 1 deletion components/charts/Results.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="text-center py-10">
<div v-if="chat" class="text-center py-10">
<ChatVisualization :chat="chat" :attachments="attachments" />
<div class="text-h2 font-weight-bold py-10">Chat Timeline</div>
<div>Messages per Day</div>
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
},
icon: {
source: "/assets",
fileName: "whatsanalyze-logo-black.png",
fileName: "whatsanalyze-logo-green.png",
},
},

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"dev": "NUXT_ENV_LOCAL=1 nuxt",
"local": "NUXT_ENV_LOCAL=1 nuxt generate && NUXT_ENV_LOCAL=1 nuxt start",
"deploy": "nuxt generate && push-dir --dir=dist --branch=gh-pages --cleanup"
"deploy": "nuxt generate && push-dir --dir=dist --branch=gh-pages --cleanup",
"deploy-sebi": "nuxt generate && rm dist/CNAME && push-dir --remote=https://github.com/fellnerse/fellnerse.github.io.git --dir=dist --branch=gh-pages --cleanup"
},
"husky": {
"hooks": {
Expand Down
15 changes: 8 additions & 7 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,19 @@ export default {
data() {
return {
isShowingChats: false,
chat_: new Chat(),
chat_: undefined,
downloading: false,
attachments: undefined,
};
},
methods: {
Chat,
newMessages(chatObject) {
this.attachments = chatObject.attachments;
this.chat_ = new Chat(chatObject.messages);
// we only update with default chat object if chat_ is undefined
if (!chatObject.default || this.chat_ === undefined) {
this.attachments = chatObject.attachments;
this.chat_ = new Chat(chatObject.messages);
}
},
downloadImage() {
this.downloading = true;
Expand Down Expand Up @@ -123,13 +126,11 @@ export default {
workbox.addEventListener("message", (m) => {
// eslint-disable-next-line no-prototype-builtins
if (_this.$route.query.hasOwnProperty("receiving-file-share")) {
console.log(m.data.file); //contains the file(s)
console.log("index message wb", m);
console.log("current route", _this.$route);
let files = m.data.file;
// currently only the first file, but ultimately we want to pass all files
if (Array.isArray(files)) files = files[0];
_this.$refs.filehandler.processFile(files);
// if (Array.isArray(files)) files = files[0];
_this.$refs.filehandler.processFileList(files, true);
}
});
workbox.messageSW("SHARE_READY");
Expand Down

0 comments on commit d225048

Please sign in to comment.