obsidian-db-folder icon indicating copy to clipboard operation
obsidian-db-folder copied to clipboard

[FR] Mobile support

Open RafaelGB opened this issue 2 years ago • 10 comments

@bakerstreet reports that the application does not work on mobile property here

I am opening this issue

RafaelGB avatar May 06 '22 06:05 RafaelGB

While it's not working is it possible to mark isDesktopOnly as true? That prevents it from trying and failing to load on every mobile start for the moment.

iamrecursion avatar May 10 '22 09:05 iamrecursion

oh that's right! I will change it. Thank you

RafaelGB avatar May 10 '22 09:05 RafaelGB

You may be able to debug this more effectively using Obsidian REPL. Though it won't show the initial failure to load, it will pick up the error when you try and manually enable the plug-in.

iamrecursion avatar May 10 '22 10:05 iamrecursion

Nice plugin idea btw! I will give it a try

RafaelGB avatar May 10 '22 10:05 RafaelGB

"isDesktopOnly": true added with 0.3.1

RafaelGB avatar May 10 '22 19:05 RafaelGB

Great! I look forward to proper mobile support!

iamrecursion avatar May 13 '22 21:05 iamrecursion

Nice! I am working with documentation with mkdocs

RafaelGB avatar May 14 '22 11:05 RafaelGB

Hi @iamrecursion do you need help with this issue? Any progress? You can share with us so could be easy to help

RafaelGB avatar Jun 17 '22 11:06 RafaelGB

Oh, I think there's been some confusion! I didn't say that I could work on it—unfortunately I've not got the time at the moment—just that I look forward to it being done!

If this is still outstanding in a month or so I should be able to pick it up.

I'm really sorry for the confusion!

iamrecursion avatar Jun 17 '22 20:06 iamrecursion

@iamrecursion oh do not sorry :) I will try to give mobile support with your debugging plugin

RafaelGB avatar Jun 17 '22 22:06 RafaelGB

Trying to debug on mobile while is load with this templater script but does not load on mobile yet:

// Call this method inside your plugin's
// `onload` function like so:
// monkeyPatchConsole(this);
function monkeyPatchConsole(path){
    console.log("=> monkeyPatchConsole");
    // if (!Platform.isMobile) {
    //     return;
    // }

    const logFile = `${path}/${new Date().toLocaleDateString('sv')}.log`;
    const logs = [];
    const logMessages = (prefix) => (messages) => {
        logs.push(`\n[${prefix}]`);
        for (const message of messages) {
            logs.push(String(message));
        }
        window.app.vault.adapter.write(logFile, logs.join(" "));
    };

    console.debug = logMessages("debug");
    console.error = logMessages("error");
    console.info = logMessages("info");
    console.log = logMessages("log");
    console.warn = logMessages("warn");
    console.log(`<= monkeyPatchConsole ${logFile}`);
}

module.exports = monkeyPatchConsole;

RafaelGB avatar Aug 23 '22 15:08 RafaelGB

I generate a mini plugin just to debug on mobile.

mobile-debug.zip

Once I found the problem ([error] Plugin failure: dbfolder ReferenceError: Can't find variable: process) I used the plugin of rollup @rollup/plugin-replace to substitute in exec time the variable process for a controlled one

const getRollupPlugins = (tsconfig, ...plugins) =>
    [
        typescript2(tsconfig),
        nodeResolve({ browser: true }),
        json(),
        commonjs(),
        replace({
            'process.env.NODE_ENV': JSON.stringify(isProd ? 'production' : 'development')
        })
    ].concat(plugins);

aaaand... Its working! I am sure there are tons of bugs just for mobile but at least the table is loading correctly

RafaelGB avatar Sep 10 '22 23:09 RafaelGB

That's very exciting!

iamrecursion avatar Sep 11 '22 15:09 iamrecursion