joelekstrom / fastmate

A native Fastmail-wrapper for Mac.
MIT License
193 stars 12 forks source link

Updated element IDs for new Fastmail layout #70

Closed kalkwarf closed 2 years ago

kalkwarf commented 2 years ago

The DOM changed with the latest UI refresh, so I updated the handlers to look for the new IDs.

A: This is fragile. There must be a better way. B: The fact that we assure the document looks like we expected means we failed safely, so there's that.

joelekstrom commented 2 years ago

Hi! Thanks for the patch.

I think a better way may be to check the current URL perhaps? For example, when viewing a mail, it looks something like this: https://www.fastmail.com/mail/Inbox/{mail-id}, but when replying to one, it's https://www.fastmail.com/mail/Inbox/compose/{mail-id}. Would this give you enough safety checks to know when to run the shortcuts?

joelekstrom commented 2 years ago

Another idea is to somehow override the Fastmail bindings. In their source code they have this inside mail.mod.js:

    Uo = {
        r: "reply",
        a: "replyAll",
        "Alt-r": "replySender",
        f: "forward",
        n: "goNext",
        p: "goPrevious",
        e: "toggleExpand",
        s: "toggleFlagged",
        '"': "toggleQuotes",
        ":": "toggleDetails",
        ";": "showActions",
        "Shift-E": "expandAll",
        "Alt-Shift-E": "collapseAll",
        "Shift-L": "showRemoteImages",
        "Cmd-a": "selectMessageBody"
    },

perhaps one could extend it and simply add the arrow shortcuts there. But I think the URL approach is simpler