mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-31 17:04:59 +01:00
Merge branch 'master' into maintenance
This commit is contained in:
commit
f7106b807c
@ -17,8 +17,8 @@ allprojects {
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
projectGroupId = 'org.mariotaku.twidere'
|
projectGroupId = 'org.mariotaku.twidere'
|
||||||
projectVersionCode = 506
|
projectVersionCode = 507
|
||||||
projectVersionName = '4.0.7'
|
projectVersionName = '4.0.8'
|
||||||
|
|
||||||
globalCompileSdkVersion = 29
|
globalCompileSdkVersion = 29
|
||||||
globalBuildToolsVersion = '29.0.2'
|
globalBuildToolsVersion = '29.0.2'
|
||||||
|
@ -6,11 +6,12 @@ import android.content.Context;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.webkit.URLUtil;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.WorkerThread;
|
import androidx.annotation.WorkerThread;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.webkit.URLUtil;
|
|
||||||
|
|
||||||
import org.mariotaku.microblog.library.MicroBlog;
|
import org.mariotaku.microblog.library.MicroBlog;
|
||||||
import org.mariotaku.restfu.http.Endpoint;
|
import org.mariotaku.restfu.http.Endpoint;
|
||||||
@ -94,7 +95,7 @@ public class MicroBlogAPIFactory implements TwidereConstants {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static String getApiBaseUrl(@NonNull String format, @Nullable final String domain) {
|
public static String getApiBaseUrl(@NonNull String format, @Nullable final String domain) {
|
||||||
final Matcher matcher = Pattern.compile("\\[(\\.?)DOMAIN(\\.?)]", Pattern.CASE_INSENSITIVE).matcher(format);
|
final Matcher matcher = Pattern.compile("\\[(\\.?)DOMAIN(\\.?)](\\.?)", Pattern.CASE_INSENSITIVE).matcher(format);
|
||||||
final String baseUrl;
|
final String baseUrl;
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
@ -110,7 +111,7 @@ public class MicroBlogAPIFactory implements TwidereConstants {
|
|||||||
} else if (TextUtils.isEmpty(domain)) {
|
} else if (TextUtils.isEmpty(domain)) {
|
||||||
baseUrl = matcher.replaceAll("");
|
baseUrl = matcher.replaceAll("");
|
||||||
} else {
|
} else {
|
||||||
baseUrl = matcher.replaceAll("$1" + domain + "$2");
|
baseUrl = matcher.replaceAll("$1" + domain + "." + "$2");
|
||||||
}
|
}
|
||||||
// In case someone set invalid base url
|
// In case someone set invalid base url
|
||||||
if (HttpUrl.parse(baseUrl) == null) {
|
if (HttpUrl.parse(baseUrl) == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user