diff --git a/app/src/main/java/io/github/qauxv/fragment/SearchOverlaySubFragment.kt b/app/src/main/java/io/github/qauxv/fragment/SearchOverlaySubFragment.kt index 2c69cf45..7cfc180a 100644 --- a/app/src/main/java/io/github/qauxv/fragment/SearchOverlaySubFragment.kt +++ b/app/src/main/java/io/github/qauxv/fragment/SearchOverlaySubFragment.kt @@ -56,6 +56,7 @@ import io.github.qauxv.dsl.func.IDslParentNode import io.github.qauxv.util.NonUiThread import io.github.qauxv.util.SyncUtils import io.github.qauxv.util.UiThread +import me.singleneuron.util.processSearchEasterEgg /** * The search sub fragment of [SettingsMainFragment] @@ -108,6 +109,7 @@ class SearchOverlaySubFragment { override fun onQueryTextSubmit(query: String) = false override fun onQueryTextChange(newText: String): Boolean { + processSearchEasterEgg(newText, requireContext()) search(newText) return false } diff --git a/app/src/main/java/io/github/qauxv/fragment/SettingsMainFragment.kt b/app/src/main/java/io/github/qauxv/fragment/SettingsMainFragment.kt index 51c7cba4..1aa97c40 100644 --- a/app/src/main/java/io/github/qauxv/fragment/SettingsMainFragment.kt +++ b/app/src/main/java/io/github/qauxv/fragment/SettingsMainFragment.kt @@ -35,6 +35,7 @@ import android.view.View import android.view.ViewGroup import android.view.animation.AlphaAnimation import android.widget.FrameLayout +import androidx.appcompat.app.AlertDialog import androidx.appcompat.widget.SearchView import androidx.core.content.res.ResourcesCompat import androidx.lifecycle.lifecycleScope @@ -43,9 +44,8 @@ import androidx.recyclerview.widget.RecyclerView import cc.ioctl.util.LayoutHelper.MATCH_PARENT import cc.ioctl.util.ui.drawable.BackgroundDrawableUtils import io.github.qauxv.R -import io.github.qauxv.util.SyncUtils -import io.github.qauxv.util.SyncUtils.async -import io.github.qauxv.util.SyncUtils.runOnUiThread +import io.github.qauxv.bridge.AppRuntimeHelper +import io.github.qauxv.bridge.ContactUtils import io.github.qauxv.config.ConfigManager import io.github.qauxv.core.MainHook import io.github.qauxv.dsl.FunctionEntryRouter @@ -60,8 +60,12 @@ import io.github.qauxv.dsl.item.DslTMsgListItemInflatable import io.github.qauxv.dsl.item.SimpleListItem import io.github.qauxv.dsl.item.TMsgListItem import io.github.qauxv.dsl.item.UiAgentItem +import io.github.qauxv.util.SyncUtils +import io.github.qauxv.util.SyncUtils.async +import io.github.qauxv.util.SyncUtils.runOnUiThread import io.github.qauxv.util.UiThread import kotlinx.coroutines.flow.MutableStateFlow +import me.singleneuron.util.forSuBanXia class SettingsMainFragment : BaseRootLayoutFragment() { @@ -185,6 +189,22 @@ class SettingsMainFragment : BaseRootLayoutFragment() { override fun onResume() { super.onResume() + try { + if (ContactUtils.getBuddyName(AppRuntimeHelper.getAppRuntime()!!, AppRuntimeHelper.getAccount()) + ?.contains("\uD83C\uDFF3\uFE0F\u200D\u26A7\uFE0F") == true && + ConfigManager.forAccount(AppRuntimeHelper.getLongAccountUin()).getBoolean("ForSuBanXia", true) + ) { + AlertDialog.Builder(requireContext()) + .setTitle(forSuBanXia.first) + .setMessage(forSuBanXia.second + "\n\n当你心情低落的时候,就在QA的搜索里输入MtF/FtM回来看看我吧! ^_^") + .setPositiveButton("OK", null) + .create() + .show() + ConfigManager.forAccount(AppRuntimeHelper.getLongAccountUin()).putBoolean("ForSuBanXia", false) + } + } catch (e: Exception) { + //ignored + } if (!mTargetUiAgentNavId.isNullOrEmpty() && !mTargetUiAgentNavigated) { navigateToTargetUiAgentItem() } diff --git a/app/src/main/java/me/singleneuron/util/EasterEggsForTheNonexistent.kt b/app/src/main/java/me/singleneuron/util/EasterEggsForTheNonexistent.kt new file mode 100644 index 00000000..9906bfb3 --- /dev/null +++ b/app/src/main/java/me/singleneuron/util/EasterEggsForTheNonexistent.kt @@ -0,0 +1,56 @@ +/* + * QAuxiliary - An Xposed module for QQ/TIM + * Copyright (C) 2019-2022 qwq233@qwq2333.top + * https://github.com/cinit/QAuxiliary + * + * This software is non-free but opensource software: you can redistribute it + * and/or modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation; either + * version 3 of the License, or any later version and our eula as published + * by QAuxiliary contributors. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * and eula along with this software. If not, see + * + * . + */ + +package me.singleneuron.util + +import android.content.Context +import android.util.Base64 +import androidx.appcompat.app.AlertDialog + +fun processSearchEasterEgg(text: String, context: Context) { + for (pair in easterEggsMap) { + for (key in pair.key) { + if (text.contains(key, true)) { + AlertDialog.Builder(context) + .setTitle(pair.value.first) + .setMessage(pair.value.second) + .setPositiveButton("OK", null) + .create() + .show() + return + } + } + } +} + +private val easterEggsMap by lazy { + hashMapOf( + arrayOf("\uD83C\uDFF3\uFE0F\u200D\u26A7\uFE0F", "mtf", "mtx", "ftm", "ftx", "transgender") to forSuBanXia, + ) +} + +val forSuBanXia: Pair = (String(Base64.decode("Rm9yIHVzIA==", Base64.DEFAULT)) + "\uD83C\uDFF3\uFE0F\u200D\u26A7\uFE0F" to String( + Base64.decode( + "5oS/5q+P5LiA5Liq5Lq66YO96IO96Ieq55Sx55qE55Sf5rS75Zyo6Ziz5YWJ5LiL77yM5oS/5oiR55qE6byT5Yqx5LiO5YuH5rCU6ZqPUUF1eGlsaWFyeeS8tOS9oOi6q+aXgeOAggoKCQkJCeKAlOKAlENyeW9saXRpYSwgYW4gZXhvcmRpbmFyeSBkZXZlbG9wZXIsIGFuIG9yZGluYXJ5IE10Rg==", + Base64.CRLF + ) +)) diff --git a/build-logic/convention/src/main/kotlin/Version.kt b/build-logic/convention/src/main/kotlin/Version.kt index f7ab349f..8e272e2b 100644 --- a/build-logic/convention/src/main/kotlin/Version.kt +++ b/build-logic/convention/src/main/kotlin/Version.kt @@ -1,3 +1,4 @@ +import org.apache.tools.ant.taskdefs.condition.Os import org.gradle.api.JavaVersion import org.gradle.api.Project import java.io.File @@ -9,7 +10,7 @@ object Version { val java = JavaVersion.VERSION_11 const val compileSdkVersion = 33 - const val buildToolsVersion = "33.0.0" + val buildToolsVersion = if (Os.isFamily(Os.FAMILY_WINDOWS)) "32.0.0" else "33.0.0" const val minSdk = 24 const val targetSdk = 33 const val versionName = "1.3.4"