mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-04 03:06:41 -04:00
Added two build variants to help us control the scope of our testing of
network operations. This is the initial skeleton that proves the approach can work. Future work will enable us to control whether to fully mock network operatins, have a local download server, or use the public kiwix download server.
This commit is contained in:
parent
aced181a3e
commit
e28a04542f
@ -162,14 +162,26 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
// Main build type for debugging
|
||||
debug {
|
||||
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://download.kiwix.org/\""
|
||||
// True breaks local variables being shown in breakpoints
|
||||
testCoverageEnabled false
|
||||
// Needed for instrumentation tests on Pre 5.0
|
||||
multiDexKeepProguard file('multidex-instrumentation-config.pro')
|
||||
}
|
||||
|
||||
mock_network {
|
||||
initWith(buildTypes.debug)
|
||||
// TODO add DI for the mock network
|
||||
}
|
||||
|
||||
local_download_server {
|
||||
initWith(buildTypes.debug)
|
||||
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://192.168.1.55/\""
|
||||
}
|
||||
|
||||
// Used to assess code coverage
|
||||
coverage {
|
||||
initWith debug
|
||||
@ -178,8 +190,9 @@ android {
|
||||
|
||||
// Release Type
|
||||
release {
|
||||
|
||||
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://download.kiwix.org/\""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
|
@ -15,7 +15,7 @@ import okhttp3.OkHttpClient;
|
||||
|
||||
@Module public class NetworkModule {
|
||||
|
||||
public static String 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;
|
||||
|
||||
@Provides @Singleton OkHttpClient provideOkHttpClient() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.kiwix.kiwixmobile.zim_manager.library_view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import org.kiwix.kiwixmobile.base.BasePresenter;
|
||||
import org.kiwix.kiwixmobile.database.BookDao;
|
||||
@ -33,6 +34,7 @@ public class LibraryPresenter extends BasePresenter<LibraryViewCallback> {
|
||||
.subscribe(library -> {
|
||||
getMvpView().showBooks(library.getBooks());
|
||||
}, error -> {
|
||||
Log.w("kiwixLibrary", error.getLocalizedMessage());
|
||||
getMvpView().displayNoNetworkConnection();
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user