From 91dab58dc28c61f9d4ba0fb458bae32a9dd2a5ae Mon Sep 17 00:00:00 2001 From: Goooler Date: Thu, 25 Mar 2021 20:21:29 +0800 Subject: [PATCH 01/13] Add a shortcut when creating ChuckerInterceptor --- .../com/chuckerteam/chucker/api/Chucker.kt | 21 ++++++++++++++++++ .../chucker/api/ChuckerInterceptor.kt | 5 +++++ .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 9187 bytes 3 files changed, 26 insertions(+) create mode 100644 library/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index bae02c84b..319eeb257 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -2,7 +2,12 @@ package com.chuckerteam.chucker.api import android.content.Context import android.content.Intent +import android.content.pm.ShortcutInfo +import android.content.pm.ShortcutManager +import android.graphics.drawable.Icon +import android.os.Build import android.util.Log +import com.chuckerteam.chucker.R import com.chuckerteam.chucker.internal.support.Logger import com.chuckerteam.chucker.internal.support.NotificationHelper import com.chuckerteam.chucker.internal.ui.MainActivity @@ -30,6 +35,22 @@ public object Chucker { .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } + public fun Context.createShortcut() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { + getSystemService(ShortcutManager::class.java)?.let { + val shortcut = ShortcutInfo.Builder(this, "id1") + .setShortLabel("Open chucker activity") + .setLongLabel("Open chucker activity") + .setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher_round)) + .setIntent(getLaunchIntent(this).setAction(Intent.ACTION_VIEW)) + .build() + val allShortcuts = it.dynamicShortcuts.toMutableList() + allShortcuts.add(shortcut) + it.dynamicShortcuts = allShortcuts + } + } + } + /** * Dismisses all previous Chucker notifications. */ diff --git a/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt b/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt index 6974d489a..2fccc11c1 100755 --- a/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt @@ -2,6 +2,7 @@ package com.chuckerteam.chucker.api import android.content.Context import androidx.annotation.VisibleForTesting +import com.chuckerteam.chucker.api.Chucker.createShortcut import com.chuckerteam.chucker.internal.data.entity.HttpTransaction import com.chuckerteam.chucker.internal.support.CacheDirectoryProvider import com.chuckerteam.chucker.internal.support.PlainTextDecoder @@ -53,6 +54,10 @@ public class ChuckerInterceptor private constructor( decoders, ) + init { + builder.context.createShortcut() + } + /** Adds [headerName] into [headersToRedact] */ public fun redactHeader(vararg headerName: String) { headersToRedact.addAll(headerName) diff --git a/library/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/library/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..ffc5e9d491a2ce869a0dd220a52a9bd07c47ef12 GIT binary patch literal 9187 zcmV<9BOKg`P)u%?ppfML=R4=z$(>;mW}iFvp8GuKNeHvt<$cfh ze#`j|Lj2$dKls59e(-}I{NM*a_`wf;@Pi-T9kPJ7ZWWRFR}vY;Tf^KM%KP9m;IsI_ z4^4v{K)ciu-U(VCAIkT@cPIqmFMNiphhJu0m~p#0F8f6cn*XzbsKHu_L3{;j zY`s~WXT4KsY*@c0ssvv{1tqaBY9JY+UH*x$~v*L=y|^9K8jN8vN! zv&nbBcfohUcXxHzSqXmd!yV8o;Bh<_{yY*jwhYB%t~jq{tJv7`00!r)LPN`^48U^t z!|KN9_OsgAcfJbe0Ox|{S!>ZHmLcRE9S?=XoDBTvcBXd(2>csB)zGp)Y-~NkX5-V{ z029yTRv2mi6iM{v&U|rR>vlYYK97O(L)U<}fnCc0L+GR^p&JAD@X2=J_Lwq7PQw!Uu%d_Lp*QyQ`R-1|#mqgxzf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cl~$LxXT}s(udZlX8lp*8PI2;NS=6=-sh1X zKllZ)ESB7tMHukR1HM7@7-kK|N;$<>N>i3SBhJ`-j`#;kIRz(zi@;~STtVlTZagPV zyz);{R>4xZw{+Hz9z*Uqo%Q>(XOYOB4cGetkVHzTRBa6glh7L_0U?4owCozGV8!1s z5zfObb|Dcg9QcmFhhPGfEzj6=Udmtcyf|dWb)CS+gN8Q;JIwkCs)9Byc>)wFRa*na zH^{=zU?`PEF{7EO&Lc#ayzI|n$;Pw7tQ{ zwYA7(wg;Ir^Tsx@aMfGln8p?X0P*PVi_CUKfc7}eSt`wkgGIGN?iHMCIw2bPUPW^;_h-@i~wge&EDKaBff*qLw#s4OHR~&<|71_KM8u%kD)2yEh#8IwykSEGywt zwN*&BCj-{RicE@5Q2PvHR5R{SBWEQwu@sLk4h6Sdk|)0sbIzPV&UrJ zFguIWuKPeNS${$-+4zZAy7_Z)#wH-m7vy*NTgiqK;`DVNh*Ph52V0ug;Js4*k|(8! zm;V|*Qyej82Yd&}nXuR%MJlk5Rh`#pI9HXt8R`J~bcfkq31=$KEeE~{2|=Xxd@6XP;FS`au&__7T_B^V?t%A)esL2q+Btj3SlNCawGAWV4V&z#( zVhm>QLCUIDzK=}jE;{P30x&IqAch-fA&;urvXFvqed17(uE-&FK^AAA7P|pC2fPoD{|90z&r25PB{%>8002ovPDHLkV1l%ZXyO0> literal 0 HcmV?d00001 From 4635650e8454c5354a861c236d2bed25851a3380 Mon Sep 17 00:00:00 2001 From: Goooler Date: Thu, 25 Mar 2021 20:37:55 +0800 Subject: [PATCH 02/13] Rename ic resource --- .../java/com/chuckerteam/chucker/api/Chucker.kt | 2 +- ...cher_round.png => chucker_ic_launcher_round.png} | Bin 2 files changed, 1 insertion(+), 1 deletion(-) rename library/src/main/res/mipmap-xxxhdpi/{ic_launcher_round.png => chucker_ic_launcher_round.png} (100%) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index 319eeb257..dcd9cc7a2 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -41,7 +41,7 @@ public object Chucker { val shortcut = ShortcutInfo.Builder(this, "id1") .setShortLabel("Open chucker activity") .setLongLabel("Open chucker activity") - .setIcon(Icon.createWithResource(this, R.mipmap.ic_launcher_round)) + .setIcon(Icon.createWithResource(this, R.mipmap.chucker_ic_launcher_round)) .setIntent(getLaunchIntent(this).setAction(Intent.ACTION_VIEW)) .build() val allShortcuts = it.dynamicShortcuts.toMutableList() diff --git a/library/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/library/src/main/res/mipmap-xxxhdpi/chucker_ic_launcher_round.png similarity index 100% rename from library/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to library/src/main/res/mipmap-xxxhdpi/chucker_ic_launcher_round.png From 8a562c6a03fddf67a341b999d925625da7a21add Mon Sep 17 00:00:00 2001 From: Goooler Date: Fri, 26 Mar 2021 09:50:22 +0800 Subject: [PATCH 03/13] Replace hardcode --- .../java/com/chuckerteam/chucker/api/Chucker.kt | 14 +++++++------- library/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index dcd9cc7a2..7d1f5d18b 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -17,6 +17,8 @@ import com.chuckerteam.chucker.internal.ui.MainActivity */ public object Chucker { + private const val SHORTCUT_ID = "shortcutId" + /** * Check if this instance is the operation one or no-op. * @return `true` if this is the operation instance. @@ -35,18 +37,16 @@ public object Chucker { .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } - public fun Context.createShortcut() { + internal fun Context.createShortcut() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { getSystemService(ShortcutManager::class.java)?.let { - val shortcut = ShortcutInfo.Builder(this, "id1") - .setShortLabel("Open chucker activity") - .setLongLabel("Open chucker activity") + val shortcut = ShortcutInfo.Builder(this, SHORTCUT_ID) + .setShortLabel(getString(R.string.chucker_shortcut_label)) + .setLongLabel(getString(R.string.chucker_shortcut_label)) .setIcon(Icon.createWithResource(this, R.mipmap.chucker_ic_launcher_round)) .setIntent(getLaunchIntent(this).setAction(Intent.ACTION_VIEW)) .build() - val allShortcuts = it.dynamicShortcuts.toMutableList() - allShortcuts.add(shortcut) - it.dynamicShortcuts = allShortcuts + it.addDynamicShortcuts(listOf(shortcut)) } } } diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml index b73f051e0..989870425 100644 --- a/library/src/main/res/values/strings.xml +++ b/library/src/main/res/values/strings.xml @@ -57,4 +57,5 @@ The request isn\'t ready for sharing or saving This request is empty This response is empty + Open chucker From 6b6501ac47117e370234d0210694a7a84f44b235 Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 10:07:52 +0800 Subject: [PATCH 04/13] Add other dpi icons --- .../mipmap-hdpi/chucker_ic_launcher_round.png | Bin 0 -> 3056 bytes .../mipmap-xhdpi/chucker_ic_launcher_round.png | Bin 0 -> 4242 bytes .../mipmap-xxhdpi/chucker_ic_launcher_round.png | Bin 0 -> 6518 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 library/src/main/res/mipmap-hdpi/chucker_ic_launcher_round.png create mode 100644 library/src/main/res/mipmap-xhdpi/chucker_ic_launcher_round.png create mode 100644 library/src/main/res/mipmap-xxhdpi/chucker_ic_launcher_round.png diff --git a/library/src/main/res/mipmap-hdpi/chucker_ic_launcher_round.png b/library/src/main/res/mipmap-hdpi/chucker_ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..6c2d234feda7d373fd9bec8c58e8e2fefaecedaa GIT binary patch literal 3056 zcmV(P)Jc6{M;cg>Yafu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Ii6ru1j1&+Ymd$6> z?1a^oT+tTFO0`D?`a7>IdhscsM8HU{1+EREOUyQ0@z(2b?fm4bUHD#dB#e_r?v(;3 zj?F=+KWm+VvQYq|Y9nie8cy{Qekv`lEd!5CUBa|Re%ewKKktDLxuUHdBzgm8qIyXJ zD3cXS4OT<-`3(5XUW=Y#fB|*{rXir&)&bYZPir#i#$-0ZwX=K)vU@j3 z!gCEgZU7QxB&w0p5ROg)>6ikQXsjP@=QA6R>gKF^lP}!(cal?rRU!mXCI+Z>RyrXX zq{jj-aga!_?;wDXzDIg)d$0L(;X42@Aov&T5;%Mfx;d-gAlH;I>pS=wr?YEKM`AvQ zY8;VqMBoHzz;Qp2g4pCnus#9W z{ybN_s0}6JhdG7hPl)l%y2%<;QyD`{2jd4Aqw@kH<4bhWNegt*;}+79 zv;h7_{*MA=2DnSf`4+I4^$ZNi-565nwUBF)f<|;xf$Uy1;P?PY)~qB2Qxpq-N3bUz z0F_LmIR>iGp&2AxCWbdNmXx`q!~B2nUUCkc3!fo^g+xz=WCobg?7L&xwMao@%{Cfv zWD2GbmUtV=#Ayr@sv{XAjA6!3qOJvuPs%A1*+^w$A_GSX1ISo*P9pn^QS3A0*mp#- z?+jztpn*oAVA3(81u}6O%yKG5rk_M$MKRYB!vt+C1A}zLvj2-=?~RfGC7gX`DEkfr z`_2F>_oRVF;ee8YN(7dk89ay?KbWzGts(w@5IaXN0g4nX8esecRMz0)t$-#Sw%%j? cIevHiKdL1<%k(x^M*si-07*qoM6N<$f|2f8#Q*>R literal 0 HcmV?d00001 From d554b7d18404aeac8c6ec4ec14b5b5fff2d8c628 Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 10:29:57 +0800 Subject: [PATCH 05/13] Modify `createShortcut` --- .../java/com/chuckerteam/chucker/api/Chucker.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index 7d1f5d18b..5906d9f23 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -37,14 +37,14 @@ public object Chucker { .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } - internal fun Context.createShortcut() { + internal fun createShortcut(context: Context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { - getSystemService(ShortcutManager::class.java)?.let { - val shortcut = ShortcutInfo.Builder(this, SHORTCUT_ID) - .setShortLabel(getString(R.string.chucker_shortcut_label)) - .setLongLabel(getString(R.string.chucker_shortcut_label)) - .setIcon(Icon.createWithResource(this, R.mipmap.chucker_ic_launcher_round)) - .setIntent(getLaunchIntent(this).setAction(Intent.ACTION_VIEW)) + context.getSystemService(ShortcutManager::class.java)?.let { + val shortcut = ShortcutInfo.Builder(context, SHORTCUT_ID) + .setShortLabel(context.getString(R.string.chucker_shortcut_label)) + .setLongLabel(context.getString(R.string.chucker_shortcut_label)) + .setIcon(Icon.createWithResource(context, R.mipmap.chucker_ic_launcher_round)) + .setIntent(getLaunchIntent(context).setAction(Intent.ACTION_VIEW)) .build() it.addDynamicShortcuts(listOf(shortcut)) } From 8016f7d2f63347e599ae1fffd0864efc2d8c7a32 Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 10:31:31 +0800 Subject: [PATCH 06/13] Add a flag in builder to decide if enable create shortcut --- .../chuckerteam/chucker/api/ChuckerInterceptor.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt b/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt index 2fccc11c1..2e9194d68 100755 --- a/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt @@ -2,12 +2,12 @@ package com.chuckerteam.chucker.api import android.content.Context import androidx.annotation.VisibleForTesting -import com.chuckerteam.chucker.api.Chucker.createShortcut import com.chuckerteam.chucker.internal.data.entity.HttpTransaction import com.chuckerteam.chucker.internal.support.CacheDirectoryProvider import com.chuckerteam.chucker.internal.support.PlainTextDecoder import com.chuckerteam.chucker.internal.support.RequestProcessor import com.chuckerteam.chucker.internal.support.ResponseProcessor +import com.chuckerteam.chucker.internal.ui.MainActivity import okhttp3.Interceptor import okhttp3.Response import java.io.IOException @@ -55,7 +55,9 @@ public class ChuckerInterceptor private constructor( ) init { - builder.context.createShortcut() + if (builder.createShortcut) { + Chucker.createShortcut(builder.context) + } } /** Adds [headerName] into [headersToRedact] */ @@ -93,6 +95,7 @@ public class ChuckerInterceptor private constructor( internal var alwaysReadResponseBody = false internal var headersToRedact = emptySet() internal var decoders = emptyList() + internal var createShortcut = true /** * Sets the [ChuckerCollector] to customize data retention. @@ -145,6 +148,14 @@ public class ChuckerInterceptor private constructor( this.decoders += decoder } + /** + * If set to `true`, [ChuckerInterceptor] will create a shortcut for your app + * just like what `LeakCanary` did, you can easily to access chucker's [MainActivity] + */ + public fun createShortcut(enable: Boolean): Builder = apply { + this.createShortcut = enable + } + /** * Sets provider of a directory where Chucker will save temporary responses * before processing them. From 746f310e11ae270014dfff1040b69a9ed0e9b11b Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 10:47:16 +0800 Subject: [PATCH 07/13] Add empty func in library-no-op --- .../java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library-no-op/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt b/library-no-op/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt index 1396d5b71..6108de225 100644 --- a/library-no-op/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt +++ b/library-no-op/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt @@ -4,7 +4,6 @@ import android.content.Context import okhttp3.Interceptor import okhttp3.Response import java.io.IOException -import kotlin.jvm.Throws /** * No-op implementation. @@ -44,6 +43,8 @@ public class ChuckerInterceptor private constructor( public fun addBodyDecoder(decoder: Any): Builder = this + public fun createShortcut(enable: Boolean): Builder = this + public fun build(): ChuckerInterceptor = ChuckerInterceptor(this) } } From d0e2868b0764b555ac539185c9f04edf7b57017a Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 14:39:18 +0800 Subject: [PATCH 08/13] Modify comments --- library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt | 4 ++++ .../java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index 5906d9f23..093e5a74e 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -37,6 +37,10 @@ public object Chucker { .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } + /** + * Create a shortcut to launch Chucker UI. + * @param context An Android [Context]. + */ internal fun createShortcut(context: Context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { context.getSystemService(ShortcutManager::class.java)?.let { diff --git a/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt b/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt index 2e9194d68..e3eba99bf 100755 --- a/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/ChuckerInterceptor.kt @@ -150,7 +150,7 @@ public class ChuckerInterceptor private constructor( /** * If set to `true`, [ChuckerInterceptor] will create a shortcut for your app - * just like what `LeakCanary` did, you can easily to access chucker's [MainActivity] + * which can make you easily to access chucker's [MainActivity] */ public fun createShortcut(enable: Boolean): Builder = apply { this.createShortcut = enable From 69243ccd8a4e455b19231432897fefa82370f7ce Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 14:55:16 +0800 Subject: [PATCH 09/13] Check shortcut exist before add & catch exception --- .../com/chuckerteam/chucker/api/Chucker.kt | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index 093e5a74e..18110e373 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -17,7 +17,7 @@ import com.chuckerteam.chucker.internal.ui.MainActivity */ public object Chucker { - private const val SHORTCUT_ID = "shortcutId" + private const val SHORTCUT_ID = "chuckerShortcutId" /** * Check if this instance is the operation one or no-op. @@ -43,14 +43,24 @@ public object Chucker { */ internal fun createShortcut(context: Context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { - context.getSystemService(ShortcutManager::class.java)?.let { - val shortcut = ShortcutInfo.Builder(context, SHORTCUT_ID) - .setShortLabel(context.getString(R.string.chucker_shortcut_label)) - .setLongLabel(context.getString(R.string.chucker_shortcut_label)) - .setIcon(Icon.createWithResource(context, R.mipmap.chucker_ic_launcher_round)) - .setIntent(getLaunchIntent(context).setAction(Intent.ACTION_VIEW)) - .build() - it.addDynamicShortcuts(listOf(shortcut)) + run outside@{ + context.getSystemService(ShortcutManager::class.java)?.let { sm -> + sm.dynamicShortcuts.forEach { + if (it.id == SHORTCUT_ID) return@outside + } + val shortcut = ShortcutInfo.Builder(context, SHORTCUT_ID) + .setShortLabel(context.getString(R.string.chucker_shortcut_label)) + .setLongLabel(context.getString(R.string.chucker_shortcut_label)) + .setIcon( + Icon.createWithResource(context, R.mipmap.chucker_ic_launcher_round) + ) + .setIntent(getLaunchIntent(context).setAction(Intent.ACTION_VIEW)) + .build() + try { + sm.addDynamicShortcuts(listOf(shortcut)) + } catch (ignored: Throwable) { + } + } } } } From 90d15f0fa010444b9b0a136643ac1b10e59055f8 Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 15:08:51 +0800 Subject: [PATCH 10/13] Refine code --- .../com/chuckerteam/chucker/api/Chucker.kt | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index 18110e373..d9ff99afa 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -43,23 +43,21 @@ public object Chucker { */ internal fun createShortcut(context: Context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { - run outside@{ - context.getSystemService(ShortcutManager::class.java)?.let { sm -> - sm.dynamicShortcuts.forEach { - if (it.id == SHORTCUT_ID) return@outside - } - val shortcut = ShortcutInfo.Builder(context, SHORTCUT_ID) - .setShortLabel(context.getString(R.string.chucker_shortcut_label)) - .setLongLabel(context.getString(R.string.chucker_shortcut_label)) - .setIcon( - Icon.createWithResource(context, R.mipmap.chucker_ic_launcher_round) - ) - .setIntent(getLaunchIntent(context).setAction(Intent.ACTION_VIEW)) - .build() - try { - sm.addDynamicShortcuts(listOf(shortcut)) - } catch (ignored: Throwable) { - } + context.getSystemService(ShortcutManager::class.java)?.let { sm -> + sm.dynamicShortcuts.forEach { + if (it.id == SHORTCUT_ID) return@let + } + val shortcut = ShortcutInfo.Builder(context, SHORTCUT_ID) + .setShortLabel(context.getString(R.string.chucker_shortcut_label)) + .setLongLabel(context.getString(R.string.chucker_shortcut_label)) + .setIcon( + Icon.createWithResource(context, R.mipmap.chucker_ic_launcher_round) + ) + .setIntent(getLaunchIntent(context).setAction(Intent.ACTION_VIEW)) + .build() + try { + sm.addDynamicShortcuts(listOf(shortcut)) + } catch (ignored: Throwable) { } } } From 5c48a7b7b106c7f1127a6b18abe9ef110c9f2633 Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 15:12:08 +0800 Subject: [PATCH 11/13] Log exception --- library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index d9ff99afa..1bd61b85a 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -57,7 +57,8 @@ public object Chucker { .build() try { sm.addDynamicShortcuts(listOf(shortcut)) - } catch (ignored: Throwable) { + } catch (e: Throwable) { + Logger.warn("ShortcutManager addDynamicShortcuts failed ", e) } } } From 737fb347c36283f65869378863be7e37fe04b933 Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 15:15:45 +0800 Subject: [PATCH 12/13] Api dump --- library-no-op/api/library-no-op.api | 1 + library/api/library.api | 1 + 2 files changed, 2 insertions(+) diff --git a/library-no-op/api/library-no-op.api b/library-no-op/api/library-no-op.api index 97007b4a2..5804b3a1a 100644 --- a/library-no-op/api/library-no-op.api +++ b/library-no-op/api/library-no-op.api @@ -32,6 +32,7 @@ public final class com/chuckerteam/chucker/api/ChuckerInterceptor$Builder { public final fun alwaysReadResponseBody (Z)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun build ()Lcom/chuckerteam/chucker/api/ChuckerInterceptor; public final fun collector (Lcom/chuckerteam/chucker/api/ChuckerCollector;)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; + public final fun createShortcut (Z)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun maxContentLength (J)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun redactHeaders (Ljava/lang/Iterable;)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun redactHeaders ([Ljava/lang/String;)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; diff --git a/library/api/library.api b/library/api/library.api index bdf6b1401..5ba5ec7f3 100644 --- a/library/api/library.api +++ b/library/api/library.api @@ -32,6 +32,7 @@ public final class com/chuckerteam/chucker/api/ChuckerInterceptor$Builder { public final fun alwaysReadResponseBody (Z)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun build ()Lcom/chuckerteam/chucker/api/ChuckerInterceptor; public final fun collector (Lcom/chuckerteam/chucker/api/ChuckerCollector;)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; + public final fun createShortcut (Z)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun maxContentLength (J)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun redactHeaders (Ljava/lang/Iterable;)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; public final fun redactHeaders ([Ljava/lang/String;)Lcom/chuckerteam/chucker/api/ChuckerInterceptor$Builder; From 537518d5504476f4ede3c0ff1477e6cd6a362026 Mon Sep 17 00:00:00 2001 From: goooler Date: Fri, 26 Mar 2021 15:24:34 +0800 Subject: [PATCH 13/13] Catch specific exceptions --- .../src/main/java/com/chuckerteam/chucker/api/Chucker.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt index 1bd61b85a..20a589b32 100644 --- a/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt +++ b/library/src/main/java/com/chuckerteam/chucker/api/Chucker.kt @@ -11,6 +11,8 @@ import com.chuckerteam.chucker.R import com.chuckerteam.chucker.internal.support.Logger import com.chuckerteam.chucker.internal.support.NotificationHelper import com.chuckerteam.chucker.internal.ui.MainActivity +import java.lang.IllegalArgumentException +import java.lang.IllegalStateException /** * Chucker methods and utilities to interact with the library. @@ -57,7 +59,9 @@ public object Chucker { .build() try { sm.addDynamicShortcuts(listOf(shortcut)) - } catch (e: Throwable) { + } catch (e: IllegalArgumentException) { + Logger.warn("ShortcutManager addDynamicShortcuts failed ", e) + } catch (e: IllegalStateException) { Logger.warn("ShortcutManager addDynamicShortcuts failed ", e) } }