更新短信接收规则设定:
1.启用了只接受通讯录,通讯录里有记录 2.如果不是数字通讯地址,但是在通讯录内 3.通讯地址是数字,并且在短信接收规则内。 以上3种情况就接收,其他一律放到回收站。
This commit is contained in:
		| @@ -1,8 +1,8 @@ | |||||||
| #Created by .winboll/winboll_app_build.gradle | #Created by .winboll/winboll_app_build.gradle | ||||||
| #Sat Mar 01 05:35:38 GMT 2025 | #Sat Mar 01 05:57:52 GMT 2025 | ||||||
| stageCount=17 | stageCount=17 | ||||||
| libraryProject= | libraryProject= | ||||||
| baseVersion=4.1 | baseVersion=4.1 | ||||||
| publishVersion=4.1.16 | publishVersion=4.1.16 | ||||||
| buildCount=3 | buildCount=9 | ||||||
| baseBetaVersion=4.1.17 | baseBetaVersion=4.1.17 | ||||||
|   | |||||||
| @@ -77,21 +77,30 @@ public class SMSRecevier extends BroadcastReceiver { | |||||||
|         PhoneUtil phoneUtil = new PhoneUtil(context); |         PhoneUtil phoneUtil = new PhoneUtil(context); | ||||||
|         boolean isPhoneInContacts = phoneUtil.isPhoneInContacts(szSmsAddress); |         boolean isPhoneInContacts = phoneUtil.isPhoneInContacts(szSmsAddress); | ||||||
|         LogUtils.d(TAG, String.format("isPhoneInContacts %s", isPhoneInContacts)); |         LogUtils.d(TAG, String.format("isPhoneInContacts %s", isPhoneInContacts)); | ||||||
|          |  | ||||||
|         boolean isPhoneByDigit = phoneUtil.isPhoneByDigit(szSmsAddress); |         boolean isPhoneByDigit = phoneUtil.isPhoneByDigit(szSmsAddress); | ||||||
|         LogUtils.d(TAG, String.format("isPhoneByDigit %s", isPhoneByDigit)); |         LogUtils.d(TAG, String.format("isPhoneByDigit %s", isPhoneByDigit)); | ||||||
|          |  | ||||||
|         AppConfigUtil configUtil = AppConfigUtil.getInstance(context); |         AppConfigUtil configUtil = AppConfigUtil.getInstance(context); | ||||||
|         boolean isOnlyReceiveContacts = configUtil.mAppConfigBean.isEnableOnlyReceiveContacts(); |         boolean isOnlyReceiveContacts = configUtil.mAppConfigBean.isEnableOnlyReceiveContacts(); | ||||||
|         LogUtils.d(TAG, String.format("isOnlyReceiveContacts %s", isOnlyReceiveContacts)); |         LogUtils.d(TAG, String.format("isOnlyReceiveContacts %s", isOnlyReceiveContacts)); | ||||||
|          |  | ||||||
|         boolean isInSMSAcceptRule = SMSReceiveRuleUtil.getInstance(context, false).checkIsSMSAcceptInRule(context, szSmsBody); |         boolean isInSMSAcceptRule = SMSReceiveRuleUtil.getInstance(context, false).checkIsSMSAcceptInRule(context, szSmsBody); | ||||||
|         LogUtils.d(TAG, String.format("isInSMSAcceptRule %s", isInSMSAcceptRule)); |         LogUtils.d(TAG, String.format("isInSMSAcceptRule %s", isInSMSAcceptRule)); | ||||||
|          |  | ||||||
|         if (isPhoneByDigit  |         // 启用了只接受通讯录,通讯录里有记录 | ||||||
|             && (!isOnlyReceiveContacts || isPhoneInContacts || isInSMSAcceptRule)) { |         if (isOnlyReceiveContacts && isPhoneInContacts) { | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|  |         // 如果不是数字通讯地址,但是在通讯录内 | ||||||
|  |         if (!isPhoneByDigit && isPhoneInContacts) { | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |         // 通讯地址是数字,并且在短信接收规则内。 | ||||||
|  |         if (isPhoneByDigit && isInSMSAcceptRule) { | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |          | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,6 +19,10 @@ public class SMSRecevier_Test { | |||||||
|         String szSmsAddress = "无名小辈"; |         String szSmsAddress = "无名小辈"; | ||||||
|         test1(context, szSmsBody, szSmsAddress); |         test1(context, szSmsBody, szSmsAddress); | ||||||
|          |          | ||||||
|  |         szSmsBody = "无影无迹"; | ||||||
|  |         szSmsAddress = "淘宝物流"; | ||||||
|  |         test1(context, szSmsBody, szSmsAddress); | ||||||
|  |          | ||||||
|         szSmsBody = "无影无迹"; |         szSmsBody = "无影无迹"; | ||||||
|         szSmsAddress = "1?0"; |         szSmsAddress = "1?0"; | ||||||
|         test1(context, szSmsBody, szSmsAddress); |         test1(context, szSmsBody, szSmsAddress); | ||||||
|   | |||||||
| @@ -5,11 +5,11 @@ package cc.winboll.studio.mymessagemanager.unittest; | |||||||
|  * @Date 2025/02/25 19:00:10 |  * @Date 2025/02/25 19:00:10 | ||||||
|  * @Describe 应用单元测试窗口 |  * @Describe 应用单元测试窗口 | ||||||
|  */ |  */ | ||||||
| import cc.winboll.studio.mymessagemanager.unittest.*; |  | ||||||
| import android.app.Activity; | import android.app.Activity; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
| import cc.winboll.studio.mymessagemanager.R; |  | ||||||
| import android.view.View; | import android.view.View; | ||||||
|  | import cc.winboll.studio.mymessagemanager.R; | ||||||
|  | import cc.winboll.studio.shared.log.LogUtils; | ||||||
| import cc.winboll.studio.shared.log.LogView; | import cc.winboll.studio.shared.log.LogView; | ||||||
|  |  | ||||||
| public class UnitTestActivity extends Activity { | public class UnitTestActivity extends Activity { | ||||||
| @@ -28,7 +28,9 @@ public class UnitTestActivity extends Activity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void onMain(View view) { |     public void onMain(View view) { | ||||||
|         //SMSRecevier_Test.main(this); |         LogUtils.d(TAG, "SMSRecevier_Test"); | ||||||
|  |         SMSRecevier_Test.main(this); | ||||||
|  |         LogUtils.d(TAG, "AddressUtils_Test"); | ||||||
|         AddressUtils_Test.main(this); |         AddressUtils_Test.main(this); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen