Skip to content

Commit

Permalink
2019-04-12 21:30
Browse files Browse the repository at this point in the history
Bug fix
V1.1.3
  • Loading branch information
Aryan-mor committed Apr 12, 2019
1 parent f444f86 commit f769ccf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BaseApp : Application() {
retrofitClient =
RetrofitClient.instance.setBaseUrl("http://192.168.1.2/test/")
.setUrl("mili","http://7468e347.ngrok.io/api/")
.setConnectionTimeout(15)
.setConnectionTimeout(4)
.enableCaching(this)
.setReadingTimeout(15)
.addHeader("Accept", "application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,19 @@ class MainActivity : AppCompatActivity() {

override fun onError(response: Response<T3>?) {
super.onError(response)
Log.e("Error", ":DDD errrrror -> onError")
}

override fun onFailed(e: Throwable?) {
super.onFailed(e)
Log.e("Error", ":DDD errrrror -> ${e!!.message}")
}

override fun onComplete() {
super.onComplete()

Log.e("Ari","onComplete :DDDDDDDDDDDDDDDDDD")
}
})
.run(this)
}
Expand Down
2 changes: 1 addition & 1 deletion retrofithelper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdkVersion 14
targetSdkVersion 28
versionCode 2
versionName "1.1.1"
versionName "1.1.3"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gcorp.retrofithelper

import android.util.Log


open class RequestHandler<T> : RequestInterface<T> {
override fun onBeforeSend() {
Expand All @@ -8,17 +10,20 @@ open class RequestHandler<T> : RequestInterface<T> {

override fun onSuccess(response: Response<T>) {
super.onSuccess(response)
}

override fun onComplete() {
super.onComplete()
onComplete()
}

override fun onError(response: Response<T>?) {
super.onError(response)
onComplete()
}

override fun onFailed(e: Throwable?) {
super.onFailed(e)
onComplete()
}

override fun onComplete() {
super.onComplete()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -641,21 +641,20 @@ open class RetrofitClient {

val res = Response(t, classOfT)

if (t.code() != 200) {
if (t.code() != 202) {
requestHandler?.onError(res)
return
}
requestHandler?.onSuccess(res)

}

override fun onCompleted() {
requestHandler?.onComplete()
}

override fun onError(e: Throwable?) {
requestHandler?.onFailed(e)
e?.printStackTrace()
requestHandler?.onFailed(e)

}
}

Expand Down

0 comments on commit f769ccf

Please sign in to comment.