From 4c7e37a373556c45cd20eeac4f97352aa30936f9 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Mon, 4 Apr 2022 08:12:28 +0530 Subject: [PATCH 1/2] update for stripped body --- .../QKSMS/repository/MessageRepositoryImpl.kt | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt index a5438d346..c106b20ff 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt @@ -311,19 +311,19 @@ class MessageRepositoryImpl @Inject constructor( ?.let(SmsManagerFactory::createSmsManager) ?: SmsManager.getDefault() - // We only care about stripping SMS - val strippedBody = when (prefs.unicode.get()) { - true -> StripAccents.stripAccents(signedBody) - false -> signedBody - } +// // We only care about stripping SMS +// val strippedBody = when (prefs.unicode.get()) { +// true -> StripAccents.stripAccents(signedBody) +// false -> signedBody +// } - val parts = smsManager.divideMessage(strippedBody).orEmpty() - val forceMms = prefs.longAsMms.get() && parts.size > 1 +// // val parts = smsManager.divideMessage(strippedBody).orEmpty() +// val forceMms = prefs.longAsMms.get() && parts.size > 1 - if (addresses.size == 1 && attachments.isEmpty() && !forceMms) { // SMS + if (addresses.size == 1 && attachments.isEmpty()) { // SMS if (delay > 0) { // With delay val sendTime = System.currentTimeMillis() + delay - val message = insertSentSms(subId, threadId, addresses.first(), strippedBody, sendTime) + val message = insertSentSms(subId, threadId, addresses.first(), signedBody, sendTime) val intent = getIntentForDelayedSms(message.id) @@ -334,10 +334,11 @@ class MessageRepositoryImpl @Inject constructor( alarmManager.setExact(AlarmManager.RTC_WAKEUP, sendTime, intent) } } else { // No delay - val message = insertSentSms(subId, threadId, addresses.first(), strippedBody, now()) + val message = insertSentSms(subId, threadId, addresses.first(), signedBody, System.currentTimeMillis()) sendSms(message) } - } else { // MMS + } + else { // MMS val parts = arrayListOf() val maxWidth = smsManager.carrierConfigValues.getInt(SmsManager.MMS_CONFIG_MAX_IMAGE_WIDTH) -- GitLab From 6ef918be7f8f4a2483260a9a10025f5737227160 Mon Sep 17 00:00:00 2001 From: Narinder Rana Date: Mon, 4 Apr 2022 11:36:53 +0530 Subject: [PATCH 2/2] code refine --- .../com/moez/QKSMS/repository/MessageRepositoryImpl.kt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt index c106b20ff..7cdddf1d2 100644 --- a/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt +++ b/data/src/main/java/com/moez/QKSMS/repository/MessageRepositoryImpl.kt @@ -311,15 +311,6 @@ class MessageRepositoryImpl @Inject constructor( ?.let(SmsManagerFactory::createSmsManager) ?: SmsManager.getDefault() -// // We only care about stripping SMS -// val strippedBody = when (prefs.unicode.get()) { -// true -> StripAccents.stripAccents(signedBody) -// false -> signedBody -// } - -// // val parts = smsManager.divideMessage(strippedBody).orEmpty() -// val forceMms = prefs.longAsMms.get() && parts.size > 1 - if (addresses.size == 1 && attachments.isEmpty()) { // SMS if (delay > 0) { // With delay val sendTime = System.currentTimeMillis() + delay -- GitLab