mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-08-30 11:05:15 +02:00
feat(tiktok): sim-spoof
patch (#219)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
44dfea907d
commit
cea3a5edc7
@ -9,10 +9,14 @@ import app.revanced.tiktok.utils.SharedPrefHelper;
|
|||||||
|
|
||||||
public enum SettingsEnum {
|
public enum SettingsEnum {
|
||||||
//TikTok Settings
|
//TikTok Settings
|
||||||
TIK_REMOVE_ADS("tik-remove-ads", true, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN, true),
|
TIK_REMOVE_ADS("tik_remove_ads", true, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN, true),
|
||||||
TIK_HIDE_LIVE("tik-hide-live", false, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN, true),
|
TIK_HIDE_LIVE("tik_hide_live", false, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN, true),
|
||||||
TIK_DOWN_PATH("tik-down-path", "DCIM/TikTok", SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.STRING),
|
TIK_DOWN_PATH("tik_down_path", "DCIM/TikTok", SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.STRING),
|
||||||
TIK_DOWN_WATERMARK("tik-down-watermark", true, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN),
|
TIK_DOWN_WATERMARK("tik_down_watermark", true, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN),
|
||||||
|
TIK_SIMSPOOF("tik_simspoof", true, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN, true),
|
||||||
|
TIK_SIMSPOOF_ISO("tik_simspoof_iso", "us", SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.STRING),
|
||||||
|
TIK_SIMSPOOF_MCCMNC("tik_simspoof_mccmnc", "310160", SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.STRING),
|
||||||
|
TIK_SIMSPOOF_OP_NAME("tik_simspoof_op_name", "T-Mobile", SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.STRING),
|
||||||
TIK_DEBUG("tik_debug", false, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN);
|
TIK_DEBUG("tik_debug", false, SharedPrefHelper.SharedPrefNames.TIKTOK_PREFS, ReturnType.BOOLEAN);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -10,6 +10,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
|
import android.preference.EditTextPreference;
|
||||||
import android.preference.PreferenceCategory;
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
@ -124,6 +125,73 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SpoofSimPatch
|
||||||
|
if(SettingsStatus.simSpoof) {
|
||||||
|
PreferenceCategory simSpoof = new PreferenceCategory(context);
|
||||||
|
simSpoof.setTitle("Bypass regional restriction");
|
||||||
|
preferenceScreen.addPreference(simSpoof);
|
||||||
|
//Global Switch
|
||||||
|
{
|
||||||
|
SwitchPreference preference = new SwitchPreference(context);
|
||||||
|
simSpoof.addPreference(preference);
|
||||||
|
preference.setKey(SettingsEnum.TIK_SIMSPOOF.getPath());
|
||||||
|
preference.setDefaultValue(SettingsEnum.TIK_SIMSPOOF.getDefaultValue());
|
||||||
|
preference.setChecked(SettingsEnum.TIK_SIMSPOOF.getBoolean());
|
||||||
|
preference.setTitle("Fake sim card info");
|
||||||
|
preference.setSummary("Bypass regional restriction by fake sim card information.");
|
||||||
|
preference.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||||
|
final boolean value = (Boolean) newValue;
|
||||||
|
SettingsEnum.TIK_SIMSPOOF.saveValue(value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Country ISO
|
||||||
|
{
|
||||||
|
EditTextPreference preference = new EditTextPreference(context);
|
||||||
|
simSpoof.addPreference(preference);
|
||||||
|
preference.setKey(SettingsEnum.TIK_SIMSPOOF_ISO.getPath());
|
||||||
|
preference.setDefaultValue(SettingsEnum.TIK_SIMSPOOF_ISO.getDefaultValue());
|
||||||
|
preference.setText(SettingsEnum.TIK_SIMSPOOF_ISO.getString());
|
||||||
|
preference.setTitle("Country ISO");
|
||||||
|
preference.setSummary("us, uk, jp, ...");
|
||||||
|
preference.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||||
|
final String value = (String) newValue;
|
||||||
|
SettingsEnum.TIK_SIMSPOOF_ISO.saveValue(value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Operator mcc+mnc
|
||||||
|
{
|
||||||
|
EditTextPreference preference = new EditTextPreference(context);
|
||||||
|
simSpoof.addPreference(preference);
|
||||||
|
preference.setKey(SettingsEnum.TIK_SIMSPOOF_MCCMNC.getPath());
|
||||||
|
preference.setDefaultValue(SettingsEnum.TIK_SIMSPOOF_MCCMNC.getDefaultValue());
|
||||||
|
preference.setText(SettingsEnum.TIK_SIMSPOOF_MCCMNC.getString());
|
||||||
|
preference.setTitle("Operator mcc+mnc");
|
||||||
|
preference.setSummary("mcc+mnc");
|
||||||
|
preference.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||||
|
final String value = (String) newValue;
|
||||||
|
SettingsEnum.TIK_SIMSPOOF_MCCMNC.saveValue(value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Operator name
|
||||||
|
{
|
||||||
|
EditTextPreference preference = new EditTextPreference(context);
|
||||||
|
simSpoof.addPreference(preference);
|
||||||
|
preference.setKey(SettingsEnum.TIK_SIMSPOOF_OP_NAME.getPath());
|
||||||
|
preference.setDefaultValue(SettingsEnum.TIK_SIMSPOOF_OP_NAME.getDefaultValue());
|
||||||
|
preference.setText(SettingsEnum.TIK_SIMSPOOF_OP_NAME.getString());
|
||||||
|
preference.setTitle("Operator name");
|
||||||
|
preference.setSummary("Name of the operator");
|
||||||
|
preference.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||||
|
final String value = (String) newValue;
|
||||||
|
SettingsEnum.TIK_SIMSPOOF_OP_NAME.saveValue(value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Integration
|
//Integration
|
||||||
PreferenceCategory integration = new PreferenceCategory(context);
|
PreferenceCategory integration = new PreferenceCategory(context);
|
||||||
integration.setTitle("Integration");
|
integration.setTitle("Integration");
|
||||||
|
@ -3,6 +3,7 @@ package app.revanced.tiktok.settingsmenu;
|
|||||||
public class SettingsStatus {
|
public class SettingsStatus {
|
||||||
public static boolean feedFilter = false;
|
public static boolean feedFilter = false;
|
||||||
public static boolean download = false;
|
public static boolean download = false;
|
||||||
|
public static boolean simSpoof = false;
|
||||||
|
|
||||||
public static void enableFeedFilter() {
|
public static void enableFeedFilter() {
|
||||||
feedFilter = true;
|
feedFilter = true;
|
||||||
@ -12,6 +13,10 @@ public class SettingsStatus {
|
|||||||
download = true;
|
download = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void enableSimSpoof() {
|
||||||
|
simSpoof = true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package app.revanced.tiktok.spoof.sim;
|
||||||
|
|
||||||
|
import app.revanced.tiktok.settings.SettingsEnum;
|
||||||
|
|
||||||
|
public class SpoofSimPatch {
|
||||||
|
public static boolean isEnable() {
|
||||||
|
return SettingsEnum.TIK_SIMSPOOF.getBoolean();
|
||||||
|
}
|
||||||
|
public static String getCountryIso(String value) {
|
||||||
|
if (isEnable()) {
|
||||||
|
return SettingsEnum.TIK_SIMSPOOF_ISO.getString();
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static String getOperator(String value) {
|
||||||
|
if (isEnable()) {
|
||||||
|
return SettingsEnum.TIK_SIMSPOOF_MCCMNC.getString();
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static String getOperatorName(String value) {
|
||||||
|
if (isEnable()) {
|
||||||
|
return SettingsEnum.TIK_SIMSPOOF_OP_NAME.getString();
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user