@@ -13,6 +13,7 @@ import io.reactivex.rxjava3.core.Single
1313import io.reactivex.rxjava3.core.SingleEmitter
1414import io.reactivex.rxjava3.disposables.CompositeDisposable
1515import io.reactivex.rxjava3.schedulers.Schedulers
16+ import org.schabi.newpipe.BuildConfig
1617import org.schabi.newpipe.DownloaderImpl
1718import java.time.Instant
1819
@@ -100,7 +101,9 @@ class PoTokenWebView private constructor(
100101 */
101102 @JavascriptInterface
102103 fun onJsInitializationError (error : String ) {
103- Log .e(TAG , " Initialization error from JavaScript: $error " )
104+ if (BuildConfig .DEBUG ) {
105+ Log .e(TAG , " Initialization error from JavaScript: $error " )
106+ }
104107 onInitializationErrorCloseAndCancel(PoTokenException (error))
105108 }
106109
@@ -110,12 +113,16 @@ class PoTokenWebView private constructor(
110113 */
111114 @JavascriptInterface
112115 fun onRunBotguardResult (botguardResponse : String ) {
113- Log .e(TAG , " botguardResponse: $botguardResponse " )
116+ if (BuildConfig .DEBUG ) {
117+ Log .d(TAG , " botguardResponse: $botguardResponse " )
118+ }
114119 makeJnnPaGoogleapisRequest(
115120 " https://jnn-pa.googleapis.com/\$ rpc/google.internal.waa.v1.Waa/GenerateIT" ,
116121 " [ \" $REQUEST_KEY \" , \" $botguardResponse \" ]" ,
117122 ) { responseBody ->
118- Log .e(TAG , " GenerateIT response: $responseBody " )
123+ if (BuildConfig .DEBUG ) {
124+ Log .d(TAG , " GenerateIT response: $responseBody " )
125+ }
119126 webView.evaluateJavascript(
120127 """ (async function() {
121128 try {
@@ -194,7 +201,9 @@ class PoTokenWebView private constructor(
194201 */
195202 @JavascriptInterface
196203 fun onObtainPoTokenError (identifier : String , error : String ) {
197- Log .e(TAG , " obtainPoToken error from JavaScript: $error " )
204+ if (BuildConfig .DEBUG ) {
205+ Log .e(TAG , " obtainPoToken error from JavaScript: $error " )
206+ }
198207 popPoTokenEmitter(identifier)?.onError(PoTokenException (error))
199208 }
200209
@@ -204,8 +213,9 @@ class PoTokenWebView private constructor(
204213 */
205214 @JavascriptInterface
206215 fun onObtainPoTokenResult (identifier : String , poToken : String ) {
207- Log .e(TAG , " identifier=$identifier " )
208- Log .e(TAG , " poToken=$poToken " )
216+ if (BuildConfig .DEBUG ) {
217+ Log .d(TAG , " Generated poToken: identifier=$identifier poToken=$poToken " )
218+ }
209219 popPoTokenEmitter(identifier)?.onSuccess(poToken)
210220 }
211221
@@ -298,7 +308,7 @@ class PoTokenWebView private constructor(
298308 private const val GOOGLE_API_KEY = " AIzaSyDyT5W0Jh49F30Pqqtyfdf7pDLFKLJoAnw"
299309 private const val REQUEST_KEY = " O43z0dpjhgX20SCx4KAo"
300310 private const val USER_AGENT = " Mozilla/5.0 (Windows NT 10.0; Win64; x64) " +
301- " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.3"
311+ " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.3"
302312
303313 override fun newPoTokenGenerator (context : Context ): Single <PoTokenGenerator > =
304314 Single .create { emitter ->
0 commit comments