Skip to content

Commit

Permalink
Merge pull request #63 from ihsanbal/release/3.0
Browse files Browse the repository at this point in the history
Release/3.0
  • Loading branch information
ihsan BAL authored Mar 1, 2020
2 parents e56c101 + fc38e11 commit c55f998
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 153 deletions.
18 changes: 11 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
language: android
dist: trusty

android:
components:
- tools
- platform-tools
- build-tools-27.0.3
- android-27
- build-tools-29.0.3
- android-29
- extra-android-m2repository
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'

jdk:
- oraclejdk8

notifications:
email: false

sudo: false

before_install:
- chmod +x gradlew
- yes | sdkmanager "platforms;android-28"

script:
- ./gradlew assembleDebug
- ./gradlew assembleDebug

after_script:
- ./gradlew testReleaseUnitTest
- ./gradlew testReleaseUnitTest

branches:
only:
- master
- development
- fix
- release/3.0

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dependencies {
implementation(project(':lib')) {
exclude group: 'org.json', module: 'json'
}
// implementation('com.github.ihsanbal:LoggingInterceptor:3.0.0') {
// implementation('com.github.ihsanbal:LoggingInterceptor:3.1.0-rc1') {
// exclude group: 'org.json', module: 'json'
// }
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package ihsanbal.com.logginginterceptor.di

import android.content.res.AssetManager
import android.util.Log
import android.util.Log.INFO
import com.ihsanbal.logging.BufferListener
import com.ihsanbal.logging.Level
import com.ihsanbal.logging.Logger
import com.ihsanbal.logging.LoggingInterceptor
import dagger.Module
import dagger.Provides
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ buildscript {
ext.rxjavaVersion = '1.0.10'
ext.rxAndroidVersion = '1.0.1'
ext.daggerVersion = '2.8'
ext.supportVersion = '26.1.0'
ext.supportVersion = '29.0.3'
ext.leakCanaryVersion = '1.5'

repositories {
mavenLocal()
jcenter()
google()
}
Expand All @@ -27,7 +28,7 @@ buildscript {
project.ext {
groupId = 'com.github.ihsanbal'
artifactId = 'LoggingInterceptor'
snapshot = '3.0.0-SNAPSHOT'
snapshot = '3.1.0-rc1'
}

allprojects {
Expand Down
12 changes: 0 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,5 @@ org.gradle.jvmargs=-Xmx1536m
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
VERSION_NAME=1.0.4
VERSION_CODE=1
GROUP=com.ihsanbal.logging
POM_DESCRIPTION=An OkHttp interceptor which pretty logs request and response data.
POM_URL=https://github.com/ihsanbal/LoggingInterceptor
POM_SCM_URL=https://github.com/ihsanbal/LoggingInterceptor
POM_SCM_CONNECTION=scm:git@github.com:ihsanbal/LoggingInterceptor.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:ihsanbal/LoggingInterceptor.git
POM_LICENCE_NAME=MIT
POM_LICENCE_URL=https://github.com/ihsanbal/LoggingInterceptor/blob/master/LICENSE
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=ihsanbal
POM_DEVELOPER_NAME=İhsan Bal
android.useAndroidX=true
android.enableJetifier=true
26 changes: 24 additions & 2 deletions lib/src/main/java/com/ihsanbal/logging/Printer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import okhttp3.Headers
import okhttp3.RequestBody
import okhttp3.Response
import okhttp3.internal.http.promisesBody
import okhttp3.logging.isProbablyUtf8
import okio.Buffer
import okio.GzipSource
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
import java.io.EOFException
import java.io.IOException
import java.nio.charset.Charset
import java.nio.charset.StandardCharsets
Expand Down Expand Up @@ -100,7 +100,6 @@ open class Printer protected constructor() {

if (!buffer.isProbablyUtf8()) {
return "End request - binary ${buffer.size}:byte body omitted"
// return response
}

if (contentLength != 0L) {
Expand Down Expand Up @@ -247,4 +246,27 @@ open class Printer protected constructor() {
init {
throw UnsupportedOperationException()
}
}

/**
* @see 'https://github.com/square/okhttp/blob/master/okhttp-logging-interceptor/src/main/java/okhttp3/logging/utf8.kt'
* */
internal fun Buffer.isProbablyUtf8(): Boolean {
try {
val prefix = Buffer()
val byteCount = size.coerceAtMost(64)
copyTo(prefix, 0, byteCount)
for (i in 0 until 16) {
if (prefix.exhausted()) {
break
}
val codePoint = prefix.readUtf8CodePoint()
if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) {
return false
}
}
return true
} catch (_: EOFException) {
return false // Truncated UTF-8 sequence.
}
}
44 changes: 0 additions & 44 deletions lib/src/main/java/okhttp3/logging/utf8.kt

This file was deleted.

0 comments on commit c55f998

Please sign in to comment.