Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Imgur low quality images for data saving mode #256

Merged
merged 7 commits into from
Jun 17, 2020

Conversation

AbsurdlySuspicious
Copy link
Collaborator

Primarily for albums since reddit provides its own previews for single images.

This is also fixes bug with gifs failing to load if they're actually a static image. Won't work if invalid url is already in user's persistent cache tough.

@AbsurdlySuspicious
Copy link
Collaborator Author

Won't work if invalid url is already in user's persistent cache tough.

Implementing #257 will address this. I will probably work on this myself

Copy link
Owner

@Tunous Tunous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. The only concern I have is with unit tests. I can see that a lot of code changed so it would be nice to have new tests written for it just to stay safe in future.

@@ -72,11 +72,14 @@
private static final Pattern DEFAULT_IMGUR_ALBUM_PATTERN = Pattern.compile("/(?:gallery)?(?:a)?(?:t/\\w*)?/(\\w*).*");

/**
* Extracts Imgur preview suffix and file extension
* Extracts Imgur image id (1) and extension (2) if exists
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to also add unit tests on these new possibilities.


HttpUrl imageUrl = HttpUrl.parse(url)
@SuppressWarnings("ConstantConditions")
public ImgurLink createImgurLink(String url, @Nullable String title, @Nullable String description, Boolean fallback) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t know if we have tests like this but it would be nice to have at least one for each handled situation since there are many changes in this function and it is public.

@AbsurdlySuspicious AbsurdlySuspicious force-pushed the imgur_lq/feature branch 2 times, most recently from 7908359 to 47a48aa Compare June 16, 2020 21:48
@AbsurdlySuspicious
Copy link
Collaborator Author

AbsurdlySuspicious commented Jun 16, 2020

That should cover all of new logic

Copy link
Owner

@Tunous Tunous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks

@Tunous Tunous merged commit 6f65a99 into Tunous:master Jun 17, 2020
@Tunous Tunous added this to the 0.9.3 milestone Jun 17, 2020
@Tunous Tunous added the feature New feature label Jun 17, 2020
@AbsurdlySuspicious AbsurdlySuspicious deleted the imgur_lq/feature branch June 17, 2020 20:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants