refactor: renomear package me.capcom.smsgateway → pt.whatsms.gateway
Build AAB — WhatSMS Gateway / build (push) Failing after 34s

- namespace, applicationId, todos os ficheiros .kt/.xml/.gradle actualizados
- directório me/capcom/smsgateway/ → pt/whatsms/gateway/
- zero referências a capcom no código fonte
This commit is contained in:
2026-04-24 18:28:08 +01:00
parent 1cb31d1615
commit 5c5b35f9e2
213 changed files with 822 additions and 822 deletions
@@ -0,0 +1,5 @@
package pt.whatsms.gateway.providers
interface IPProvider {
suspend fun getIP(): String?
}
@@ -0,0 +1,54 @@
package pt.whatsms.gateway.providers
import android.content.Context
import android.net.wifi.WifiManager
import java.net.Inet4Address
import java.net.NetworkInterface
class LocalIPProvider(private val context: Context): IPProvider {
override suspend fun getIP(): String? {
try {
val wifiManager =
context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
// If the device is in tethering mode, the following method may return null or a default IP
wifiManager.connectionInfo?.let { connectionInfo ->
val ipInt = connectionInfo.ipAddress
if (ipInt != 0) {
return (ipInt and 0xFF).toString() + "." +
((ipInt shr 8) and 0xFF) + "." +
((ipInt shr 16) and 0xFF) + "." +
((ipInt shr 24) and 0xFF)
}
}
// If the above doesn't work, try to find the WiFi network interface directly
val wifiInterface = NetworkInterface.getNetworkInterfaces().asSequence()
.find { it.name.contains("wlan", ignoreCase = true) }
wifiInterface?.inetAddresses?.asSequence()
?.find { !it.isLoopbackAddress && it is Inet4Address }
?.let { inetAddress ->
return inetAddress.hostAddress
}
// Check any other network interface
val interfaces = NetworkInterface.getNetworkInterfaces()
while (interfaces.hasMoreElements()) {
val intf = interfaces.nextElement()
val addrs = intf.inetAddresses
while (addrs.hasMoreElements()) {
val addr = addrs.nextElement()
if (!addr.isLoopbackAddress && addr is Inet4Address) {
return addr.hostAddress
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
return null
}
}
@@ -0,0 +1,17 @@
package pt.whatsms.gateway.providers
import pt.whatsms.gateway.modules.gateway.GatewayService
import org.koin.java.KoinJavaComponent.inject
class PublicIPProvider: IPProvider {
private val gatewaySvc by inject<GatewayService>(GatewayService::class.java)
override suspend fun getIP(): String? {
return try {
gatewaySvc.getPublicIP()
} catch (e: Exception) {
e.printStackTrace()
null
}
}
}