diff --git a/.gradle/4.8.1/fileHashes/fileHashes.bin b/.gradle/4.8.1/fileHashes/fileHashes.bin
index 0aeda4b..b328c9b 100644
Binary files a/.gradle/4.8.1/fileHashes/fileHashes.bin and b/.gradle/4.8.1/fileHashes/fileHashes.bin differ
diff --git a/.gradle/4.8.1/fileHashes/fileHashes.lock b/.gradle/4.8.1/fileHashes/fileHashes.lock
index 9cb797d..50916e2 100644
Binary files a/.gradle/4.8.1/fileHashes/fileHashes.lock and b/.gradle/4.8.1/fileHashes/fileHashes.lock differ
diff --git a/.gradle/4.8.1/fileHashes/resourceHashesCache.bin b/.gradle/4.8.1/fileHashes/resourceHashesCache.bin
index 5284acd..a499663 100644
Binary files a/.gradle/4.8.1/fileHashes/resourceHashesCache.bin and b/.gradle/4.8.1/fileHashes/resourceHashesCache.bin differ
diff --git a/.gradle/4.8.1/javaCompile/classAnalysis.bin b/.gradle/4.8.1/javaCompile/classAnalysis.bin
index e455fe0..f4d7c83 100644
Binary files a/.gradle/4.8.1/javaCompile/classAnalysis.bin and b/.gradle/4.8.1/javaCompile/classAnalysis.bin differ
diff --git a/.gradle/4.8.1/javaCompile/jarAnalysis.bin b/.gradle/4.8.1/javaCompile/jarAnalysis.bin
index b73fde3..1e08327 100644
Binary files a/.gradle/4.8.1/javaCompile/jarAnalysis.bin and b/.gradle/4.8.1/javaCompile/jarAnalysis.bin differ
diff --git a/.gradle/4.8.1/javaCompile/javaCompile.lock b/.gradle/4.8.1/javaCompile/javaCompile.lock
index 5d41ec2..83b5918 100644
Binary files a/.gradle/4.8.1/javaCompile/javaCompile.lock and b/.gradle/4.8.1/javaCompile/javaCompile.lock differ
diff --git a/.gradle/4.8.1/javaCompile/taskHistory.bin b/.gradle/4.8.1/javaCompile/taskHistory.bin
index 3c07029..3e9c0cd 100644
Binary files a/.gradle/4.8.1/javaCompile/taskHistory.bin and b/.gradle/4.8.1/javaCompile/taskHistory.bin differ
diff --git a/.gradle/4.8.1/javaCompile/taskJars.bin b/.gradle/4.8.1/javaCompile/taskJars.bin
index 651b4ef..17a4645 100644
Binary files a/.gradle/4.8.1/javaCompile/taskJars.bin and b/.gradle/4.8.1/javaCompile/taskJars.bin differ
diff --git a/.gradle/4.8.1/taskHistory/taskHistory.bin b/.gradle/4.8.1/taskHistory/taskHistory.bin
index 3aad168..cd960db 100644
Binary files a/.gradle/4.8.1/taskHistory/taskHistory.bin and b/.gradle/4.8.1/taskHistory/taskHistory.bin differ
diff --git a/.gradle/4.8.1/taskHistory/taskHistory.lock b/.gradle/4.8.1/taskHistory/taskHistory.lock
index 7f74c2d..1e0b732 100644
Binary files a/.gradle/4.8.1/taskHistory/taskHistory.lock and b/.gradle/4.8.1/taskHistory/taskHistory.lock differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index 7cc639f..fefe09e 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin
index 483285b..1e15cf6 100644
Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index aa42a01..a70de40 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_alpha08_aar.xml b/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_alpha08_aar.xml
new file mode 100644
index 0000000..2b39d28
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_alpha08_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0_rc01_jar.xml b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0_rc01_jar.xml
new file mode 100644
index 0000000..a45619a
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0_rc01_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_alpha05_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_alpha05_aar.xml
new file mode 100644
index 0000000..9b5707e
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_1_0_alpha05_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_alpha05_aar.xml b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_alpha05_aar.xml
new file mode 100644
index 0000000..5999569
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_1_0_alpha05_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_beta01_jar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_beta01_jar.xml
new file mode 100644
index 0000000..6fee901
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0_beta01_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml
new file mode 100644
index 0000000..ec3f741
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_arch_core_core_testing_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_arch_core_core_testing_2_0_0_aar.xml
new file mode 100644
index 0000000..69f1a9e
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_arch_core_core_testing_2_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml
new file mode 100644
index 0000000..36ebe95
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml
new file mode 100644
index 0000000..5effbe2
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_collection_collection_1_1_0_rc01_jar.xml b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0_rc01_jar.xml
new file mode 100644
index 0000000..43b2c44
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_collection_collection_1_1_0_rc01_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_concurrent_concurrent_futures_1_0_0_beta01_jar.xml b/.idea/libraries/Gradle__androidx_concurrent_concurrent_futures_1_0_0_beta01_jar.xml
new file mode 100644
index 0000000..713f65a
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_concurrent_concurrent_futures_1_0_0_beta01_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_alpha01_aar.xml b/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_alpha01_aar.xml
new file mode 100644
index 0000000..168c30c
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_alpha01_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_core_core_1_1_0_beta01_aar.xml b/.idea/libraries/Gradle__androidx_core_core_1_1_0_beta01_aar.xml
new file mode 100644
index 0000000..7940a9a
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_core_core_1_1_0_beta01_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml
new file mode 100644
index 0000000..5ee0559
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml
new file mode 100644
index 0000000..0af669f
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml
new file mode 100644
index 0000000..f5909d5
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml
new file mode 100644
index 0000000..96c0382
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_alpha08_aar.xml b/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_alpha08_aar.xml
new file mode 100644
index 0000000..0c6b67c
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_alpha08_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml
new file mode 100644
index 0000000..50f528c
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml
new file mode 100644
index 0000000..646bbc9
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml
new file mode 100644
index 0000000..4dd744c
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0_alpha01_jar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0_alpha01_jar.xml
new file mode 100644
index 0000000..4aae958
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_2_0_alpha01_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml
new file mode 100644
index 0000000..1ed3ad9
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml
new file mode 100644
index 0000000..5fea3e2
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_alpha01_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_alpha01_aar.xml
new file mode 100644
index 0000000..0ebb77d
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_2_0_alpha01_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_alpha01_aar.xml b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_alpha01_aar.xml
new file mode 100644
index 0000000..ec90195
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_2_0_alpha01_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml
new file mode 100644
index 0000000..cdc182f
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml
new file mode 100644
index 0000000..f6a2b9c
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml
new file mode 100644
index 0000000..0471859
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_alpha05_aar.xml b/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_alpha05_aar.xml
new file mode 100644
index 0000000..e0a4225
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_alpha05_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_beta01_aar.xml b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_beta01_aar.xml
new file mode 100644
index 0000000..86e2fce
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_beta01_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml
new file mode 100644
index 0000000..c120e7f
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml
new file mode 100644
index 0000000..df36bfa
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_test_core_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_test_core_1_0_0_aar.xml
new file mode 100644
index 0000000..41118fe
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_test_core_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_test_ext_junit_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_test_ext_junit_1_0_0_aar.xml
new file mode 100644
index 0000000..e8e1ee0
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_test_ext_junit_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_test_monitor_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_test_monitor_1_1_0_aar.xml
new file mode 100644
index 0000000..2ee8755
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_test_monitor_1_1_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_test_rules_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_test_rules_1_1_0_aar.xml
new file mode 100644
index 0000000..c3d4721
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_test_rules_1_1_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_test_runner_1_1_0_aar.xml b/.idea/libraries/Gradle__androidx_test_runner_1_1_0_aar.xml
new file mode 100644
index 0000000..393949f
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_test_runner_1_1_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_transition_transition_1_0_1_aar.xml b/.idea/libraries/Gradle__androidx_transition_transition_1_0_1_aar.xml
new file mode 100644
index 0000000..19aeab7
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_transition_transition_1_0_1_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_beta01_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_beta01_aar.xml
new file mode 100644
index 0000000..4b7b0ae
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_beta01_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_beta01_aar.xml b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_beta01_aar.xml
new file mode 100644
index 0000000..0dc1692
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_beta01_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_beta01_aar.xml b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_beta01_aar.xml
new file mode 100644
index 0000000..6ffc044
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_beta01_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_alpha04_aar.xml b/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_alpha04_aar.xml
new file mode 100644
index 0000000..29358a5
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_alpha04_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml
new file mode 100644
index 0000000..4f349f6
--- /dev/null
+++ b/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_alpha07_aar.xml b/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_alpha07_aar.xml
new file mode 100644
index 0000000..a7beb23
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_material_material_1_1_0_alpha07_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_guava_listenablefuture_1_0_jar.xml b/.idea/libraries/Gradle__com_google_guava_listenablefuture_1_0_jar.xml
new file mode 100644
index 0000000..b37305e
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_guava_listenablefuture_1_0_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_nhaarman_mockitokotlin2_mockito_kotlin_2_0_0_RC3_jar.xml b/.idea/libraries/Gradle__com_nhaarman_mockitokotlin2_mockito_kotlin_2_0_0_RC3_jar.xml
new file mode 100644
index 0000000..b5f5c34
--- /dev/null
+++ b/.idea/libraries/Gradle__com_nhaarman_mockitokotlin2_mockito_kotlin_2_0_0_RC3_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__junit_junit_4_12_jar.xml b/.idea/libraries/Gradle__junit_junit_4_12_jar.xml
new file mode 100644
index 0000000..f4f25a8
--- /dev/null
+++ b/.idea/libraries/Gradle__junit_junit_4_12_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_9_0_jar.xml b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_9_0_jar.xml
new file mode 100644
index 0000000..9cc7eb3
--- /dev/null
+++ b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_9_0_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_9_0_jar.xml b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_9_0_jar.xml
new file mode 100644
index 0000000..79639c0
--- /dev/null
+++ b/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_9_0_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml b/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml
new file mode 100644
index 0000000..5855a29
--- /dev/null
+++ b/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml
new file mode 100644
index 0000000..50cf2b9
--- /dev/null
+++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_50_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_50_jar.xml
new file mode 100644
index 0000000..aea6e3f
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_3_50_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_50_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_50_jar.xml
new file mode 100644
index 0000000..c33ec3e
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_3_50_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_2_1_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_2_1_jar.xml
new file mode 100644
index 0000000..43eea84
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_2_1_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_2_1_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_2_1_jar.xml
new file mode 100644
index 0000000..43ba7cb
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_2_1_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_1_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_1_jar.xml
new file mode 100644
index 0000000..490cbb2
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_1_3_1_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_debug_1_3_1_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_debug_1_3_1_jar.xml
new file mode 100644
index 0000000..23688bb
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_debug_1_3_1_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_test_1_3_1_jar.xml b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_test_1_3_1_jar.xml
new file mode 100644
index 0000000..9c8f77c
--- /dev/null
+++ b/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_test_1_3_1_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_mockito_mockito_core_2_23_0_jar.xml b/.idea/libraries/Gradle__org_mockito_mockito_core_2_23_0_jar.xml
new file mode 100644
index 0000000..3a99e44
--- /dev/null
+++ b/.idea/libraries/Gradle__org_mockito_mockito_core_2_23_0_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_objenesis_objenesis_2_6_jar.xml b/.idea/libraries/Gradle__org_objenesis_objenesis_2_6_jar.xml
new file mode 100644
index 0000000..c6fc69c
--- /dev/null
+++ b/.idea/libraries/Gradle__org_objenesis_objenesis_2_6_jar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/remote/build.gradle b/remote/build.gradle
index ccc50c9..1c9c16d 100644
--- a/remote/build.gradle
+++ b/remote/build.gradle
@@ -44,7 +44,7 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
- rootProject.retrofitModule.each {
+ rootProject.coreRemote.each {
add(it.configuration, it.dependency, it.options)
}
}
diff --git a/remote/remote.iml b/remote/remote.iml
index f6ad7e4..c73f428 100644
--- a/remote/remote.iml
+++ b/remote/remote.iml
@@ -28,7 +28,7 @@
-
+
@@ -130,6 +130,7 @@
+
@@ -142,6 +143,7 @@
+
@@ -150,57 +152,74 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/remote/src/androidTest/java/com/vrgsoft/retrofit/ExampleInstrumentedTest.java b/remote/src/androidTest/java/com/vrgsoft/retrofit/ExampleInstrumentedTest.java
deleted file mode 100644
index 5cfdc5c..0000000
--- a/remote/src/androidTest/java/com/vrgsoft/retrofit/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.vrgsoft.retrofit;
-
-import android.content.Context;
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.vrgsoft.retrofit.test", appContext.getPackageName());
- }
-}
diff --git a/remote/src/main/AndroidManifest.xml b/remote/src/main/AndroidManifest.xml
index bf1669d..0abfce0 100644
--- a/remote/src/main/AndroidManifest.xml
+++ b/remote/src/main/AndroidManifest.xml
@@ -1,2 +1,2 @@
+ package="com.vrgsoft.remote"/>
diff --git a/remote/src/main/java/com/vrgsoft/remote/BaseRepository.kt b/remote/src/main/java/com/vrgsoft/remote/BaseRepository.kt
new file mode 100644
index 0000000..10cc84d
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/BaseRepository.kt
@@ -0,0 +1,50 @@
+package com.vrgsoft.remote
+
+import androidx.annotation.VisibleForTesting
+import com.vrgsoft.remote.error.ConnectionError
+import com.vrgsoft.remote.error.NetworkError
+import com.vrgsoft.remote.result.BaseResult
+import com.vrgsoft.remote.result.ErrorResult
+import com.vrgsoft.remote.result.SuccessResult
+import kotlinx.coroutines.Deferred
+import retrofit2.Response
+
+abstract class BaseRepository {
+ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+ suspend fun execute(call: (() -> Deferred>)): BaseResult {
+ try {
+ val result = call.invoke().await()
+
+ return if (result.isSuccessful) {
+ SuccessResult(result.body()!!)
+ } else {
+ ErrorResult(
+ NetworkError(
+ result.code(),
+ result.message()
+ )
+ )
+ }
+ } catch (e: Exception) {
+ return ErrorResult(ConnectionError())
+ }
+ }
+
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ fun SuccessResult.transform(mapper: ((item: T) -> M)): SuccessResult {
+ return SuccessResult(
+ mapper.invoke(this.data)
+ )
+ }
+
+ @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+ fun BaseResult.transformIsSuccess(mapper: ((item: T) -> M)): BaseResult {
+ return if (this is SuccessResult<*>) {
+ (this as SuccessResult).transform(mapper)
+ } else {
+ ErrorResult(
+ (this as ErrorResult).error
+ )
+ }
+ }
+}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/Extentions.kt b/remote/src/main/java/com/vrgsoft/remote/Extentions.kt
new file mode 100644
index 0000000..c187e7f
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/Extentions.kt
@@ -0,0 +1,20 @@
+package com.vrgsoft.remote
+
+import com.vrgsoft.remote.result.BaseResult
+import com.vrgsoft.remote.result.SuccessResult
+
+fun BaseResult.mapDataIfSuccess(mapper: ((item: T) -> M)): M? {
+ if (this !is SuccessResult) {
+ return null
+ }
+
+ return mapper.invoke(this.data)
+}
+
+fun BaseResult.getDataIfSuccess(): T? {
+ if (this !is SuccessResult) {
+ return null
+ }
+
+ return this.data
+}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/error/BaseError.kt b/remote/src/main/java/com/vrgsoft/remote/error/BaseError.kt
new file mode 100644
index 0000000..8c4e111
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/error/BaseError.kt
@@ -0,0 +1,3 @@
+package com.vrgsoft.remote.error
+
+abstract class BaseError
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/error/ConnectionError.kt b/remote/src/main/java/com/vrgsoft/remote/error/ConnectionError.kt
new file mode 100644
index 0000000..4c7d820
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/error/ConnectionError.kt
@@ -0,0 +1,3 @@
+package com.vrgsoft.remote.error
+
+class ConnectionError : BaseError()
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/error/NetworkError.kt b/remote/src/main/java/com/vrgsoft/remote/error/NetworkError.kt
new file mode 100644
index 0000000..bf487b6
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/error/NetworkError.kt
@@ -0,0 +1,6 @@
+package com.vrgsoft.remote.error
+
+class NetworkError(
+ val code: Int,
+ val message: String
+) : BaseError()
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/result/BaseResult.kt b/remote/src/main/java/com/vrgsoft/remote/result/BaseResult.kt
new file mode 100644
index 0000000..03b2d52
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/result/BaseResult.kt
@@ -0,0 +1,3 @@
+package com.vrgsoft.remote.result
+
+abstract class BaseResult
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/result/ErrorResult.kt b/remote/src/main/java/com/vrgsoft/remote/result/ErrorResult.kt
new file mode 100644
index 0000000..44099be
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/result/ErrorResult.kt
@@ -0,0 +1,7 @@
+package com.vrgsoft.remote.result
+
+import com.vrgsoft.remote.error.BaseError
+
+class ErrorResult(
+ val error: BaseError
+) : BaseResult()
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/remote/result/SuccessResult.kt b/remote/src/main/java/com/vrgsoft/remote/result/SuccessResult.kt
new file mode 100644
index 0000000..b09bd4f
--- /dev/null
+++ b/remote/src/main/java/com/vrgsoft/remote/result/SuccessResult.kt
@@ -0,0 +1,5 @@
+package com.vrgsoft.remote.result
+
+class SuccessResult(
+ val data: T
+) : BaseResult()
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/retrofit/RetrofitModule.kt b/remote/src/main/java/com/vrgsoft/retrofit/RetrofitModule.kt
deleted file mode 100644
index 6f64d45..0000000
--- a/remote/src/main/java/com/vrgsoft/retrofit/RetrofitModule.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.vrgsoft.retrofit
-
-import android.content.Context
-import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
-import com.vrgsoft.retrofit.common.AuthInterceptor
-import com.vrgsoft.retrofit.common.HeaderInterceptor
-import com.vrgsoft.retrofit.common.RetrofitConfig
-import okhttp3.Cache
-import okhttp3.OkHttpClient
-import okhttp3.logging.HttpLoggingInterceptor
-import org.kodein.di.Kodein
-import org.kodein.di.generic.bind
-import org.kodein.di.generic.instance
-import org.kodein.di.generic.provider
-import org.kodein.di.generic.singleton
-import retrofit2.Retrofit
-import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
-import retrofit2.converter.gson.GsonConverterFactory
-import retrofit2.converter.scalars.ScalarsConverterFactory
-import java.util.concurrent.TimeUnit
-
-object RetrofitModule {
- fun get() = Kodein.Module("RetrofitModule") {
- bind() with singleton {
- Retrofit.Builder()
- .baseUrl(RetrofitConfig.baseUrl)
- .addConverterFactory(ScalarsConverterFactory.create())
- .addConverterFactory(GsonConverterFactory.create())
- .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
- .addCallAdapterFactory(CoroutineCallAdapterFactory())
- .client(instance())
- .build()
- }
-
- bind() with singleton {
- val builder = OkHttpClient.Builder()
-
- builder.cache(instance())
-
- if (BuildConfig.DEBUG) {
- val loggingInterceptor = HttpLoggingInterceptor()
- loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
- builder.addInterceptor(loggingInterceptor)
- }
-
- builder.connectTimeout(100, TimeUnit.SECONDS)
- builder.retryOnConnectionFailure(true)
- builder.addInterceptor(instance())
- builder.addInterceptor(HeaderInterceptor())
- builder.build()
- }
-
- bind() from provider {
- val cacheSize = 10 * 1024 * 1024 // 10 MB
- Cache(instance().cacheDir, cacheSize.toLong())
- }
-
- bind() with singleton { AuthInterceptor(RetrofitConfig.auth) }
- }
-}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/retrofit/common/Auth.kt b/remote/src/main/java/com/vrgsoft/retrofit/common/Auth.kt
deleted file mode 100644
index 2f93d82..0000000
--- a/remote/src/main/java/com/vrgsoft/retrofit/common/Auth.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import okhttp3.Interceptor
-import okhttp3.Response
-
-interface Auth {
- fun process(chain: Interceptor.Chain?): Response
-}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/retrofit/common/AuthCustomInterceptor.kt b/remote/src/main/java/com/vrgsoft/retrofit/common/AuthCustomInterceptor.kt
deleted file mode 100644
index d2c0ca6..0000000
--- a/remote/src/main/java/com/vrgsoft/retrofit/common/AuthCustomInterceptor.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import android.accounts.AccountManager
-import okhttp3.Interceptor
-import okhttp3.Response
-
-class AuthCustomInterceptor(
- private val manager: AccountManager,
- private val packageName: String
-) : Auth {
-
- override fun process(chain: Interceptor.Chain?): Response {
- val accounts = manager.getAccountsByType(packageName)
- val builder = chain!!.request()!!.newBuilder()
-
- if (accounts.isNotEmpty()) {
- val account = accounts[0]
- val token = manager.blockingGetAuthToken(account, "Bearer", false)
-
- if (token?.isNotEmpty() == true) {
- builder?.addHeader(HEADER_AUTHORIZATION, "Bearer $token")
- }
- }
-
- return chain.proceed(builder.build())
- }
-
- companion object {
- private const val HEADER_AUTHORIZATION = "Authorization"
- }
-}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/retrofit/common/AuthInterceptor.kt b/remote/src/main/java/com/vrgsoft/retrofit/common/AuthInterceptor.kt
deleted file mode 100644
index 23a40a0..0000000
--- a/remote/src/main/java/com/vrgsoft/retrofit/common/AuthInterceptor.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import okhttp3.Interceptor
-import okhttp3.Response
-
-class AuthInterceptor(
- private val auth: Auth? = null
-) : Interceptor {
- override fun intercept(chain: Interceptor.Chain?): Response {
- return auth?.process(chain) ?: chain!!.request()!!.newBuilder()?.let {
- chain.proceed(it.build())
- }!!
- }
-}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/retrofit/common/HeaderInterceptor.kt b/remote/src/main/java/com/vrgsoft/retrofit/common/HeaderInterceptor.kt
deleted file mode 100644
index ebd0f6f..0000000
--- a/remote/src/main/java/com/vrgsoft/retrofit/common/HeaderInterceptor.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import okhttp3.Interceptor
-import okhttp3.Response
-
-class HeaderInterceptor : Interceptor {
- override fun intercept(chain: Interceptor.Chain?): Response {
- val builder = chain!!.request()!!.newBuilder()
-
- return chain.proceed(builder.build())
- }
-}
\ No newline at end of file
diff --git a/remote/src/main/java/com/vrgsoft/retrofit/common/RetrofitConfig.kt b/remote/src/main/java/com/vrgsoft/retrofit/common/RetrofitConfig.kt
deleted file mode 100644
index 5e71034..0000000
--- a/remote/src/main/java/com/vrgsoft/retrofit/common/RetrofitConfig.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-object RetrofitConfig {
- lateinit var baseUrl: String
- lateinit var auth: Auth
-}
\ No newline at end of file
diff --git a/remote/src/main/res/values/strings.xml b/remote/src/main/res/values/strings.xml
index 183cc99..36875bf 100644
--- a/remote/src/main/res/values/strings.xml
+++ b/remote/src/main/res/values/strings.xml
@@ -1,3 +1,3 @@
- Retrofit
+ Core Remote
diff --git a/remote/src/test/java/com/vrgsoft/remote/BaseRepositoryTest.kt b/remote/src/test/java/com/vrgsoft/remote/BaseRepositoryTest.kt
new file mode 100644
index 0000000..3bf81f6
--- /dev/null
+++ b/remote/src/test/java/com/vrgsoft/remote/BaseRepositoryTest.kt
@@ -0,0 +1,154 @@
+package com.vrgsoft.remote
+
+import com.nhaarman.mockitokotlin2.doReturn
+import com.nhaarman.mockitokotlin2.mock
+import com.vrgsoft.remote.error.ConnectionError
+import com.vrgsoft.remote.error.NetworkError
+import com.vrgsoft.remote.result.ErrorResult
+import com.vrgsoft.remote.result.SuccessResult
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.async
+import kotlinx.coroutines.test.runBlockingTest
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import retrofit2.Response
+
+@ExperimentalCoroutinesApi
+internal class BaseRepositoryTest {
+ lateinit var repository: BaseRepository
+ lateinit var api: TestApi
+
+ private var isSuccess = true
+
+ fun setUp() {
+ repository = TestRepository()
+
+ val response = mock> {
+ on { isSuccessful } doReturn isSuccess
+ on { body() } doReturn "1"
+ on { code() } doReturn 401
+ on { message() } doReturn "Unauthorized"
+ }
+
+ api = mock {
+ on { call() } doReturn response.toDeferred()
+ }
+ }
+
+ @Test
+ fun transform() {
+ setUp()
+ val result = SuccessResult("1")
+
+ val transformed = with(repository) {
+ result.transform { it.toInt() }
+ }
+
+ assertEquals(1, transformed.data)
+ }
+
+ @Test
+ fun transformIsSuccess() {
+ setUp()
+ val result = SuccessResult("1")
+
+ val transformed = with(repository) {
+ result.transformIsSuccess { it.toInt() }
+ }
+
+ require(transformed is SuccessResult)
+ assertEquals(1, transformed.data)
+ }
+
+ @Test
+ fun transformIsConnectionError() {
+ setUp()
+ val result = ErrorResult(ConnectionError())
+
+ val transformed = with(repository) {
+ result.transformIsSuccess { it.toInt() }
+ }
+
+ require(transformed is ErrorResult)
+ require(transformed.error is ConnectionError)
+ }
+
+ @Test
+ fun transformIsNetworkError() {
+ setUp()
+ val code = 401
+ val message = "Unauthorized"
+ val result = ErrorResult(NetworkError(code, message))
+
+ val transformed = with(repository) {
+ result.transformIsSuccess { it.toInt() }
+ }
+
+ require(transformed is ErrorResult)
+
+ with(transformed) {
+ require(error is NetworkError)
+ assertEquals(code, (error as NetworkError).code)
+ assertEquals(message, (error as NetworkError).message)
+ }
+ }
+
+ @Test
+ fun executeSuccess() {
+ isSuccess = true
+ setUp()
+ val data = "1"
+
+ runBlockingTest {
+ val transformed = with(repository) {
+ execute { api.call() }
+ }
+
+ require(transformed is SuccessResult)
+ assertEquals(data, transformed.data)
+ }
+ }
+
+ @Test
+ fun executeError() {
+ isSuccess = false
+ setUp()
+ val code = 401
+ val message = "Unauthorized"
+
+ runBlockingTest {
+ val transformed = with(repository) {
+ execute { api.call() }
+ }
+
+ require(transformed is ErrorResult)
+ require(transformed.error is NetworkError)
+
+ with(transformed.error as NetworkError) {
+ assertEquals(code, this.code)
+ assertEquals(message, this.message)
+ }
+ }
+ }
+
+ @Test
+ fun executeThrow() {
+ isSuccess = true
+ setUp()
+
+ runBlockingTest {
+ val transformed = with(repository) {
+ execute {
+ throw IllegalArgumentException()
+ api.call()
+ }
+ }
+
+ require(transformed is ErrorResult)
+ require(transformed.error is ConnectionError)
+ }
+ }
+
+ fun T.toDeferred() = GlobalScope.async { this@toDeferred }
+}
\ No newline at end of file
diff --git a/remote/src/test/java/com/vrgsoft/remote/TestApi.kt b/remote/src/test/java/com/vrgsoft/remote/TestApi.kt
new file mode 100644
index 0000000..ce951ad
--- /dev/null
+++ b/remote/src/test/java/com/vrgsoft/remote/TestApi.kt
@@ -0,0 +1,8 @@
+package com.vrgsoft.remote
+
+import kotlinx.coroutines.Deferred
+import retrofit2.Response
+
+interface TestApi {
+ fun call(): Deferred>
+}
\ No newline at end of file
diff --git a/remote/src/test/java/com/vrgsoft/remote/TestRepository.kt b/remote/src/test/java/com/vrgsoft/remote/TestRepository.kt
new file mode 100644
index 0000000..ecdfd8f
--- /dev/null
+++ b/remote/src/test/java/com/vrgsoft/remote/TestRepository.kt
@@ -0,0 +1,3 @@
+package com.vrgsoft.remote
+
+class TestRepository : BaseRepository()
\ No newline at end of file
diff --git a/remote/src/test/java/com/vrgsoft/retrofit/ExampleUnitTest.java b/remote/src/test/java/com/vrgsoft/retrofit/ExampleUnitTest.java
deleted file mode 100644
index 80fc59a..0000000
--- a/remote/src/test/java/com/vrgsoft/retrofit/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.vrgsoft.retrofit;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/remote/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/remote/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
new file mode 100644
index 0000000..1f0955d
--- /dev/null
+++ b/remote/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
@@ -0,0 +1 @@
+mock-maker-inline
diff --git a/retrofit/retrofit.iml b/retrofit/retrofit.iml
index 2ba1e1e..5157c8f 100644
--- a/retrofit/retrofit.iml
+++ b/retrofit/retrofit.iml
@@ -130,6 +130,7 @@
+
diff --git a/retrofit/src/main/java/com/vrgsoft/retrofit/common/AuthCustomInterceptor.kt b/retrofit/src/main/java/com/vrgsoft/retrofit/common/AuthCustomInterceptor.kt
deleted file mode 100644
index d2c0ca6..0000000
--- a/retrofit/src/main/java/com/vrgsoft/retrofit/common/AuthCustomInterceptor.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.vrgsoft.retrofit.common
-
-import android.accounts.AccountManager
-import okhttp3.Interceptor
-import okhttp3.Response
-
-class AuthCustomInterceptor(
- private val manager: AccountManager,
- private val packageName: String
-) : Auth {
-
- override fun process(chain: Interceptor.Chain?): Response {
- val accounts = manager.getAccountsByType(packageName)
- val builder = chain!!.request()!!.newBuilder()
-
- if (accounts.isNotEmpty()) {
- val account = accounts[0]
- val token = manager.blockingGetAuthToken(account, "Bearer", false)
-
- if (token?.isNotEmpty() == true) {
- builder?.addHeader(HEADER_AUTHORIZATION, "Bearer $token")
- }
- }
-
- return chain.proceed(builder.build())
- }
-
- companion object {
- private const val HEADER_AUTHORIZATION = "Authorization"
- }
-}
\ No newline at end of file