Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom explainxkcd rendering #114

Open
aaronliu0130 opened this issue Oct 5, 2023 · 7 comments
Open

Custom explainxkcd rendering #114

aaronliu0130 opened this issue Oct 5, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@aaronliu0130
Copy link

aaronliu0130 commented Oct 5, 2023

I love this app, but the explainxkcd rendering is quite inconvenient, especially on iPhone. I was wondering if you could get their Wikitext (through their API), render the headings and links, and just slap them into the app?

@codetheweb
Copy link
Member

I have no plans to do this myself but happy to accept a PR implementing this. :)

@codetheweb codetheweb added the enhancement New feature or request label Oct 9, 2023
@aaronliu0130
Copy link
Author

aaronliu0130 commented Oct 10, 2023

For anyone looking to implement, https://www.explainxkcd.com/wiki/index.php/418:_Stove_Ownership?action=render would be a nice starting point and https://www.mediawiki.org/wiki/API:Main_page has docs for an API that can return in JSON, XML or PHP.

@aaronliu0130
Copy link
Author

aaronliu0130 commented Oct 10, 2023

Actually, while the rest isn't done, I'll PR the starting point.

Edit: Nevermind I can't navigate swift lol

@aaronliu0130
Copy link
Author

I have tracked the code down to https://github.com/XKCDY/app/blob/master/XKCDY/Support/XKCDYClient.swift#L42 . @codetheweb Is there a way to automatically append ?action=render to the explainURL property of whatever the returned thing is? I have no idea what this entire result thing is 😅
Also, // TODO: remove this hack for iOS 14 once it's out of beta

@codetheweb
Copy link
Member

I would probably add it within https://github.com/XKCDY/app/blob/master/XKCDY/Views/ComicDetailsSheet.swift rather than at time of API response. Might be easier to toggle between this and the old rendering method as well with a user setting.

@aaronliu0130
Copy link
Author

So you're saying (without the setting) it would be self.webViewUrl = explainURL + "?action=render"? Should I go ahead and PR this?

@codetheweb
Copy link
Member

Should I go ahead and PR this?

Go for it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants