mirror of
https://github.com/MGislv/NekoX.git
synced 2024-07-04 11:13:36 +00:00
Fix hide device info
This commit is contained in:
parent
bda178a833
commit
ac3cd25765
|
@ -3,16 +3,16 @@ import cn.hutool.core.util.RuntimeUtil
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
def verName = "7.5.0-rc03"
|
def verName = "7.5.0-rc04"
|
||||||
def verCode = 206
|
def verCode = 200 + 3 * 3
|
||||||
|
|
||||||
if (System.getenv("DEBUG_BUILD") == "true") {
|
if (System.getenv("DEBUG_BUILD") == "true") {
|
||||||
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1)")
|
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def officialVer = "7.4.2"
|
def officialVer = "7.5.0"
|
||||||
def officialCode = 2227
|
def officialCode = 2246
|
||||||
|
|
||||||
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
|
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
|
||||||
|
|
||||||
|
@ -26,21 +26,17 @@ if (serviceAccountCredentialsFile.isFile()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupPlay(boolean beta) {
|
void setupPlay(boolean beta) {
|
||||||
|
|
||||||
apply plugin: 'com.github.triplet.play'
|
apply plugin: 'com.github.triplet.play'
|
||||||
|
|
||||||
play {
|
play {
|
||||||
track = beta ? "beta" : "production"
|
track = beta ? "beta" : "production"
|
||||||
defaultToAppBundles = true
|
defaultToAppBundles = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
compile.exclude module: 'support-v4'
|
compile.exclude module: 'support-v4'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def keystorePwd = null
|
def keystorePwd = null
|
||||||
def alias = null
|
def alias = null
|
||||||
def pwd = null
|
def pwd = null
|
||||||
|
@ -111,9 +107,9 @@ dependencies {
|
||||||
implementation 'dnsjava:dnsjava:3.3.1'
|
implementation 'dnsjava:dnsjava:3.3.1'
|
||||||
implementation 'org.dizitart:nitrite:3.4.3'
|
implementation 'org.dizitart:nitrite:3.4.3'
|
||||||
|
|
||||||
implementation 'cn.hutool:hutool-core:5.5.8'
|
implementation 'cn.hutool:hutool-core:5.5.9'
|
||||||
implementation 'cn.hutool:hutool-crypto:5.5.8'
|
implementation 'cn.hutool:hutool-crypto:5.5.9'
|
||||||
implementation 'cn.hutool:hutool-http:5.5.8'
|
implementation 'cn.hutool:hutool-http:5.5.9'
|
||||||
|
|
||||||
implementation 'org.yaml:snakeyaml:1.28'
|
implementation 'org.yaml:snakeyaml:1.28'
|
||||||
implementation 'com.jakewharton:process-phoenix:2.0.0'
|
implementation 'com.jakewharton:process-phoenix:2.0.0'
|
||||||
|
@ -137,7 +133,7 @@ dependencies {
|
||||||
testImplementation 'androidx.test:core:1.3.0'
|
testImplementation 'androidx.test:core:1.3.0'
|
||||||
testImplementation 'org.robolectric:robolectric:4.5.1'
|
testImplementation 'org.robolectric:robolectric:4.5.1'
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
|
||||||
if (!targetAbi.isBlank()) {
|
if (!targetAbi.isBlank()) {
|
||||||
implementation project(":ss-rust")
|
implementation project(":ss-rust")
|
||||||
|
|
23882
TMessagesProj/src/main/assets/devices.csv
Normal file
23882
TMessagesProj/src/main/assets/devices.csv
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -47,7 +47,9 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import tw.nekomimi.nekogram.NekoConfig;
|
import tw.nekomimi.nekogram.NekoConfig;
|
||||||
|
import tw.nekomimi.nekogram.parts.DeviceInfosKt;
|
||||||
import tw.nekomimi.nekogram.parts.ProxySwitcher;
|
import tw.nekomimi.nekogram.parts.ProxySwitcher;
|
||||||
import tw.nekomimi.nekogram.utils.DnsFactory;
|
import tw.nekomimi.nekogram.utils.DnsFactory;
|
||||||
|
|
||||||
|
@ -195,24 +197,26 @@ public class ConnectionsManager extends BaseController {
|
||||||
version = BuildConfig.OFFICIAL_VERSION_CODE * 10 + 9;
|
version = BuildConfig.OFFICIAL_VERSION_CODE * 10 + 9;
|
||||||
appId = BuildVars.OFFICAL_APP_ID;
|
appId = BuildVars.OFFICAL_APP_ID;
|
||||||
appVersion = BuildConfig.OFFICIAL_VERSION + " (" + (BuildConfig.OFFICIAL_VERSION_CODE * 10 + 9) + ")";
|
appVersion = BuildConfig.OFFICIAL_VERSION + " (" + (BuildConfig.OFFICIAL_VERSION_CODE * 10 + 9) + ")";
|
||||||
if (BuildVars.DEBUG_VERSION) {
|
|
||||||
appVersion += " beta";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
fingerprint = AndroidUtilities.getCertificateSHA256Fingerprint();
|
fingerprint = AndroidUtilities.getCertificateSHA256Fingerprint();
|
||||||
version = BuildConfig.VERSION_CODE;
|
version = BuildConfig.VERSION_CODE;
|
||||||
appId = BuildConfig.APP_ID;
|
appId = BuildConfig.APP_ID;
|
||||||
appVersion = BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")";
|
String versionName = BuildConfig.VERSION_NAME;
|
||||||
|
if (versionName.contains("-")) {
|
||||||
|
versionName = StrUtil.subBefore(versionName, "-", false);
|
||||||
|
}
|
||||||
|
appVersion = versionName + " (" + BuildConfig.VERSION_CODE + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systemLangCode.trim().length() == 0) {
|
if (systemLangCode.trim().length() == 0) {
|
||||||
systemLangCode = "en";
|
systemLangCode = "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deviceModel.trim().length() == 0) {
|
if (deviceModel.trim().length() == 0) {
|
||||||
deviceModel = "Unknown";
|
deviceModel = DeviceInfosKt.randomDevice();
|
||||||
}
|
}
|
||||||
if (systemVersion.trim().length() == 0) {
|
if (systemVersion.trim().length() == 0) {
|
||||||
systemVersion = "Unknown";
|
systemVersion = DeviceInfosKt.randomSystemVersion();
|
||||||
}
|
}
|
||||||
String pushString = SharedConfig.pushString;
|
String pushString = SharedConfig.pushString;
|
||||||
if (TextUtils.isEmpty(pushString) && !TextUtils.isEmpty(SharedConfig.pushStringStatus)) {
|
if (TextUtils.isEmpty(pushString) && !TextUtils.isEmpty(SharedConfig.pushStringStatus)) {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package tw.nekomimi.nekogram.parts
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil
|
||||||
|
import cn.hutool.core.util.RandomUtil
|
||||||
|
import org.telegram.messenger.ApplicationLoader
|
||||||
|
import tw.nekomimi.nekogram.NekoConfig
|
||||||
|
|
||||||
|
fun randomDevice(): String {
|
||||||
|
val currDevice = NekoConfig.preferences.getString("fake_device", "")
|
||||||
|
if (!currDevice.isNullOrBlank()) return currDevice
|
||||||
|
val devices = IoUtil.readUtf8(ApplicationLoader.applicationContext.assets.open("devices.csv"))
|
||||||
|
val device = RandomUtil.randomEle(devices.split("\n"))
|
||||||
|
NekoConfig.preferences.edit().putString("fake_device", device).apply()
|
||||||
|
return device
|
||||||
|
}
|
||||||
|
|
||||||
|
fun randomSystemVersion(): String {
|
||||||
|
val currVer = NekoConfig.preferences.getString("fake_sdk", "")
|
||||||
|
if (!currVer.isNullOrBlank()) return currVer
|
||||||
|
val version = "SDK " + RandomUtil.randomInt(16, 31)
|
||||||
|
NekoConfig.preferences.edit().putString("fake_sdk", version).apply()
|
||||||
|
return version
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user