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

Add a fallback url for when main urls don't work #1515

Merged
merged 1 commit into from
Dec 29, 2020
Merged

Conversation

ahmedre
Copy link
Contributor

@ahmedre ahmedre commented Dec 27, 2020

No description provided.

if (urlString.contains("quran.com") || urlString.contains("quranicaudio.com")) {
url = urlString.replace("https://", "http://");
if (fallbackByDefault || i > 0) {
if (urlString.contains("android.quran.com")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You could directly use replace without if block/check, because with contains and replace you are doing double look-up anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jazakAllah khairan - done

compositeDisposable.add(
imageUtil.downloadImage(url, previewImage)
.onErrorResumeNext(imageUtil.downloadImage(backupUrl, previewImage))
Copy link
Contributor

Choose a reason for hiding this comment

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

Elsewhere you are replaceing on error, here a separate variable. Maybe use a common convention?

Actually, I personally would prefer to have a single utility class/method for all replacements :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jazakAllah khairan - done

@ahmedre ahmedre merged commit 8fa1f00 into master Dec 29, 2020
@ahmedre ahmedre deleted the download_fallback branch December 29, 2020 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants