File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed
src/main/kotlin/me/proxer/app Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 79
79
gravitySnapHelperVersion = " 2.2.0"
80
80
81
81
// Utils
82
- proxerLibVersion = " 70ee4f0858 "
82
+ proxerLibVersion = " 891bb378a4 "
83
83
threetenVersion = " 1.2.1"
84
84
hawkVersion = " 7a1a625455"
85
85
glideVersion = " 4.10.0"
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import me.proxer.app.R
23
23
import me.proxer.app.util.ErrorUtils.ErrorAction
24
24
import me.proxer.app.util.ErrorUtils.ErrorAction.Companion.ACTION_MESSAGE_DEFAULT
25
25
import me.proxer.app.util.ErrorUtils.ErrorAction.Companion.ACTION_MESSAGE_HIDE
26
+ import me.proxer.app.util.Utils
26
27
import me.proxer.app.util.compat.isConnected
27
28
import me.proxer.app.util.extension.resolveColor
28
29
import me.proxer.library.enums.Device
@@ -150,7 +151,7 @@ abstract class BaseContentFragment<T>(@LayoutRes contentLayoutId: Int) : BaseFra
150
151
true -> {
151
152
isSolvingCaptcha = true
152
153
153
- showPage(ProxerUrls .captchaWeb(Device .MOBILE ))
154
+ showPage(ProxerUrls .captchaWeb(Utils .getIpAddress(), Device .MOBILE ))
154
155
}
155
156
false -> action.toClickListener(hostingActivity)?.onClick(errorButton) ? : viewModel.load()
156
157
}
Original file line number Diff line number Diff line change @@ -323,7 +323,9 @@ object ErrorUtils : KoinComponent {
323
323
}
324
324
325
325
fun toClickListener (activity : BaseActivity ) = when (buttonAction) {
326
- CAPTCHA -> View .OnClickListener { activity.showPage(ProxerUrls .captchaWeb(Device .MOBILE )) }
326
+ CAPTCHA -> View .OnClickListener {
327
+ activity.showPage(ProxerUrls .captchaWeb(Utils .getIpAddress(), Device .MOBILE ))
328
+ }
327
329
NETWORK_SETTINGS -> View .OnClickListener {
328
330
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
329
331
activity.startActivity(Intent (Settings .Panel .ACTION_INTERNET_CONNECTIVITY ))
@@ -343,7 +345,10 @@ object ErrorUtils : KoinComponent {
343
345
}
344
346
345
347
fun toIntent () = when (buttonAction) {
346
- CAPTCHA -> Intent (Intent .ACTION_VIEW , ProxerUrls .captchaWeb(Device .MOBILE ).androidUri())
348
+ CAPTCHA -> Intent (
349
+ Intent .ACTION_VIEW ,
350
+ ProxerUrls .captchaWeb(Utils .getIpAddress(), Device .MOBILE ).androidUri()
351
+ )
347
352
else -> null
348
353
}
349
354
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import me.proxer.app.util.extension.androidUri
10
10
import okhttp3.HttpUrl
11
11
import org.threeten.bp.format.DateTimeFormatter
12
12
import timber.log.Timber
13
+ import java.net.NetworkInterface
13
14
14
15
/* *
15
16
* @author Ruben Gees
@@ -32,6 +33,18 @@ object Utils {
32
33
null
33
34
}
34
35
36
+ fun getIpAddress (): String? = try {
37
+ NetworkInterface .getNetworkInterfaces().asSequence()
38
+ .flatMap { it.inetAddresses.asSequence() }
39
+ .filterNot { it.isLoopbackAddress || it.isLinkLocalAddress }
40
+ .map { it.hostAddress }
41
+ .firstOrNull()
42
+ } catch (error: Throwable ) {
43
+ Timber .e(" Error trying to get ip address" , error)
44
+
45
+ null
46
+ }
47
+
35
48
fun getNativeAppPackage (context : Context , url : HttpUrl ): Set <String > {
36
49
val browserActivityIntent = Intent (Intent .ACTION_VIEW , Uri .parse(" http://www.generic.com" ))
37
50
val genericResolvedList = extractPackageNames(
You can’t perform that action at this time.
0 commit comments