Disable replying to invalid short codes via new conversation activity

This commit is contained in:
Naveen 2023-01-07 17:33:00 +05:30
parent 35a98d4823
commit 91899a652c
1 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.WindowManager import android.view.WindowManager
import android.widget.Toast
import com.google.gson.Gson import com.google.gson.Gson
import com.reddit.indicatorfastscroll.FastScrollItemIndicator import com.reddit.indicatorfastscroll.FastScrollItemIndicator
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
@ -16,7 +17,7 @@ import com.simplemobiletools.smsmessenger.adapters.ContactsAdapter
import com.simplemobiletools.smsmessenger.extensions.getSuggestedContacts import com.simplemobiletools.smsmessenger.extensions.getSuggestedContacts
import com.simplemobiletools.smsmessenger.extensions.getThreadId import com.simplemobiletools.smsmessenger.extensions.getThreadId
import com.simplemobiletools.smsmessenger.helpers.* import com.simplemobiletools.smsmessenger.helpers.*
import kotlinx.android.synthetic.main.activity_main.* import com.simplemobiletools.smsmessenger.messaging.isShortCodeWithLetters
import kotlinx.android.synthetic.main.activity_new_conversation.* import kotlinx.android.synthetic.main.activity_new_conversation.*
import kotlinx.android.synthetic.main.item_suggested_contact.view.* import kotlinx.android.synthetic.main.item_suggested_contact.view.*
import java.net.URLDecoder import java.net.URLDecoder
@ -79,6 +80,11 @@ class NewConversationActivity : SimpleActivity() {
new_conversation_confirm.applyColorFilter(getProperTextColor()) new_conversation_confirm.applyColorFilter(getProperTextColor())
new_conversation_confirm.setOnClickListener { new_conversation_confirm.setOnClickListener {
val number = new_conversation_address.value val number = new_conversation_address.value
if (isShortCodeWithLetters(number)) {
new_conversation_address.setText("")
toast(R.string.invalid_short_code, length = Toast.LENGTH_LONG)
return@setOnClickListener
}
launchThreadActivity(number, number) launchThreadActivity(number, number)
} }