mirror of
https://github.com/MGislv/NekoX.git
synced 2024-07-02 10:33:36 +00:00
Fixes
This commit is contained in:
parent
c247936792
commit
02a151f3d6
|
@ -45,8 +45,8 @@ import org.telegram.messenger.R
|
|||
val lookupNames get() = lookup.values.map {
|
||||
if (it.label.isNotBlank()) {
|
||||
"${it.label} (${it.id})"
|
||||
} else {
|
||||
} else if (it.id.isNotBlank()) {
|
||||
it.id
|
||||
}
|
||||
} else ""
|
||||
}.map { it.takeIf { it.isNotBlank() } ?: LocaleController.getString("Disable", R.string.Disable) }.toTypedArray()
|
||||
}
|
||||
|
|
|
@ -373,7 +373,6 @@ public class AlertsCreator {
|
|||
builder.addTitle(LocaleController.getString("Language", R.string.Language), mkTransSpan(str, language, builder));
|
||||
builder.addCancelButton();
|
||||
builder.addButton(LocaleController.getString("SETTINGS", R.string.SETTINGS), (__) -> {
|
||||
builder.dismiss();
|
||||
activity.presentFragment(new LanguageSelectActivity());
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
@ -417,7 +416,6 @@ public class AlertsCreator {
|
|||
}
|
||||
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, UserConfig.selectedAccount);
|
||||
activity.rebuildAllFragments(true);
|
||||
builder.dismiss();
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.addCancelButton();
|
||||
|
|
|
@ -188,8 +188,6 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
|
|||
|
||||
builder.addItem(LocaleController.getString("BotShare",R.string.BotShare),R.drawable.baseline_send_24,false,(__) -> {
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
ShareUtil.shareText(getParentActivity(),"https://t.me/setlanguage/" + localeInfo.shortName.replace('_','-'));
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
@ -200,8 +198,6 @@ public class LanguageSelectActivity extends BaseFragment implements Notification
|
|||
|
||||
builder.addItem(LocaleController.getString("DeleteLocalizationTitle", R.string.DeleteLocalizationTitle), R.drawable.baseline_delete_24, true, (__) -> {
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
AlertUtil.showConfirm(getParentActivity(),
|
||||
LocaleController.getString("DeleteLocalizationTitle", R.string.DeleteLocalizationTitle),
|
||||
R.drawable.baseline_delete_24,
|
||||
|
|
|
@ -530,8 +530,6 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No
|
|||
NekoXConfig.customApi = target;
|
||||
NekoXConfig.saveCustomApi();
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
@ -891,8 +889,6 @@ public class LoginActivity extends BaseFragment implements NotificationCenter.No
|
|||
|
||||
}
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
|
|
@ -85,6 +85,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import kotlin.Unit;
|
||||
import okhttp3.HttpUrl;
|
||||
import tw.nekomimi.nekogram.BottomBuilder;
|
||||
|
@ -581,7 +582,12 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
ActionBarMenuItem addItem = menu.addItem(menu_add, R.drawable.add);
|
||||
|
||||
addItem.addSubItem(menu_add_import_from_clipboard, LocaleController.getString("ImportProxyFromClipboard", R.string.ImportProxyFromClipboard)).setOnClickListener((v) -> ProxyUtil.importFromClipboard());
|
||||
addItem.addSubItem(menu_add_import_from_clipboard, LocaleController.getString("ImportProxyFromClipboard", R.string.ImportProxyFromClipboard)).setOnClickListener((v) -> {
|
||||
|
||||
ProxyUtil.importFromClipboard(getParentActivity());
|
||||
|
||||
});
|
||||
|
||||
addItem.addSubItem(menu_add_scan_qr, LocaleController.getString("ScanQRCode", R.string.ScanQRCode)).setOnClickListener((v) -> {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
|
@ -827,9 +833,9 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
@SuppressLint("NewApi")
|
||||
private void addProxy() {
|
||||
|
||||
BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity());
|
||||
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
||||
|
||||
builder.setItems(new String[]{
|
||||
builder.addItems(new String[]{
|
||||
|
||||
LocaleController.getString("AddProxySocks5", R.string.AddProxySocks5),
|
||||
LocaleController.getString("AddProxyTelegram", R.string.AddProxyTelegram),
|
||||
|
@ -840,7 +846,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
LocaleController.getString("ImportProxyFromClipboard", R.string.ImportProxyFromClipboard),
|
||||
LocaleController.getString("ScanQRCode", R.string.ScanQRCode)
|
||||
|
||||
}, (v, i) -> {
|
||||
}, (i,t,c) -> {
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
|
@ -868,7 +874,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
} else if (i == 6) {
|
||||
|
||||
ProxyUtil.importFromClipboard();
|
||||
ProxyUtil.importFromClipboard(getParentActivity());
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -935,6 +941,8 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
}
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
||||
builder.show();
|
||||
|
@ -1121,8 +1129,6 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
if (sub.internal) return false;
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
presentFragment(new SubSettingsActivity(sub));
|
||||
|
||||
return true;
|
||||
|
@ -1133,15 +1139,17 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
builder.addButton(LocaleController.getString("Add", R.string.Add), false, true, (it) -> {
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
presentFragment(new SubSettingsActivity());
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
||||
builder.addButton(LocaleController.getString("Update", R.string.Update), (it) -> {
|
||||
String updateStr = LocaleController.getString("Update", R.string.Update);
|
||||
updateStr = updateStr.toLowerCase();
|
||||
updateStr = StrUtil.upperFirst(updateStr);
|
||||
|
||||
builder.addButton(updateStr, (it) -> {
|
||||
|
||||
AlertDialog pro = AlertUtil.showProgress(getParentActivity(), LocaleController.getString("SubscriptionUpdating", R.string.SubscriptionUpdating));
|
||||
AtomicBoolean canceled = new AtomicBoolean();
|
||||
|
@ -1179,14 +1187,7 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
updateRows(true);
|
||||
|
||||
UIUtil.runOnUIThread(() -> {
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
pro.dismiss();
|
||||
|
||||
});
|
||||
|
||||
UIUtil.runOnUIThread(pro::dismiss);
|
||||
|
||||
});
|
||||
|
||||
|
@ -1196,8 +1197,6 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
|
||||
builder.addButton(LocaleController.getString("OK", R.string.OK), (it) -> {
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
if (!toChange.isEmpty()) {
|
||||
|
||||
AlertDialog pro = AlertUtil.showProgress(getParentActivity());
|
||||
|
|
|
@ -529,13 +529,11 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
builder.addTitle(message);
|
||||
String finalMessage = message;
|
||||
builder.addItem(LocaleController.getString("Copy", R.string.Copy), R.drawable.baseline_content_copy_24, (it) -> {
|
||||
builder.dismiss();
|
||||
AndroidUtilities.addToClipboard(finalMessage);
|
||||
AlertUtil.showToast(LocaleController.getString("TextCopied", R.string.TextCopied));
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.addItem(BuildVars.LOGS_ENABLED ? LocaleController.getString("DebugMenuDisableLogs", R.string.DebugMenuDisableLogs) : LocaleController.getString("DebugMenuEnableLogs", R.string.DebugMenuEnableLogs), R.drawable.baseline_bug_report_24, (it) -> {
|
||||
builder.dismiss();
|
||||
BuildVars.LOGS_ENABLED = !BuildVars.LOGS_ENABLED;
|
||||
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
|
||||
sharedPreferences.edit().putBoolean("logsEnabled", BuildVars.LOGS_ENABLED).apply();
|
||||
|
@ -544,25 +542,21 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
|
|||
});
|
||||
if (!BuildVars.isUnknown) {
|
||||
builder.addItem(LocaleController.getString("CheckUpdate", R.string.CheckUpdate), R.drawable.baseline_system_update_24, (it) -> {
|
||||
builder.dismiss();
|
||||
UpdateChecksKt.checkUpdate(getParentActivity());
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
if (BuildConfig.BUILD_TYPE.startsWith("release")) {
|
||||
builder.addItem(LocaleController.getString("SwitchVersion", R.string.SwitchVersion), R.drawable.baseline_replay_24, (it) -> {
|
||||
builder.dismiss();
|
||||
UpdateChecksKt.switchVersion(getParentActivity());
|
||||
Browser.openUrl(getParentActivity(), "https://github.com/NekoX-Dev/NekoX/releases");
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
if (NekoXConfig.developerModeEntrance || NekoXConfig.developerMode) {
|
||||
builder.addItem(LocaleController.getString("DeveloperSettings", R.string.DeveloperSettings), R.drawable.baseline_developer_mode_24, (it) -> {
|
||||
builder.dismiss();
|
||||
BottomBuilder devBuilder = new BottomBuilder(getParentActivity());
|
||||
devBuilder.addTitle(LocaleController.getString("DevModeTitle", R.string.DevModeTitle), LocaleController.getString("DevModeNotice", R.string.DevModeNotice));
|
||||
devBuilder.addItem(LocaleController.getString("Continue", R.string.Continue), R.drawable.baseline_warning_24, true, (__) -> {
|
||||
devBuilder.dismiss();
|
||||
presentFragment(new NekoXSettingActivity());
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
|
|
@ -526,8 +526,6 @@ public class StickersActivity extends BaseFragment implements NotificationCenter
|
|||
|
||||
exportButton.set(builder.addButton(LocaleController.getString("Export", R.string.ExportStickers), (it) -> {
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
exportStickersFinal(exportSets.get(), exportArchived.get());
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
|
|
@ -228,14 +228,14 @@ class BottomBuilder(val ctx: Context) {
|
|||
@JvmOverloads
|
||||
fun addCancelItem() {
|
||||
|
||||
addItem(LocaleController.getString("Cancel", R.string.Cancel), R.drawable.baseline_cancel_24) { dismiss() }
|
||||
addItem(LocaleController.getString("Cancel", R.string.Cancel), R.drawable.baseline_cancel_24) {}
|
||||
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun addCancelButton(left: Boolean = true) {
|
||||
|
||||
addButton(LocaleController.getString("Cancel", R.string.Cancel), left = left) { dismiss() }
|
||||
addButton(LocaleController.getString("Cancel", R.string.Cancel), left = left) {}
|
||||
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ class BottomBuilder(val ctx: Context) {
|
|||
setText(text)
|
||||
typeface = AndroidUtilities.getTypeface("fonts/rmedium.ttf")
|
||||
(if (left) buttonsView else rightButtonsView).addView(this, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP or Gravity.LEFT))
|
||||
setOnClickListener { listener(this) }
|
||||
setOnClickListener { dismiss();listener(this) }
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,9 @@ class BottomBuilder(val ctx: Context) {
|
|||
|
||||
setOnClickListener {
|
||||
|
||||
if (listener == null) dismiss() else listener(this)
|
||||
dismiss()
|
||||
|
||||
listener?.invoke(this)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ object EmojiProvider {
|
|||
val font by lazy {
|
||||
if (!isFont) throw IllegalStateException()
|
||||
val resName = when {
|
||||
!type.contains("emoji") -> "blob_compat.ttf"
|
||||
!type.contains("Emoji") -> "blob_compat.ttf"
|
||||
else -> throw IllegalStateException()
|
||||
}
|
||||
Typeface.createFromAsset(ApplicationLoader.applicationContext.assets, "fonts/$resName");
|
||||
|
|
|
@ -475,8 +475,6 @@ public class ShadowsocksSettingsActivity extends BaseFragment {
|
|||
|
||||
onPreferenceChange(options.getText().toString());
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
|
|
@ -18,90 +18,6 @@ import tw.nekomimi.nekogram.NekoXConfig
|
|||
import tw.nekomimi.nekogram.utils.*
|
||||
import java.util.*
|
||||
|
||||
fun Activity.switchVersion() {
|
||||
|
||||
val builder = BottomBuilder(this)
|
||||
|
||||
fun addVersion(fPrefix: String, fSuffix: String, noGcm: Boolean) {
|
||||
|
||||
var buildType = "Release"
|
||||
|
||||
if (noGcm) buildType += "NoGcm"
|
||||
|
||||
builder.addItem("$fPrefix $buildType $fSuffix".trim()) {
|
||||
|
||||
val flavor = (fPrefix.toLowerCase() + fSuffix).trim()
|
||||
|
||||
buildType = StrUtil.lowerFirst(buildType)
|
||||
|
||||
val progress = AlertUtil.showProgress(this)
|
||||
|
||||
progress.show()
|
||||
|
||||
UIUtil.runOnIoDispatcher {
|
||||
|
||||
val ex = mutableListOf<Throwable>()
|
||||
|
||||
UpdateUtil.updateUrls.forEach { url ->
|
||||
|
||||
runCatching {
|
||||
|
||||
val updateInfo = JSONObject(HttpUtil.get("$url/update.json"))
|
||||
|
||||
val code = updateInfo.getInt("versionCode")
|
||||
|
||||
UIUtil.runOnUIThread {
|
||||
|
||||
progress.dismiss()
|
||||
|
||||
UpdateUtil.doUpdate(this, code, updateInfo.getString("defaultFlavor"), buildType, flavor)
|
||||
|
||||
}
|
||||
|
||||
return@runOnIoDispatcher
|
||||
|
||||
}.onFailure {
|
||||
|
||||
ex.add(it)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
progress.dismiss()
|
||||
|
||||
AlertUtil.showToast(ex.joinToString("\n") { it.message ?: it.javaClass.simpleName })
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun addVersion(fPrefix: String, fSuffix: String) {
|
||||
|
||||
addVersion(fPrefix, fSuffix, false)
|
||||
addVersion(fPrefix, fSuffix, true)
|
||||
|
||||
}
|
||||
|
||||
fun addVersion(fPrefix: String) {
|
||||
|
||||
arrayOf("", "NoEmoji", "Apple", "Noto", "Twitter", "Facebook").forEach {
|
||||
|
||||
addVersion(fPrefix, "${it}Emoji")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
addVersion("Full")
|
||||
addVersion("Mini")
|
||||
|
||||
builder.show()
|
||||
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun Activity.checkUpdate(force: Boolean = false) {
|
||||
|
||||
|
@ -194,24 +110,18 @@ fun Activity.checkUpdate(force: Boolean = false) {
|
|||
|
||||
UpdateUtil.doUpdate(this, code, updateInfo.getString("defaultFlavor"))
|
||||
|
||||
builder.dismiss()
|
||||
|
||||
NekoXConfig.preferences.edit().remove("ignored_update_at").remove("ignore_update_at").apply()
|
||||
|
||||
}
|
||||
|
||||
builder.addItem(LocaleController.getString("UpdateLater", R.string.UpdateLater), R.drawable.baseline_watch_later_24, false) {
|
||||
|
||||
builder.dismiss()
|
||||
|
||||
NekoXConfig.preferences.edit().putLong("ignored_update_at", System.currentTimeMillis()).apply()
|
||||
|
||||
}
|
||||
|
||||
builder.addItem(LocaleController.getString("Ignore", R.string.Ignore), R.drawable.baseline_block_24, true) {
|
||||
|
||||
builder.dismiss()
|
||||
|
||||
NekoXConfig.preferences.edit().putInt("ignore_update", code).apply()
|
||||
|
||||
}
|
||||
|
|
|
@ -309,8 +309,6 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
|
||||
}
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
@ -390,8 +388,6 @@ public class NekoGeneralSettingsActivity extends BaseFragment {
|
|||
|
||||
NekoConfig.setGoogleTranslateKey(key);
|
||||
|
||||
builder.dismiss();
|
||||
|
||||
return Unit.INSTANCE;
|
||||
|
||||
});
|
||||
|
|
|
@ -107,16 +107,7 @@ public class NekoSettingsActivity extends BaseFragment {
|
|||
} else if (position == donateRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://patreon.com/NekoXDev");
|
||||
} else if (position == translationRow) {
|
||||
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
||||
builder.addItem(LocaleController.getString("NekoTrans", R.string.NekoTrans), (__) -> {
|
||||
Browser.openUrl(getParentActivity(), "https://neko.crowdin.com/nekogram");
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.addItem(LocaleController.getString("NekoXTrans", R.string.NekoXTrans), (__) -> {
|
||||
Browser.openUrl(getParentActivity(), "https://nekox.crowdin.com/nekox");
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
builder.show();
|
||||
Browser.openUrl(getParentActivity(), "https://nekox.crowdin.com/nekox");
|
||||
} else if (position == googlePlayRow) {
|
||||
Browser.openUrl(getParentActivity(), "https://play.google.com/store/apps/details?id=nekox.messenger");
|
||||
} else if (position == sourceCodeRow) {
|
||||
|
|
|
@ -24,7 +24,7 @@ object SubManager {
|
|||
enable = public?.enable ?: true
|
||||
|
||||
urls = listOf(
|
||||
"https://gitlab.com/nekohasekai/nekox-proxy-list/-/raw/master/proxy_list",
|
||||
"https://gitlab.com/NekohaSekai/nekox-proxy-list/-/raw/master/proxy_list",
|
||||
"https://nekox-dev.github.io/ProxyList/proxy_list",
|
||||
"https://gitee.com/nekoshizuku/AwesomeRepo/raw/master/proxy_list"
|
||||
)
|
||||
|
|
|
@ -35,6 +35,14 @@ object AlertUtil {
|
|||
).show()
|
||||
})
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun showSimpleAlert(ctx: Context?, error: Throwable) {
|
||||
|
||||
showSimpleAlert(ctx,null, error.message ?: error.javaClass.simpleName) {}
|
||||
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun showSimpleAlert(ctx: Context?, text: String, listener: ((AlertDialog.Builder) -> Unit)? = null) {
|
||||
|
@ -160,8 +168,6 @@ object AlertUtil {
|
|||
|
||||
builder.addItem(button, icon, red) {
|
||||
|
||||
builder.dismiss()
|
||||
|
||||
listener.run()
|
||||
|
||||
}
|
||||
|
|
|
@ -98,25 +98,15 @@ object ProxyUtil {
|
|||
}
|
||||
|
||||
@JvmStatic
|
||||
fun importFromClipboard() {
|
||||
fun importFromClipboard(ctx: Activity) {
|
||||
|
||||
var text = (ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager).primaryClip?.getItemAt(0)?.text?.toString()
|
||||
|
||||
if (text != null) {
|
||||
|
||||
runCatching {
|
||||
|
||||
text = String(Base64.decode(text, Base64.NO_PADDING))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val proxies = mutableListOf<SharedConfig.ProxyInfo>()
|
||||
|
||||
var error = false
|
||||
|
||||
text?.split('\n')?.map { it.split(" ") }?.forEach {
|
||||
text?.trim()?.split('\n')?.map { it.split(" ") }?.forEach {
|
||||
|
||||
it.forEach { line ->
|
||||
|
||||
|
@ -132,6 +122,8 @@ object ProxyUtil {
|
|||
|
||||
runCatching { proxies.add(SharedConfig.parseProxyInfo(line)) }.onFailure {
|
||||
|
||||
error = true
|
||||
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink", R.string.BrokenLink) + ": ${it.message ?: it.javaClass.simpleName}")
|
||||
|
||||
}
|
||||
|
@ -142,12 +134,52 @@ object ProxyUtil {
|
|||
|
||||
}
|
||||
|
||||
runCatching {
|
||||
|
||||
if (proxies.isNullOrEmpty() && !error) {
|
||||
|
||||
String(Base64.decode(text, Base64.NO_PADDING)).trim().split('\n').map { it.split(" ") }.forEach { str ->
|
||||
|
||||
str.forEach { line ->
|
||||
|
||||
if (line.startsWith("tg://proxy") ||
|
||||
line.startsWith("tg://socks") ||
|
||||
line.startsWith("https://t.me/proxy") ||
|
||||
line.startsWith("https://t.me/socks") ||
|
||||
line.startsWith(VMESS_PROTOCOL) ||
|
||||
line.startsWith(VMESS1_PROTOCOL) ||
|
||||
line.startsWith(SS_PROTOCOL) ||
|
||||
line.startsWith(SSR_PROTOCOL) /*||
|
||||
line.startsWith(RB_PROTOCOL)*/) {
|
||||
|
||||
runCatching { proxies.add(SharedConfig.parseProxyInfo(line)) }.onFailure {
|
||||
|
||||
error = true
|
||||
|
||||
AlertUtil.showToast(LocaleController.getString("BrokenLink", R.string.BrokenLink) + ": ${it.message ?: it.javaClass.simpleName}")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (proxies.isNullOrEmpty()) {
|
||||
|
||||
if (!error) AlertUtil.showToast(LocaleController.getString("BrokenLink", R.string.BrokenLink))
|
||||
|
||||
return
|
||||
|
||||
} else if (!error){
|
||||
|
||||
AlertUtil.showSimpleAlert(ctx, LocaleController.getString("ImportedProxies",R.string.ImportedProxies) + "\n\n" + proxies.joinToString("\n") { it.title })
|
||||
|
||||
}
|
||||
|
||||
proxies.forEach {
|
||||
|
@ -206,7 +238,15 @@ object ProxyUtil {
|
|||
|
||||
FileLog.e(it)
|
||||
|
||||
AlertUtil.showToast("${LocaleController.getString("BrokenLink", R.string.BrokenLink)}: ${it.message}")
|
||||
if (BuildVars.LOGS_ENABLED){
|
||||
|
||||
AlertUtil.showSimpleAlert(ctx, it)
|
||||
|
||||
} else {
|
||||
|
||||
AlertUtil.showToast("${LocaleController.getString("BrokenLink", R.string.BrokenLink)}: ${it.message}")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -75,24 +75,18 @@ object UpdateUtil {
|
|||
|
||||
doUpdate(ctx, code, updateInfo.getString("defaultFlavor"))
|
||||
|
||||
builder.dismiss()
|
||||
|
||||
NekoXConfig.preferences.edit().remove("ignored_update_at").remove("ignore_update_at").apply()
|
||||
|
||||
}
|
||||
|
||||
builder.addItem(LocaleController.getString("UpdateLater", R.string.UpdateLater), R.drawable.baseline_watch_later_24, false) {
|
||||
|
||||
builder.dismiss()
|
||||
|
||||
NekoXConfig.preferences.edit().putLong("ignored_update_at", System.currentTimeMillis()).apply()
|
||||
|
||||
}
|
||||
|
||||
builder.addItem(LocaleController.getString("Ignore", R.string.Ignore), R.drawable.baseline_block_24, true) {
|
||||
|
||||
builder.dismiss()
|
||||
|
||||
NekoXConfig.preferences.edit().putInt("ignore_update", code).apply()
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user