Merge branch 'develop' into Login
This commit is contained in:
commit
d65243945f
@ -3,6 +3,7 @@ package net.schueller.peertube.helper;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.webkit.URLUtil;
|
||||
|
||||
import net.schueller.peertube.R;
|
||||
|
||||
@ -10,7 +11,13 @@ public class APIUrlHelper{
|
||||
|
||||
public static String getUrl(Context context) {
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
return sharedPref.getString("pref_api_base", context.getResources().getString(R.string.pref_default_api_base_url));
|
||||
|
||||
// validate URL is valid
|
||||
String URL = sharedPref.getString("pref_api_base", context.getResources().getString(R.string.pref_default_api_base_url));
|
||||
if (!URLUtil.isValidUrl(URL)) {
|
||||
return "http://invalid";
|
||||
}
|
||||
return URL;
|
||||
}
|
||||
|
||||
public static String getUrlWithVersion(Context context) {
|
||||
|
Loading…
Reference in New Issue
Block a user