Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from gkd-kit:main #37

Merged
merged 7 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/Build-Apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ jobs:
- run: chmod 777 ./gradlew
- run: ./gradlew app:assemble

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: outputs
path: app/build/outputs

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: release
path: app/build/outputs/apk/release

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: debug
path: app/build/outputs/apk/debug
17 changes: 13 additions & 4 deletions .github/workflows/Build-Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,40 @@ jobs:
- run: chmod 777 ./gradlew
- run: ./gradlew app:assemble

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: outputs
path: app/build/outputs

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: release
path: app/build/outputs/apk/release

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: debug
path: app/build/outputs/apk/debug

- uses: actions/upload-artifact@v4
with:
name: CHANGELOG.md
path: CHANGELOG.md

release:
needs: build
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: outputs
path: outputs

- uses: actions/download-artifact@v4
with:
name: CHANGELOG.md

- run: ls -R

- id: create_release
Expand Down
62 changes: 16 additions & 46 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,21 @@
# v1.7.3
# v1.8.0-beta.1

## 优化和修复

- 首页-订阅列表-右下角按钮遮挡
- 订阅 checkUpdateUrl 支持相对地址

## v1.7.2

- 修复选择器关系操作符的缓存错误导致某些情况下无法正确选择节点
请注意这是一个测试版本(可能包含BUG), 正式版本暂时不会收到更新

## v1.7.1
如果您在使用的过程中遇到BUG, 请到 [issues](https://github.com/gkd-kit/gkd/issues) 提交, 记得带上日志

- 订阅的应用列表点击右侧开关后无故滑动到顶部
以下是本次更新的主要内容

## v1.7.0

- 使用新的应用图标
- 规避法律风险, 移除自带的默认订阅, 新安装应用初始状态不带任何规则(旧用户不受影响)
- 主页-新增应用TAB, 可在此查看此应用的规则汇总, 也可跳转至本地订阅新增规则
- 主页-新增使用说明, 点击即可跳转 GKD 官网
- 主页-新增缓慢查询页面入口, 此界面会标识哪些规则可能导致查询缓慢或更多耗电
- 全局规则页面-新增自定义禁用界面,此界面显示所有应用列表及其开关
- 触发记录页面-新增移除禁用(用户点击此页面禁用后再点击即可移除禁用)
- 高级设置界面-开启服务器后点击地址或在电脑上浏览器地址栏输入即可自动跳转并连接
- 应用规则界面-不再强制显示裁剪后圆形应用图标, 但如果在系统主题切换桌面图标, 你需要重启 GKD 才能更新显示 GKD 获取到的图标
- 优化 toast 显示策略, 并修复 toast 显示位置不准确的问题
- 设置-点击提示的初始默认值由 跳过 变更为 GKD (旧用户不受影响)
- 订阅-新增 matchSystemApp 字段, 此字段允许全局规则不匹配系统应用
- 订阅-新增 scopeKeys 字段, 此字段允许多个规则组共享作用域
- 订阅-新增 order 字段, 此字段允许规则自定义执行顺序
- 订阅-新增 versionCodes/excludeVersionCodes/versionNames/excludeVersionNames 筛选应用版本
- 订阅-新增 position 字段, 使用数字表达式允许用户计算自定义点击位置
- 订阅-新增 forcedTime 字段, 可以主动查询界面(无需系统通知), 解决某些 flutter/webview/特殊SDK 页面不点击的问题(因为它们改变页面不通知系统)
- 优化选择器在使用元组表达式时仍然获取未使用节点造成更多耗时的问题, 如旧版本 -(1,4) 仍然调用获取节点 2,3 的接口造成更多耗时
- 优化选择器在使用 +- 连接符造成更多耗时的问题, 使用缓存记录 index 而无需回溯批量获取兄弟节点
- 选择器新增属性表达式类型严格校验, 操作符类型不匹配如 a>false 将会报语法错误 (已更新到审查工具)
- 选择器新增属性名校验, 属性名类型不匹配如 index='' 和未知属性 a114514>0 将会标记非法选择器 (已更新到审查工具)
- 选择器属性表达式的值新增支持负数, 旧版本仅支持 10 进制自然数, 新版本支持 10 进制整数
- 选择器-新增 `~=`/`!~=` 操作符, 支持匹配正则表达式和特殊匹配优化
- 优化 click 的执行逻辑, 如果点击节点不成功将使用 clickCenter, 注意点击不成功只是系统返回结果, 并不代表应用接受点击
- 在有 shizuku 授权的情况下, clickCenter 为强制模拟点击, 这可以绕过某些应用的无障碍防御
- 优化了大号字体造成字体显示被裁剪的问题
- 优化了一些界面上的体验
- 修复一些错误

## 通过以下任意方式更新
## 优化和修复

- 打开 APP - 设置 - 检测更新
- 前往首页 <https://gkd.li/guide/>
- 通过 github [releases](https://github.com/gkd-kit/gkd/releases)
- 优化了很多界面UI
- 新增导入导出规则/配置数据
- 优化应用搜索支持忽略大小写
- 适配国产ROM应用列表权限
- 应用规则组的编辑框新增支持输入 App 类型
- 修复全局规则 matchSystemApp=false 不生效的问题
- 修复规则 resetMatch=app 在某些情况下无效的问题
- 修复订阅列表拖动排序错乱的问题
- 修复在某些机型上无故重启进程导致匹配范围短时间失效的错误点击问题
- 隐藏 Android>=12 上截图服务开关
- 其它优化和错误修复
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

| | | | |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| ![img](https://github.com/gkd-kit/gkd/assets/38517192/e99f43b7-2247-4682-9981-f5d4ec9b483f) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/2d22ee71-d6fd-4dfe-b52f-d73df02f5009) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/b2deafde-d933-402f-a9ce-ebae521b439f) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/7be30706-3e76-4685-b853-3294c362999f) |
| ![img](https://github.com/gkd-kit/gkd/assets/38517192/1cca31e6-ab1e-4f05-b2bb-ce4844029d52) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/905c2f8d-6af4-4870-b00e-27f6844467aa) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/79f4b6cd-c9c9-4c58-a613-f7f8951dfa61) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/43f7024c-2227-4476-b90c-7dc6f1e4264d) |
| ![img](https://github.com/gkd-kit/gkd/assets/38517192/79b8a829-4106-415f-9659-2920f7b5ccb5) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/6755a005-33c2-4db9-acda-bac1e7a3632d) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/91ea9329-e943-4ea8-bb6e-987c22ac7b4d) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/1d672345-cf3e-4b2c-a606-53a53642abda) |
| ![img](https://github.com/gkd-kit/gkd/assets/38517192/b600fa5d-284d-4dc8-9f8b-095826a73d95) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/aad60a98-ffa2-4c23-a934-92e65f6018ec) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/544c6aad-e2ee-42d6-9a1a-967d9d426bc9) | ![img](https://github.com/gkd-kit/gkd/assets/38517192/dd262506-b1d3-4c25-b52c-765ad6de6a1e) |

## 订阅

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ android {
targetSdk = libs.versions.targetSdk.get().toInt()

applicationId = "li.songe.gkd"
versionCode = 28
versionName = "1.7.3"
versionCode = 29
versionName = "1.8.0-beta.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
20 changes: 17 additions & 3 deletions app/src/main/kotlin/li/songe/gkd/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.activity.viewModels
import androidx.compose.runtime.CompositionLocalProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.compose.rememberNavController
import com.blankj.utilcode.util.ServiceUtils
import com.dylanc.activityresult.launcher.PickContentLauncher
import com.dylanc.activityresult.launcher.StartActivityLauncher
import com.ramcosta.composedestinations.DestinationsNavHost
Expand All @@ -20,8 +21,12 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import li.songe.gkd.composition.CompositionActivity
import li.songe.gkd.composition.CompositionExt.useLifeCycleLog
import li.songe.gkd.debug.FloatingService
import li.songe.gkd.debug.HttpService
import li.songe.gkd.debug.ScreenshotService
import li.songe.gkd.permission.AuthDialog
import li.songe.gkd.permission.updatePermissionState
import li.songe.gkd.service.GkdAbService
import li.songe.gkd.service.ManageService
import li.songe.gkd.service.updateLauncherAppId
import li.songe.gkd.ui.NavGraphs
Expand Down Expand Up @@ -93,6 +98,11 @@ class MainActivity : CompositionActivity({
}

updatePermissionState()

// 进程崩溃后重新打开应用, 由于存在缓存导致服务状态可能不正确, 在此保证每次界面切换都能重新刷新状态
appScope.launch(Dispatchers.IO) {
updateServiceRunning()
}
}

override fun onStop() {
Expand All @@ -114,6 +124,10 @@ fun Activity.navToMainActivity() {
finish()
}




fun updateServiceRunning() {
ManageService.isRunning.value = ServiceUtils.isServiceRunning(ManageService::class.java)
GkdAbService.isRunning.value = ServiceUtils.isServiceRunning(GkdAbService::class.java)
FloatingService.isRunning.value = ServiceUtils.isServiceRunning(FloatingService::class.java)
ScreenshotService.isRunning.value = ServiceUtils.isServiceRunning(ScreenshotService::class.java)
HttpService.isRunning.value = ServiceUtils.isServiceRunning(HttpService::class.java)
}
4 changes: 4 additions & 0 deletions app/src/main/kotlin/li/songe/gkd/data/AppInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ data class AppInfo(
val hidden: Boolean,
)

val selfAppInfo by lazy {
app.packageManager.getPackageInfo(app.packageName, 0).toAppInfo()!!
}

/**
* 平均单次调用时间 11ms
*/
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/li/songe/gkd/data/BaseSnapshot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface BaseSnapshot {
val appId: String?
val activityId: String?
val appName: String?
val appVersionCode: Int?
val appVersionCode: Long?
val appVersionName: String?

val screenHeight: Int
Expand Down
32 changes: 16 additions & 16 deletions app/src/main/kotlin/li/songe/gkd/data/ComplexSnapshot.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package li.songe.gkd.data

import com.blankj.utilcode.util.AppUtils
import com.blankj.utilcode.util.ScreenUtils
import kotlinx.serialization.Serializable
import li.songe.gkd.BuildConfig
import li.songe.gkd.app
import li.songe.gkd.service.GkdAbService
import li.songe.gkd.service.getAndUpdateCurrentRules
import li.songe.gkd.service.safeActiveWindow
Expand All @@ -14,18 +13,22 @@ data class ComplexSnapshot(

override val appId: String?,
override val activityId: String?,
override val appName: String?,
override val appVersionCode: Int?,
override val appVersionName: String?,

override val screenHeight: Int,
override val screenWidth: Int,
override val isLandscape: Boolean,

val gkdVersionCode: Int = BuildConfig.VERSION_CODE,
val gkdVersionName: String = BuildConfig.VERSION_NAME,
val appInfo: AppInfo? = appId?.let { app.packageManager.getPackageInfo(appId, 0)?.toAppInfo() },
val gkdAppInfo: AppInfo? = selfAppInfo,
val device: DeviceInfo = DeviceInfo.instance,

@Deprecated("use appInfo")
override val appName: String? = appInfo?.name,
@Deprecated("use appInfo")
override val appVersionCode: Long? = appInfo?.versionCode,
@Deprecated("use appInfo")
override val appVersionName: String? = appInfo?.versionName,

val device: DeviceInfo,
val nodes: List<NodeInfo>,
) : BaseSnapshot

Expand All @@ -34,21 +37,17 @@ fun createComplexSnapshot(): ComplexSnapshot {
val currentAbNode = GkdAbService.service?.safeActiveWindow
val appId = currentAbNode?.packageName?.toString()
val currentActivityId = getAndUpdateCurrentRules().topActivity.activityId
val appInfo = if (appId == null) null else AppUtils.getAppInfo(appId)

return ComplexSnapshot(
id = System.currentTimeMillis(),

appId = appId,
activityId = currentActivityId,
appName = appInfo?.name,
appVersionCode = appInfo?.versionCode,
appVersionName = appInfo?.versionName,

screenHeight = ScreenUtils.getScreenHeight(),
screenWidth = ScreenUtils.getScreenWidth(),
isLandscape = ScreenUtils.isLandscape(),
device = DeviceInfo.instance,

nodes = NodeInfo.info2nodeList(currentAbNode)
)
}
Expand All @@ -59,13 +58,14 @@ fun ComplexSnapshot.toSnapshot(): Snapshot {

appId = appId,
activityId = activityId,
appName = appName,
appVersionCode = appVersionCode,
appVersionName = appVersionName,

screenHeight = screenHeight,
screenWidth = screenWidth,
isLandscape = isLandscape,

appName = appInfo?.name,
appVersionCode = appInfo?.versionCode,
appVersionName = appInfo?.versionName,
)
}

Expand Down
5 changes: 0 additions & 5 deletions app/src/main/kotlin/li/songe/gkd/data/DeviceInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package li.songe.gkd.data

import android.os.Build
import kotlinx.serialization.Serializable
import li.songe.gkd.BuildConfig

@Serializable
data class DeviceInfo(
Expand All @@ -12,8 +11,6 @@ data class DeviceInfo(
val brand: String,
val sdkInt: Int,
val release: String,
val gkdVersionCode: Int,
val gkdVersionName: String
) {
companion object {
val instance by lazy {
Expand All @@ -24,8 +21,6 @@ data class DeviceInfo(
brand = Build.BRAND,
sdkInt = Build.VERSION.SDK_INT,
release = Build.VERSION.RELEASE,
gkdVersionCode = BuildConfig.VERSION_CODE,
gkdVersionName = BuildConfig.VERSION_NAME,
)
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/kotlin/li/songe/gkd/data/RpcError.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ import kotlinx.serialization.Serializable
data class RpcError(
override val message: String,
@SerialName("__error") val error: Boolean = true,
val unknown: Boolean = false,
) : Exception(message)
2 changes: 1 addition & 1 deletion app/src/main/kotlin/li/songe/gkd/data/Snapshot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data class Snapshot(
@ColumnInfo(name = "app_id") override val appId: String?,
@ColumnInfo(name = "activity_id") override val activityId: String?,
@ColumnInfo(name = "app_name") override val appName: String?,
@ColumnInfo(name = "app_version_code") override val appVersionCode: Int?,
@ColumnInfo(name = "app_version_code") override val appVersionCode: Long?,
@ColumnInfo(name = "app_version_name") override val appVersionName: String?,

@ColumnInfo(name = "screen_height") override val screenHeight: Int,
Expand Down
Loading