@@ -13,6 +13,7 @@ import io.reactivex.rxjava3.core.Single
13
13
import io.reactivex.rxjava3.core.SingleEmitter
14
14
import io.reactivex.rxjava3.disposables.CompositeDisposable
15
15
import io.reactivex.rxjava3.schedulers.Schedulers
16
+ import org.schabi.newpipe.BuildConfig
16
17
import org.schabi.newpipe.DownloaderImpl
17
18
import java.time.Instant
18
19
@@ -100,7 +101,9 @@ class PoTokenWebView private constructor(
100
101
*/
101
102
@JavascriptInterface
102
103
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
+ }
104
107
onInitializationErrorCloseAndCancel(PoTokenException (error))
105
108
}
106
109
@@ -110,12 +113,16 @@ class PoTokenWebView private constructor(
110
113
*/
111
114
@JavascriptInterface
112
115
fun onRunBotguardResult (botguardResponse : String ) {
113
- Log .e(TAG , " botguardResponse: $botguardResponse " )
116
+ if (BuildConfig .DEBUG ) {
117
+ Log .d(TAG , " botguardResponse: $botguardResponse " )
118
+ }
114
119
makeJnnPaGoogleapisRequest(
115
120
" https://jnn-pa.googleapis.com/\$ rpc/google.internal.waa.v1.Waa/GenerateIT" ,
116
121
" [ \" $REQUEST_KEY \" , \" $botguardResponse \" ]" ,
117
122
) { responseBody ->
118
- Log .e(TAG , " GenerateIT response: $responseBody " )
123
+ if (BuildConfig .DEBUG ) {
124
+ Log .d(TAG , " GenerateIT response: $responseBody " )
125
+ }
119
126
webView.evaluateJavascript(
120
127
""" (async function() {
121
128
try {
@@ -194,7 +201,9 @@ class PoTokenWebView private constructor(
194
201
*/
195
202
@JavascriptInterface
196
203
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
+ }
198
207
popPoTokenEmitter(identifier)?.onError(PoTokenException (error))
199
208
}
200
209
@@ -204,8 +213,9 @@ class PoTokenWebView private constructor(
204
213
*/
205
214
@JavascriptInterface
206
215
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
+ }
209
219
popPoTokenEmitter(identifier)?.onSuccess(poToken)
210
220
}
211
221
@@ -298,7 +308,7 @@ class PoTokenWebView private constructor(
298
308
private const val GOOGLE_API_KEY = " AIzaSyDyT5W0Jh49F30Pqqtyfdf7pDLFKLJoAnw"
299
309
private const val REQUEST_KEY = " O43z0dpjhgX20SCx4KAo"
300
310
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"
302
312
303
313
override fun newPoTokenGenerator (context : Context ): Single <PoTokenGenerator > =
304
314
Single .create { emitter ->
0 commit comments