mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-07 22:31:17 -04:00
Merge pull request #1204 from kiwix/macgills/hotfix/use-http
- Use http instead of https - Increase read timeout - bump abi codes …
This commit is contained in:
commit
7da84c0b90
@ -148,7 +148,6 @@ dependencies {
|
|||||||
//update this with androidx
|
//update this with androidx
|
||||||
testImplementation 'com.jraska.livedata:testing-ktx:0.2.1'
|
testImplementation 'com.jraska.livedata:testing-ktx:0.2.1'
|
||||||
testImplementation 'android.arch.core:core-testing:1.1.1'
|
testImplementation 'android.arch.core:core-testing:1.1.1'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set custom app import directory
|
// Set custom app import directory
|
||||||
@ -189,15 +188,28 @@ def buildNumber = System.getenv('TRAVIS_BUILD_NUMBER') ?: "dev"
|
|||||||
ext {
|
ext {
|
||||||
versionMajor = 2
|
versionMajor = 2
|
||||||
versionMinor = 5
|
versionMinor = 5
|
||||||
versionPatch = 0
|
versionPatch = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateVersionName() {
|
private String generateVersionName() {
|
||||||
"${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
|
"${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* max version code: 210-0-00-00-00
|
||||||
|
* our template : UUU-A-ZZ-YY-XX
|
||||||
|
* where:
|
||||||
|
* X = patch version
|
||||||
|
* Y = minor version
|
||||||
|
* Z = major version (+ 20 to distinguish from previous, non semantic, versions of the app)
|
||||||
|
* A = number representing ABI split
|
||||||
|
* U = unused
|
||||||
|
*/
|
||||||
private Integer generateVersionCode() {
|
private Integer generateVersionCode() {
|
||||||
200000 + (ext.versionMajor * 10000) + (ext.versionMinor * 100) + (ext.versionPatch)
|
20 * 10000 +
|
||||||
|
(ext.versionMajor * 10000) +
|
||||||
|
(ext.versionMinor * 100) +
|
||||||
|
(ext.versionPatch)
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@ -259,7 +271,7 @@ android {
|
|||||||
|
|
||||||
// Main build type for debugging
|
// Main build type for debugging
|
||||||
debug {
|
debug {
|
||||||
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://download.kiwix.org/\""
|
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://mirror.download.kiwix.org/\""
|
||||||
buildConfigField "boolean", "KIWIX_ERROR_ACTIVITY", "false"
|
buildConfigField "boolean", "KIWIX_ERROR_ACTIVITY", "false"
|
||||||
testCoverageEnabled true
|
testCoverageEnabled true
|
||||||
}
|
}
|
||||||
@ -279,7 +291,7 @@ android {
|
|||||||
// Release Type
|
// Release Type
|
||||||
release {
|
release {
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://download.kiwix.org/\""
|
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://mirror.download.kiwix.org/\""
|
||||||
buildConfigField "boolean", "KIWIX_ERROR_ACTIVITY", "false"
|
buildConfigField "boolean", "KIWIX_ERROR_ACTIVITY", "false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -425,13 +437,13 @@ android {
|
|||||||
experimental = true
|
experimental = true
|
||||||
}
|
}
|
||||||
|
|
||||||
def abiCodes = ['arm64-v8a': 5, 'x86': 2, 'x86_64': 3, 'armeabi-v7a': 4]
|
def abiCodes = ['arm64-v8a': 6, 'x86': 3, 'x86_64': 4, 'armeabi-v7a': 5]
|
||||||
splits {
|
splits {
|
||||||
abi {
|
abi {
|
||||||
enable true
|
enable true
|
||||||
reset()
|
reset()
|
||||||
include "x86", "x86_64", 'armeabi-v7a', "arm64-v8a"
|
include "x86", "x86_64", 'armeabi-v7a', "arm64-v8a"
|
||||||
universalApk false
|
universalApk buildNumber == "dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
applicationVariants.all { variant ->
|
applicationVariants.all { variant ->
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
android:icon="@mipmap/kiwix_icon"
|
android:icon="@mipmap/kiwix_icon"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
android:supportsRtl="true">
|
android:supportsRtl="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
|
@ -25,22 +25,24 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.logging.HttpLoggingInterceptor;
|
import okhttp3.logging.HttpLoggingInterceptor;
|
||||||
|
import okhttp3.logging.HttpLoggingInterceptor.Level;
|
||||||
import org.kiwix.kiwixmobile.BuildConfig;
|
import org.kiwix.kiwixmobile.BuildConfig;
|
||||||
import org.kiwix.kiwixmobile.network.KiwixService;
|
import org.kiwix.kiwixmobile.network.KiwixService;
|
||||||
import org.kiwix.kiwixmobile.network.UserAgentInterceptor;
|
import org.kiwix.kiwixmobile.network.UserAgentInterceptor;
|
||||||
|
|
||||||
@Module public class NetworkModule {
|
@Module public class NetworkModule {
|
||||||
|
|
||||||
public static String KIWIX_DOWNLOAD_URL = BuildConfig.KIWIX_DOWNLOAD_URL; //"http://download.kiwix.org/";
|
public static String KIWIX_DOWNLOAD_URL = BuildConfig.KIWIX_DOWNLOAD_URL;
|
||||||
|
//"http://download.kiwix.org/";
|
||||||
private final static String useragent = "kiwix-android-version:" + BuildConfig.VERSION_CODE;
|
private final static String useragent = "kiwix-android-version:" + BuildConfig.VERSION_CODE;
|
||||||
|
|
||||||
@Provides @Singleton OkHttpClient provideOkHttpClient() {
|
@Provides @Singleton OkHttpClient provideOkHttpClient() {
|
||||||
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
|
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
|
||||||
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
|
logging.setLevel(BuildConfig.DEBUG ? Level.BODY : Level.BASIC);
|
||||||
|
|
||||||
return new OkHttpClient().newBuilder().followRedirects(true).followSslRedirects(true)
|
return new OkHttpClient().newBuilder().followRedirects(true).followSslRedirects(true)
|
||||||
.connectTimeout(10, TimeUnit.SECONDS)
|
.connectTimeout(10, TimeUnit.SECONDS)
|
||||||
.readTimeout(10, TimeUnit.SECONDS)
|
.readTimeout(20, TimeUnit.SECONDS)
|
||||||
.addNetworkInterceptor(logging)
|
.addNetworkInterceptor(logging)
|
||||||
.addNetworkInterceptor(new UserAgentInterceptor(useragent)).build();
|
.addNetworkInterceptor(new UserAgentInterceptor(useragent)).build();
|
||||||
}
|
}
|
||||||
@ -53,5 +55,4 @@ import org.kiwix.kiwixmobile.network.UserAgentInterceptor;
|
|||||||
ConnectivityManager provideConnectivityManager(Context context) {
|
ConnectivityManager provideConnectivityManager(Context context) {
|
||||||
return (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
return (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
6
app/src/main/res/xml/network_security_config.xml
Normal file
6
app/src/main/res/xml/network_security_config.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<network-security-config>
|
||||||
|
<domain-config cleartextTrafficPermitted="true">
|
||||||
|
<domain includeSubdomains="true">kiwix.org</domain>
|
||||||
|
</domain-config>
|
||||||
|
</network-security-config>
|
Loading…
x
Reference in New Issue
Block a user