diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..c39b8e0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,26 @@ + + +## New Features + +- + +## Bug Fixes + +- + +## Maintenance + +- + + diff --git a/package-lock.json b/package-lock.json index ceaf542..63caa79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "robinhood-mint-sync-chrome", - "version": "3.4.0", + "version": "3.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 591210b..53758fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "robinhood-mint-sync-chrome", - "version": "3.4.0", + "version": "3.4.1", "repository": { "type": "git", "url": "git+https://github.com/pkmnct/robinhood-mint-sync-chrome.git" diff --git a/public/manifest.json b/public/manifest.json index a75204c..1de9a13 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Robinhood Mint Sync", "description": "Automatically add your Robinhood portfolio to Mint", - "version": "3.4.0", + "version": "3.4.1", "author": "George Walker", "browser_specific_settings": { "gecko": { @@ -17,7 +17,11 @@ "512": "images/icon512.png" }, "background": { - "scripts": ["js/background/main.js", "js/background/update_install_listener.js", "js/background/browser_action.js"] + "scripts": [ + "js/background/main.js", + "js/background/update_install_listener.js", + "js/background/browser_action.js" + ] }, "browser_action": { "default_icon": { @@ -38,21 +42,31 @@ "js": ["js/content/robinhood/login.js"] }, { - "matches": ["https://mint.intuit.com/settings.event?filter=property&addRobinhood=true"], + "matches": [ + "https://mint.intuit.com/settings.event?filter=property&addRobinhood=true" + ], "js": ["js/content/mint/properties/update.js"] }, { - "matches": ["https://mint.intuit.com/settings.event?filter=property&setupRobinhood=true"], + "matches": [ + "https://mint.intuit.com/settings.event?filter=property&setupRobinhood=true" + ], "js": ["js/content/mint/properties/check.js"] }, { - "matches": ["https://mint.intuit.com/settings.event?filter=property&createProperty=true&property=*"], + "matches": [ + "https://mint.intuit.com/settings.event?filter=property&createProperty=true&property=*" + ], "js": ["js/content/mint/properties/create.js"] }, { "matches": ["https://mint.intuit.com/overview.event*"], "js": ["js/external/noty/noty.min.js", "js/content/mint/main.js"], - "css": ["css/notification.css", "js/external/noty/noty.css", "js/external/noty/themes/relax.css"] + "css": [ + "css/notification.css", + "js/external/noty/noty.css", + "js/external/noty/themes/relax.css" + ] }, { "matches": ["https://mint.intuit.com/*"], diff --git a/src/background/main.ts b/src/background/main.ts index fbeb2cf..7ad948e 100644 --- a/src/background/main.ts +++ b/src/background/main.ts @@ -147,7 +147,7 @@ const eventHandlers = { // This event is emitted by the Mint property update content script. "mint-sync-complete": ({ sender }: eventHandler) => { debug.log("mint-sync-complete event"); - chrome.storage.sync.set({ syncTime: new Date().toString() }); + chrome.storage.sync.set({ syncTime: new Date().toISOString() }); chrome.tabs.sendMessage(mintTab, { status: "Sync Complete! Reload to see the change.", link: "/overview.event", @@ -195,6 +195,7 @@ const eventHandlers = { const currentTime = new Date(); const differenceMilliseconds = currentTime.valueOf() - syncTimeParsed.valueOf(); const differenceHours = Math.floor((differenceMilliseconds % 86400000) / 3600000); + debug.log(syncTime, syncTimeParsed, currentTime, differenceHours); if (differenceHours >= 1) { eventHandlers["trigger-sync"](); } else { diff --git a/src/content/mint/properties/update.ts b/src/content/mint/properties/update.ts index 1d9d13e..d9482c6 100644 --- a/src/content/mint/properties/update.ts +++ b/src/content/mint/properties/update.ts @@ -78,7 +78,7 @@ chrome.runtime.onMessage.addListener((request) => { }; if (request.uninvested_cash) { - cash = parseFloat(request.uninvested_cash); + cash = parseFloat(request.uninvested_cash) - parseFloat(request.cash_available_from_instant_deposits); } setRobinhoodAmount("Cash", cash); diff --git a/src/content/robinhood/main.ts b/src/content/robinhood/main.ts index 7facd1a..cbe2861 100644 --- a/src/content/robinhood/main.ts +++ b/src/content/robinhood/main.ts @@ -42,6 +42,7 @@ export interface Message { error?: Error; newProperties?: string; property?: string; + cash_available_from_instant_deposits?: string; } /** @@ -67,20 +68,26 @@ const scrapeData = async () => { returnValue.debug = json; - if (json && json.uninvested_cash && json.uninvested_cash.amount) { - returnValue.uninvested_cash = json.uninvested_cash.amount; - } + if (json) { + if (json.uninvested_cash && json.uninvested_cash.amount) { + returnValue.uninvested_cash = json.uninvested_cash.amount; + } - if (json && json.crypto && json.crypto.equity && json.crypto.equity.amount) { - returnValue.crypto = json.crypto.equity.amount; - } + if (json.crypto && json.crypto.equity && json.crypto.equity.amount) { + returnValue.crypto = json.crypto.equity.amount; + } - if (json && json.equities && json.equities.equity && json.equities.equity.amount) { - returnValue.equities = json.equities.equity.amount; - } + if (json.equities && json.equities.equity && json.equities.equity.amount) { + returnValue.equities = json.equities.equity.amount; + } + + if (json.total_equity && json.total_equity.amount) { + returnValue.total_equity = json.total_equity.amount; + } - if (json && json.total_equity && json.total_equity.amount) { - returnValue.total_equity = json.total_equity.amount; + if (json.cash_available_from_instant_deposits && json.cash_available_from_instant_deposits.amount) { + returnValue.cash_available_from_instant_deposits = json.cash_available_from_instant_deposits.amount; + } } return returnValue;