Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Paintroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ android {
signedRelease {
initWith(release)
signingConfig = signingConfigs.signedRelease

}
debug { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import java.io.File
const val PAINTROID_PICTURE_PATH = "org.catrobat.extra.PAINTROID_PICTURE_PATH"
const val PAINTROID_PICTURE_NAME = "org.catrobat.extra.PAINTROID_PICTURE_NAME"
const val TEMP_PICTURE_NAME = "catroidTemp"
const val MEDIA_GALLEY_URL = "https://share.catrob.at/pocketcode/media-library/looks"
const val MEDIA_GALLEY_URL = "https://catrobat.org/figures-download/"
const val ABOUT_DIALOG_FRAGMENT_TAG = "aboutdialogfragment"
const val LIKE_US_DIALOG_FRAGMENT_TAG = "likeusdialogfragment"
const val RATE_US_DIALOG_FRAGMENT_TAG = "rateusdialogfragment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package org.catrobat.paintroid.web;

import android.graphics.Bitmap;
import android.net.Uri;
import android.view.View;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
Expand All @@ -46,16 +45,9 @@ public MediaGalleryWebViewClient(WebClientCallback callback) {
this.callback = callback;
}

private static final String GALLERY_ROOT = "https://share.catrob.at/pocketcode/";

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// avoid regex 'matches' – we only want a prefix check
if (!startsWithGalleryRoot(url)) {
showLoading(view);
} else {
callback.finish();
}
showLoading(view);
}

@Override
Expand Down Expand Up @@ -92,17 +84,6 @@ public void onReceivedError(WebView view, int errorCode, String description, Str
callback.finish();
}

private boolean startsWithGalleryRoot(String url) {
try {
Uri u = Uri.parse(url);
// normalize to compare robustly
String normalized = u.getScheme() + "://" + u.getHost() + (u.getPort() != -1 ? ":" + u.getPort() : "") + u.getPath();
return normalized.startsWith(GALLERY_ROOT);
} catch (Exception ignored) {
return false;
}
}

private void showLoading(View anchor) {
if (loadingDialog != null) {
return;
Expand Down