diff --git a/build.js b/build.js index be51ab7..1e11733 100644 --- a/build.js +++ b/build.js @@ -161,8 +161,9 @@ mkdirSync(OBSIDIAN_DIR, { recursive: true }); // Wrap birb.js with plugin boilerplate const obsidianPlugin = ` const { Plugin, Notice } = require('obsidian'); -module.exports = class MyPlugin extends Plugin { +module.exports = class PocketBird extends Plugin { onload() { + const OBSIDIAN_PLUGIN = this; ${birbJs} } diff --git a/dist/birb.js b/dist/birb.js index 1c76315..d82e1f1 100644 --- a/dist/birb.js +++ b/dist/birb.js @@ -1066,21 +1066,22 @@ * @returns {Promise} */ async getSaveData() { - log("Loading save data from Obsidian plugin storage unimplemented"); - return {}; + // @ts-expect-error + return await OBSIDIAN_PLUGIN.loadData() ?? {}; } /** * @override - * @param {BirbSaveData} saveData + * @param {BirbSaveData|{}} saveData */ async putSaveData(saveData) { - log("Saving data to Obsidian plugin storage unimplemented"); + // @ts-expect-error + return await OBSIDIAN_PLUGIN.saveData(saveData); } /** @override */ resetSaveData() { - log("Resetting save data in Obsidian plugin storage unimplemented"); + this.putSaveData({}); } /** @override */ @@ -1923,7 +1924,7 @@ insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2025.11.13.8", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.8"); }, false), + new MenuItem("2025.11.13.16", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.16"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/dist/extension.zip b/dist/extension.zip index e083bd7..fdc7731 100644 Binary files a/dist/extension.zip and b/dist/extension.zip differ diff --git a/dist/extension/birb.js b/dist/extension/birb.js index 1c76315..d82e1f1 100644 --- a/dist/extension/birb.js +++ b/dist/extension/birb.js @@ -1066,21 +1066,22 @@ * @returns {Promise} */ async getSaveData() { - log("Loading save data from Obsidian plugin storage unimplemented"); - return {}; + // @ts-expect-error + return await OBSIDIAN_PLUGIN.loadData() ?? {}; } /** * @override - * @param {BirbSaveData} saveData + * @param {BirbSaveData|{}} saveData */ async putSaveData(saveData) { - log("Saving data to Obsidian plugin storage unimplemented"); + // @ts-expect-error + return await OBSIDIAN_PLUGIN.saveData(saveData); } /** @override */ resetSaveData() { - log("Resetting save data in Obsidian plugin storage unimplemented"); + this.putSaveData({}); } /** @override */ @@ -1923,7 +1924,7 @@ insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2025.11.13.8", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.8"); }, false), + new MenuItem("2025.11.13.16", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.16"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/dist/extension/manifest.json b/dist/extension/manifest.json index 75df989..c8f1e33 100644 --- a/dist/extension/manifest.json +++ b/dist/extension/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Pocket Bird", "description": "It's a pet bird in your browser, what more could you want?", - "version": "2025.11.13.8", + "version": "2025.11.13.16", "homepage_url": "https://idreesinc.com", "icons": { "48": "images/icons/transparent/48x48x1.png", diff --git a/dist/obsidian/main.js b/dist/obsidian/main.js index 7740254..e545261 100644 --- a/dist/obsidian/main.js +++ b/dist/obsidian/main.js @@ -1,7 +1,8 @@ const { Plugin, Notice } = require('obsidian'); -module.exports = class MyPlugin extends Plugin { +module.exports = class PocketBird extends Plugin { onload() { + const OBSIDIAN_PLUGIN = this; (function () { 'use strict'; @@ -1070,21 +1071,22 @@ module.exports = class MyPlugin extends Plugin { * @returns {Promise} */ async getSaveData() { - log("Loading save data from Obsidian plugin storage unimplemented"); - return {}; + // @ts-expect-error + return await OBSIDIAN_PLUGIN.loadData() ?? {}; } /** * @override - * @param {BirbSaveData} saveData + * @param {BirbSaveData|{}} saveData */ async putSaveData(saveData) { - log("Saving data to Obsidian plugin storage unimplemented"); + // @ts-expect-error + return await OBSIDIAN_PLUGIN.saveData(saveData); } /** @override */ resetSaveData() { - log("Resetting save data in Obsidian plugin storage unimplemented"); + this.putSaveData({}); } /** @override */ @@ -1927,7 +1929,7 @@ module.exports = class MyPlugin extends Plugin { insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2025.11.13.8", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.8"); }, false), + new MenuItem("2025.11.13.16", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.16"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/dist/obsidian/manifest.json b/dist/obsidian/manifest.json index 43489ee..d692265 100644 --- a/dist/obsidian/manifest.json +++ b/dist/obsidian/manifest.json @@ -1,7 +1,7 @@ { "id": "pocket-bird", "name": "Pocket Bird", - "version": "2025.11.13.8", + "version": "2025.11.13.16", "minAppVersion": "0.15.0", "description": "It's a pet bird in your Obsidian, what more could you want?", "author": "Idrees Hassan", diff --git a/dist/userscript/birb.user.js b/dist/userscript/birb.user.js index 9a5a6c0..c6e381d 100644 --- a/dist/userscript/birb.user.js +++ b/dist/userscript/birb.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Pocket Bird // @namespace https://idreesinc.com -// @version 2025.11.13.8 +// @version 2025.11.13.16 // @description It's a bird that hops around your web browser, the future is here // @author Idrees // @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/userscript/birb.user.js @@ -1080,21 +1080,22 @@ * @returns {Promise} */ async getSaveData() { - log("Loading save data from Obsidian plugin storage unimplemented"); - return {}; + // @ts-expect-error + return await OBSIDIAN_PLUGIN.loadData() ?? {}; } /** * @override - * @param {BirbSaveData} saveData + * @param {BirbSaveData|{}} saveData */ async putSaveData(saveData) { - log("Saving data to Obsidian plugin storage unimplemented"); + // @ts-expect-error + return await OBSIDIAN_PLUGIN.saveData(saveData); } /** @override */ resetSaveData() { - log("Resetting save data in Obsidian plugin storage unimplemented"); + this.putSaveData({}); } /** @override */ @@ -1937,7 +1938,7 @@ insertModal(`${birdBirb()} Mode`, message); }), new Separator(), - new MenuItem("2025.11.13.8", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.8"); }, false), + new MenuItem("2025.11.13.16", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.11.13.16"); }, false), ]; const styleElement = document.createElement("style"); diff --git a/src/context.js b/src/context.js index d3cd2ab..31640bb 100644 --- a/src/context.js +++ b/src/context.js @@ -227,21 +227,22 @@ class ObsidianContext extends Context { * @returns {Promise} */ async getSaveData() { - log("Loading save data from Obsidian plugin storage unimplemented"); - return {}; + // @ts-expect-error + return await OBSIDIAN_PLUGIN.loadData() ?? {}; } /** * @override - * @param {BirbSaveData} saveData + * @param {BirbSaveData|{}} saveData */ async putSaveData(saveData) { - log("Saving data to Obsidian plugin storage unimplemented"); + // @ts-expect-error + return await OBSIDIAN_PLUGIN.saveData(saveData); } /** @override */ resetSaveData() { - log("Resetting save data in Obsidian plugin storage unimplemented"); + this.putSaveData({}); } /** @override */