-
Notifications
You must be signed in to change notification settings - Fork 36
Imgur low quality images for data saving mode #256
Conversation
Implementing #257 will address this. I will probably work on this myself |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
7908359
to
47a48aa
Compare
47a48aa
to
36536b9
Compare
That should cover all of new logic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks
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.