Pārlūkot izejas kodu

Updated libraries versions

Vadik Sirekanyan 7 gadi atpakaļ
vecāks
revīzija
f74471941a

+ 23 - 22
app/build.gradle.kts

@@ -34,20 +34,6 @@ android {
             applicationIdSuffix = ".debug"
         }
     }
-    task("updateReadme") {
-        dependsOn("assembleRelease")
-        doLast {
-            val releaseVariant = applicationVariants.first { it.name == "release" }
-            val releaseFiles = releaseVariant.outputs.map { it.outputFile }
-            val apkFile = releaseFiles.single { it.exists() && it.extension == "apk" }
-            val apkSize = "%.2f".format(apkFile.length().toFloat() / 1024 / 1024)
-            rootProject.file("README.md").printWriter().use { readme ->
-                rootProject.file("readme.md").forEachLine { line ->
-                    readme.appendln(line.replace("{{apkSize}}", apkSize))
-                }
-            }
-        }
-    }
 }
 
 dependencies {
@@ -61,18 +47,33 @@ dependencies {
     implementation("com.android.support.constraint:constraint-layout:1.1.3")
 
     // rxjava
-    implementation("io.reactivex.rxjava2:rxjava:2.1.11")
-    implementation("io.reactivex.rxjava2:rxkotlin:2.2.0")
-    implementation("io.reactivex.rxjava2:rxandroid:2.0.2")
+    implementation("io.reactivex.rxjava2:rxjava:2.2.2")
+    implementation("io.reactivex.rxjava2:rxkotlin:2.3.0")
+    implementation("io.reactivex.rxjava2:rxandroid:2.1.0")
     implementation("com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar")
 
     // retrofit & okhttp
-    implementation("com.squareup.retrofit2:retrofit:2.3.0")
-    implementation("com.squareup.retrofit2:adapter-rxjava2:2.3.0")
-    implementation("com.squareup.retrofit2:converter-gson:2.3.0")
-    implementation("com.squareup.okhttp3:logging-interceptor:3.9.1")
+    implementation("com.squareup.retrofit2:retrofit:2.4.0")
+    implementation("com.squareup.retrofit2:adapter-rxjava2:2.4.0")
+    implementation("com.squareup.retrofit2:converter-gson:2.4.0")
+    implementation("com.squareup.okhttp3:logging-interceptor:3.11.0")
 
     // etc
-    implementation("com.github.bumptech.glide:glide:4.7.1")
+    implementation("com.github.bumptech.glide:glide:4.8.0")
     implementation(files("libs/ulogin-sdk-v1.1.aar"))
 }
+
+task("updateReadme") {
+    dependsOn("assembleRelease")
+    doLast {
+        val releaseVariant = android.applicationVariants.first { it.name == "release" }
+        val releaseFiles = releaseVariant.outputs.map { it.outputFile }
+        val apkFile = releaseFiles.single { it.exists() && it.extension == "apk" }
+        val apkSize = "%.2f".format(apkFile.length().toFloat() / 1024 / 1024)
+        rootProject.file("README.md").printWriter().use { readme ->
+            rootProject.file("readme.md").forEachLine { line ->
+                readme.appendln(line.replace("{{apkSize}}", apkSize))
+            }
+        }
+    }
+}

+ 1 - 2
app/src/main/java/com/sirekanyan/knigopis/common/android/Permissions.kt

@@ -12,8 +12,7 @@ interface Permissions {
 
 }
 
-class PermissionsImpl(private val activity: Activity) :
-    Permissions {
+class PermissionsImpl(private val activity: Activity) : Permissions {
 
     override fun requestReadPhoneState(): Single<Permission> =
         RxPermissions(activity).requestEach(READ_PHONE_STATE).firstOrError()

+ 1 - 2
app/src/main/java/com/sirekanyan/knigopis/common/android/ResourceProvider.kt

@@ -10,8 +10,7 @@ interface ResourceProvider {
 
 }
 
-class ResourceProviderImpl(private val app: Application) :
-    ResourceProvider {
+class ResourceProviderImpl(private val app: Application) : ResourceProvider {
 
     override fun getString(id: Int, vararg args: Any): String =
         app.getString(id, *args)

+ 0 - 2
app/src/main/java/com/sirekanyan/knigopis/feature/user/UserInteractor.kt

@@ -28,12 +28,10 @@ class UserInteractorImpl(
 
     override fun addFriend(userId: String) =
         api.createSubscription(userId)
-            .toCompletable()
             .io2main()
 
     override fun removeFriend(userId: String) =
         api.deleteSubscription(userId)
-            .toCompletable()
             .io2main()
 
     override fun isFriend(userId: String) =

+ 4 - 4
app/src/main/java/com/sirekanyan/knigopis/repository/AuthRepository.kt

@@ -23,15 +23,15 @@ class AuthRepositoryImpl(
 
     override fun authorize(): Completable {
         val token = storage.token
-        return if (token != null && !isAuthorized()) {
+        return if (token == null || isAuthorized()) {
+            Completable.complete()
+        } else {
             api.getCredentials(token)
                 .io2main()
                 .doOnSuccess {
                     storage.accessToken = it.accessToken
                 }
-                .toCompletable()
-        } else {
-            Completable.complete()
+                .ignoreElement()
         }
     }
 

+ 2 - 2
app/src/main/java/com/sirekanyan/knigopis/repository/Endpoint.kt

@@ -53,9 +53,9 @@ interface Endpoint {
     fun updateProfile(@Path("id") userId: String, @Body profile: Profile): Completable
 
     @POST("subscriptions/{subUserId}")
-    fun createSubscription(@Path("subUserId") userId: String): Single<Any>
+    fun createSubscription(@Path("subUserId") userId: String): Completable
 
     @DELETE("subscriptions/{subUserId}")
-    fun deleteSubscription(@Path("subUserId") userId: String): Single<Any>
+    fun deleteSubscription(@Path("subUserId") userId: String): Completable
 
 }

+ 0 - 4
build.gradle.kts

@@ -12,11 +12,7 @@ buildscript {
 allprojects {
     repositories {
         jcenter()
-        mavenCentral()
         google()
-        flatDir {
-            dirs("libs")
-        }
     }
 }