From fc45b7fc5b082ead549fb542c4811d6e826ef62a Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Wed, 21 Sep 2022 16:10:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=EF=BC=9Agradle=E5=8F=8A?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 13 +++--- app/proguard-rules.pro | 9 +++- app/src/main/AndroidManifest.xml | 5 +- .../sms/forwarder/activity/MainActivity.kt | 46 ++++++++++++------- app/src/main/res/values-en/strings.xml | 10 ++-- app/src/main/res/values/strings.xml | 10 ++-- app/x-library.gradle | 8 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- versions.gradle | 8 ++-- 9 files changed, 65 insertions(+), 46 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ea9d1a71..f49e6740 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -162,15 +162,16 @@ android { } } - lintOptions { - abortOnError false - } sourceSets { main { jniLibs.srcDirs = ['libs'] } } + lint { + abortOnError false + } + namespace 'com.idormy.sms.forwarder' } @@ -183,11 +184,11 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation deps.espresso.core - implementation 'androidx.core:core-ktx:1.8.0' + implementation 'androidx.core:core-ktx:1.9.0' implementation "androidx.activity:activity-ktx:1.5.1" - implementation "androidx.fragment:fragment-ktx:1.5.1" + implementation "androidx.fragment:fragment-ktx:1.5.2" implementation "androidx.cardview:cardview:1.0.0" - implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'androidx.appcompat:appcompat:1.5.1' implementation 'androidx.preference:preference-ktx:1.2.0' //分包 diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index d2a696ec..df6e9228 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -285,4 +285,11 @@ -keep class javax.mail.** { *;} -keep class javax.activation.** { *;} -keep class com.smailnet.emailkit.** { *;} --keep class com.idormy.sms.forwarder.utils.mail.** {*;} \ No newline at end of file +-keep class com.idormy.sms.forwarder.utils.mail.** {*;} + +-keep public class com.xuexiang.xrouter.routes.**{*;} +-keep class * implements com.xuexiang.xrouter.facade.template.ISyringe{*;} +# 如果使用了 byType 的方式获取 Service,需添加下面规则,保护接口 +-keep interface * implements com.xuexiang.xrouter.facade.template.IProvider +# 如果使用了 单类注入,即不定义接口实现 IProvider,需添加下面规则,保护实现 +-keep class * implements com.xuexiang.xrouter.facade.template.IProvider diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 53359301..28c2814e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + tools:ignore="DataExtractionRules,LockedOrientationActivity,UnusedAttribute"> (), R.id.nav_frpc -> { if (!FileUtils.isFileExists(filesDir.absolutePath + "/libs/libgojni.so")) { MaterialDialog.Builder(this) - .title(String.format(getString(R.string.frpclib_download_title), FRPC_LIB_VERSION)) + .title( + String.format( + getString(R.string.frpclib_download_title), + FRPC_LIB_VERSION + ) + ) .content(R.string.download_frpc_tips) .positiveText(R.string.lab_yes) .negativeText(R.string.lab_no) @@ -196,9 +201,15 @@ class MainActivity : BaseActivity(), binding!!.includeMain.toolbar.title = item.title binding!!.includeMain.toolbar.menu.clear() when { - item.title.equals(getString(R.string.menu_rules)) -> binding!!.includeMain.toolbar.inflateMenu(R.menu.menu_rules) - item.title.equals(getString(R.string.menu_senders)) -> binding!!.includeMain.toolbar.inflateMenu(R.menu.menu_senders) - item.title.equals(getString(R.string.menu_settings)) -> binding!!.includeMain.toolbar.inflateMenu(R.menu.menu_settings) + getString(R.string.menu_rules) == item.title -> binding!!.includeMain.toolbar.inflateMenu( + R.menu.menu_rules + ) + getString(R.string.menu_rules) == item.title -> binding!!.includeMain.toolbar.inflateMenu( + R.menu.menu_senders + ) + getString(R.string.menu_rules) == item.title -> binding!!.includeMain.toolbar.inflateMenu( + R.menu.menu_settings + ) else -> binding!!.includeMain.toolbar.inflateMenu(R.menu.menu_logs) } item.isChecked = true @@ -232,11 +243,12 @@ class MainActivity : BaseActivity(), * @return */ private fun handleNavigationItemSelected(menuItem: MenuItem): Boolean { - val index = CollectionUtils.arrayIndexOf(mTitles, menuItem.title) - if (index != -1) { - binding!!.includeMain.toolbar.title = menuItem.title - binding!!.includeMain.viewPager.setCurrentItem(index, false) - return true + for (index in mTitles.indices) { + if (mTitles[index] == menuItem.title) { + binding!!.includeMain.toolbar.title = menuItem.title + binding!!.includeMain.viewPager.setCurrentItem(index, false) + return true + } } return false } @@ -273,7 +285,8 @@ class MainActivity : BaseActivity(), } R.id.action_add_sender -> { val dialog = BottomSheetDialog(this) - val view: View = LayoutInflater.from(this).inflate(R.layout.dialog_sender_bottom_sheet, null) + val view: View = + LayoutInflater.from(this).inflate(R.layout.dialog_sender_bottom_sheet, null) val recyclerView: RecyclerView = view.findViewById(R.id.recyclerView) WidgetUtils.initGridRecyclerView(recyclerView, 4, DensityUtils.dp2px(1f)) @@ -312,12 +325,13 @@ class MainActivity : BaseActivity(), * @return */ override fun onNavigationItemSelected(menuItem: MenuItem): Boolean { - val index = CollectionUtils.arrayIndexOf(mTitles, menuItem.title) - if (index != -1) { - binding!!.includeMain.toolbar.title = menuItem.title - binding!!.includeMain.viewPager.setCurrentItem(index, false) - updateSideNavStatus(menuItem) - return true + for (index in mTitles.indices) { + if (mTitles[index] == menuItem.title) { + binding!!.includeMain.toolbar.title = menuItem.title + binding!!.includeMain.viewPager.setCurrentItem(index, false) + updateSideNavStatus(menuItem) + return true + } } return false } diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 22a57aa6..a79c353c 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -616,7 +616,7 @@ Some permissions are successfully obtained, but some permissions are not granted normally, and some functions of the APP may be limited! Permanently denied authorization, go to system settings to manually grant permissions? Failed to obtain necessary permissions, APP function may be limited! - \n    首次使用请按照1234步骤顺序设置,数字点亮表示该步骤已设置(4点亮表示有成功日志)!\n\n    根据以往用户反馈,90%的新用户最终排查结果都是手机权限设置问题,5%的用户是APP保活问题,其他问题排查参考Wiki中的常见问题(APP右上角使用帮助入口)\n\n    强烈建议: 手动排查一下系统设置: 自启动、电源策略、APP的权限,把所有权限打开(始终允许,不要“使用中允许”,MIUI系统就全部变绿),特别是一些国产定制系统加入隐私保护、验证码保护等(例如: MIUI 系统的 空白通行证)\n\n    请选择是否立即“前往系统设置”检查,或“稍后自行处理”? + \n    首次使用请按照1234步骤顺序设置,数字点亮表示该步骤已设置(4点亮表示有成功日志)!\n\n    根据以往用户反馈,90%的新用户最终排查结果都是手机权限设置问题,5%的用户是APP保活问题,其他问题排查参考Wiki中的常见问题(APP右上角使用帮助入口)\n\n    强烈建议: 手动排查一下系统设置: 自启动、电源策略、APP的权限,把所有权限打开(始终允许,不要“使用中允许”,MIUI系统就全部变绿),特别是一些国产定制系统加入隐私保护、验证码保护等(例如: MIUI 系统的 空白通行证)\n\n    请选择是否立即“前往系统设置”检查,或“稍后自行处理”? Play Silent Music Play silent music to keep running in the background, which may consume more power, enable it on demand One Pixel @@ -684,7 +684,7 @@ Immediately display notifications Time-sensitive notifications that can be displayed in a focused state Only added to the notification list, no screen reminder - + Url format error Fill in the username before @ @@ -699,7 +699,7 @@ Webhook Server For example: https://a.b.com/msg?token=xyz Params - For example: payload=%7B%22text%22%3A%22[msg]%22%7D [msg] will be replaced with SMS content.\nJson format is supported, for example: {\"text\":\"[msg]\"}.\nNote: msg is automatically UTF-8 encoded except in JSON format + For example: payload=%7B%22text%22%3A%22[msg]%22%7D [msg] will be replaced with SMS content.\nJson format is supported, for example: {\"text\":\"[msg]\"}.\nNote: msg is automatically UTF-8 encoded except in JSON format Secret: If it is empty, the sign will not be calculated Headers Key @@ -839,7 +839,7 @@ Remote SMS: Clear Unauthorized storage permission, this function cannot be used! - Name:%s\nPhone:%s + Name:%s\nPhone:%s Card slot does not match the rule Unmatched rule Copied to clipboard:\n%s @@ -864,7 +864,7 @@ Sign verify failed version_code required The app versions of the client and server are inconsistent - The timestamp verification failed, and the difference with the server time (%s) cannot exceed 1 hour (diffTime=%s) + The timestamp verification failed, and the difference with the server time (%s) cannot exceed 1 hour (diffTime=%s) Main title Subtitle diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8a2fab25..a6fc2b9b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -617,7 +617,7 @@ 获取部分权限成功,但部分权限未正常授予,APP部分功能可能受限! 被永久拒绝授权,前往系统设置手动授予权限? 获取必需的权限失败,APP功能可能受限! - \n    首次使用请按照1234步骤顺序设置,数字点亮表示该步骤已设置(4点亮表示有成功日志)!\n\n    根据以往用户反馈,90%的新用户最终排查结果都是手机权限设置问题,5%的用户是APP保活问题,其他问题排查参考Wiki中的常见问题(APP右上角使用帮助入口)\n\n    强烈建议:手动排查一下系统设置:自启动、电源策略、APP的权限,把所有权限打开(始终允许,不要“使用中允许”,MIUI系统就全部变绿),特别是一些国产定制系统加入隐私保护、验证码保护等(例如:MIUI 系统的 空白通行证)\n\n    请选择是否立即“前往系统设置”检查,或“稍后自行处理”? + \n    首次使用请按照1234步骤顺序设置,数字点亮表示该步骤已设置(4点亮表示有成功日志)!\n\n    根据以往用户反馈,90%的新用户最终排查结果都是手机权限设置问题,5%的用户是APP保活问题,其他问题排查参考Wiki中的常见问题(APP右上角使用帮助入口)\n\n    强烈建议:手动排查一下系统设置:自启动、电源策略、APP的权限,把所有权限打开(始终允许,不要“使用中允许”,MIUI系统就全部变绿),特别是一些国产定制系统加入隐私保护、验证码保护等(例如:MIUI 系统的 空白通行证)\n\n    请选择是否立即“前往系统设置”检查,或“稍后自行处理”? 后台播放无声音乐 【按需启用】播放无声音乐让后台一直运行,可能比较耗电 1像素 @@ -685,7 +685,7 @@ 立即亮屏显示通知 时效性通知,可在专注状态下显示通知 仅添加到通知列表,不会亮屏提醒 - + Url格式错误 填写 @ 前面的用户名 @@ -700,7 +700,7 @@ Webhook Server 例如:https://a.b.com/msg?token=xyz Params - 例如:payload=%7B%22text%22%3A%22[msg]%22%7D [msg]将被替换成短信内容。\n支持Json格式,例如:{\"text\":\"[msg]\"}。\n注意:除JSON格式外,msg会自动进行UTF-8编码 + 例如:payload=%7B%22text%22%3A%22[msg]%22%7D [msg]将被替换成短信内容。\n支持Json格式,例如:{\"text\":\"[msg]\"}。\n注意:除JSON格式外,msg会自动进行UTF-8编码 Secret:置空则不计算sign Headers Key @@ -840,7 +840,7 @@ 远程发短信: 清除 未授权储存权限,该功能无法使用! - 姓名:%s\n号码:%s + 姓名:%s\n号码:%s 卡槽未匹配中规则 未匹配中规则 已复制到剪贴板:\n%s @@ -865,7 +865,7 @@ 签名校验失败 version_code节点必传 客户端与服务端的App版本不一致 - timestamp校验失败,与服务器时间(%s)误差不能超过1小时(diffTime=%s) + timestamp校验失败,与服务器时间(%s)误差不能超过1小时(diffTime=%s) 主标题 副标题 diff --git a/app/x-library.gradle b/app/x-library.gradle index b8276335..2ede0467 100644 --- a/app/x-library.gradle +++ b/app/x-library.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.xuexiang.xrouter' apply plugin: 'kotlin-kapt' -apply plugin: 'android-aspectjx' +//apply plugin: 'android-aspectjx' apply plugin: 'com.xuexiang.xaop' //自动添加依赖 @@ -53,6 +53,6 @@ configurations.all { } // 这里需要修改包名 -aspectjx { - include 'com.idormy.sms.forwarder' -} \ No newline at end of file +//aspectjx { +// include 'com.idormy.sms.forwarder' +//} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5479d75c..8d3ded4a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip diff --git a/versions.gradle b/versions.gradle index dddadafa..5ee9f529 100644 --- a/versions.gradle +++ b/versions.gradle @@ -5,13 +5,13 @@ def build_versions = [:] build_versions.version_code = 47 build_versions.version_name = "3.0.9" build_versions.min_sdk = 19 -build_versions.target_sdk = 32 -build_versions.build_tools = "32.0.0" +build_versions.target_sdk = 33 +build_versions.build_tools = "33.0.0" ext.build_versions = build_versions ext.deps = [:] def versions = [:] -versions.android_gradle_plugin = '7.1.3' +versions.android_gradle_plugin = '7.3.0' versions.android_maven_gradle_plugin = "2.1" versions.gradle_bintray_plugin = "1.8.0" versions.booster = "3.1.0" @@ -215,7 +215,7 @@ project.buildscript.configurations.each { configuration -> //XRouter插件 configuration.dependencies.add(dependencies.create(deps.xlibrary.xrouter_plugin)) //AspectJX - configuration.dependencies.add(dependencies.create('com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10')) + //configuration.dependencies.add(dependencies.create('com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10')) //kotlin插件 configuration.dependencies.add(dependencies.create("org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin")) }