mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 02:58:52 +01:00
Strip out more unused logic from Settings
This commit is contained in:
@@ -19,10 +19,8 @@ package com.android.mms.service_alt;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Telephony;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.mms.transaction.NotificationTransaction;
|
||||
import com.google.android.mms.MmsException;
|
||||
import com.google.android.mms.pdu_alt.PduParser;
|
||||
@@ -75,18 +73,11 @@ public class MmsRequestManager implements MmsRequest.RequestManager {
|
||||
}
|
||||
|
||||
Uri msgUri;
|
||||
boolean group;
|
||||
|
||||
try {
|
||||
group = com.klinker.android.send_message.Transaction.settings.getGroup();
|
||||
} catch (Exception e) {
|
||||
group = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("group_message", true);
|
||||
}
|
||||
|
||||
// Store M-Retrieve.conf into Inbox
|
||||
PduPersister persister = PduPersister.getPduPersister(context);
|
||||
msgUri = persister.persist(retrieveConf, Telephony.Mms.Inbox.CONTENT_URI, true,
|
||||
group, null);
|
||||
true, null);
|
||||
|
||||
// Use local time instead of PDU time
|
||||
ContentValues values = new ContentValues(2);
|
||||
|
||||
@@ -167,15 +167,8 @@ public class MmsMessageSender implements MessageSender {
|
||||
|
||||
readRec.setDate(System.currentTimeMillis() / 1000);
|
||||
|
||||
boolean group;
|
||||
|
||||
try {
|
||||
group = com.klinker.android.send_message.Transaction.settings.getGroup();
|
||||
} catch (Exception e) {
|
||||
group = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("group_message", true);
|
||||
}
|
||||
PduPersister.getPduPersister(context).persist(readRec, Mms.Outbox.CONTENT_URI, true,
|
||||
group, null);
|
||||
true, null);
|
||||
context.startService(new Intent(context, TransactionService.class));
|
||||
} catch (InvalidHeaderValueException e) {
|
||||
Log.e(TAG, "Invalide header value", e);
|
||||
|
||||
+2
-9
@@ -111,16 +111,9 @@ public class NotificationTransaction extends Transaction implements Runnable {
|
||||
try {
|
||||
// Save the pdu. If we can start downloading the real pdu immediately, don't allow
|
||||
// persist() to create a thread for the notificationInd because it causes UI jank.
|
||||
boolean group;
|
||||
|
||||
try {
|
||||
group = com.klinker.android.send_message.Transaction.settings.getGroup();
|
||||
} catch (Exception e) {
|
||||
group = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("group_message", true);
|
||||
}
|
||||
mUri = PduPersister.getPduPersister(context).persist(
|
||||
ind, Inbox.CONTENT_URI, !allowAutoDownload(mContext),
|
||||
group, null);
|
||||
true, null);
|
||||
} catch (MmsException e) {
|
||||
Log.e(TAG, "Failed to save NotificationInd in constructor.", e);
|
||||
throw new IllegalArgumentException();
|
||||
@@ -194,7 +187,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
|
||||
// Save the received PDU (must be a M-RETRIEVE.CONF).
|
||||
PduPersister p = PduPersister.getPduPersister(mContext);
|
||||
Uri uri = p.persist(pdu, Inbox.CONTENT_URI, true,
|
||||
com.klinker.android.send_message.Transaction.settings.getGroup(), null);
|
||||
true, null);
|
||||
|
||||
// Use local time instead of PDU time
|
||||
ContentValues values = new ContentValues(1);
|
||||
|
||||
@@ -111,16 +111,8 @@ public class PushReceiver extends BroadcastReceiver {
|
||||
break;
|
||||
}
|
||||
|
||||
boolean group;
|
||||
|
||||
try {
|
||||
group = com.klinker.android.send_message.Transaction.settings.getGroup();
|
||||
} catch (Exception e) {
|
||||
group = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean("group_message", true);
|
||||
}
|
||||
|
||||
Uri uri = p.persist(pdu, Uri.parse("content://mms/inbox"), true,
|
||||
group, null);
|
||||
true, null);
|
||||
// Update thread ID for ReadOrigInd & DeliveryInd.
|
||||
ContentValues values = new ContentValues(1);
|
||||
values.put(Mms.THREAD_ID, threadId);
|
||||
@@ -148,17 +140,9 @@ public class PushReceiver extends BroadcastReceiver {
|
||||
// Save the pdu. If we can start downloading the real pdu immediately,
|
||||
// don't allow persist() to create a thread for the notificationInd
|
||||
// because it causes UI jank.
|
||||
boolean group;
|
||||
|
||||
try {
|
||||
group = com.klinker.android.send_message.Transaction.settings.getGroup();
|
||||
} catch (Exception e) {
|
||||
group = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean("group_message", true);
|
||||
}
|
||||
|
||||
Uri uri = p.persist(pdu, Inbox.CONTENT_URI,
|
||||
!NotificationTransaction.allowAutoDownload(mContext),
|
||||
group,
|
||||
true,
|
||||
null);
|
||||
|
||||
String location = getContentLocation(mContext, uri);
|
||||
|
||||
@@ -16,21 +16,16 @@
|
||||
|
||||
package com.android.mms.transaction;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SqliteWrapper;
|
||||
import android.net.Uri;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Telephony.Mms;
|
||||
import android.provider.Telephony.Mms.Inbox;
|
||||
import android.text.TextUtils;
|
||||
import com.klinker.android.logger.Log;
|
||||
|
||||
import com.android.mms.logs.LogTag;
|
||||
import com.android.mms.MmsConfig;
|
||||
import com.android.mms.logs.LogTag;
|
||||
import com.android.mms.util.DownloadManager;
|
||||
import com.google.android.mms.MmsException;
|
||||
import com.google.android.mms.pdu_alt.AcknowledgeInd;
|
||||
@@ -40,8 +35,11 @@ import com.google.android.mms.pdu_alt.PduHeaders;
|
||||
import com.google.android.mms.pdu_alt.PduParser;
|
||||
import com.google.android.mms.pdu_alt.PduPersister;
|
||||
import com.google.android.mms.pdu_alt.RetrieveConf;
|
||||
import com.klinker.android.logger.Log;
|
||||
import com.klinker.android.send_message.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The RetrieveTransaction is responsible for retrieving multimedia
|
||||
* messages (M-Retrieve.conf) from the MMSC server. It:
|
||||
@@ -154,18 +152,10 @@ public class RetrieveTransaction extends Transaction implements Runnable {
|
||||
mTransactionState.setState(TransactionState.FAILED);
|
||||
mTransactionState.setContentUri(mUri);
|
||||
} else {
|
||||
boolean group;
|
||||
|
||||
try {
|
||||
group = com.klinker.android.send_message.Transaction.settings.getGroup();
|
||||
} catch (Exception e) {
|
||||
group = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean("group_message", true);
|
||||
}
|
||||
|
||||
// Store M-Retrieve.conf into Inbox
|
||||
PduPersister persister = PduPersister.getPduPersister(mContext);
|
||||
msgUri = persister.persist(retrieveConf, Inbox.CONTENT_URI, true,
|
||||
group, null);
|
||||
true, null);
|
||||
|
||||
// Use local time instead of PDU time
|
||||
ContentValues values = new ContentValues(2);
|
||||
|
||||
@@ -35,7 +35,6 @@ public class Settings {
|
||||
private String userAgent;
|
||||
private String uaProfUrl;
|
||||
private String uaProfTagName;
|
||||
private boolean group;
|
||||
|
||||
// SMS options
|
||||
private boolean deliveryReports;
|
||||
@@ -68,7 +67,6 @@ public class Settings {
|
||||
this.userAgent = s.getAgent();
|
||||
this.uaProfUrl = s.getUserProfileUrl();
|
||||
this.uaProfTagName = s.getUaProfTagName();
|
||||
this.group = s.getGroup();
|
||||
this.deliveryReports = s.getDeliveryReports();
|
||||
this.split = s.getSplit();
|
||||
this.splitCounter = s.getSplitCounter();
|
||||
@@ -104,7 +102,6 @@ public class Settings {
|
||||
this.userAgent = "";
|
||||
this.uaProfUrl = "";
|
||||
this.uaProfTagName = "";
|
||||
this.group = group;
|
||||
this.deliveryReports = deliveryReports;
|
||||
this.split = split;
|
||||
this.splitCounter = splitCounter;
|
||||
@@ -165,15 +162,6 @@ public class Settings {
|
||||
*/
|
||||
public void setUaProfTagName(String tagName) { this.uaProfTagName = tagName; }
|
||||
|
||||
/**
|
||||
* Sets group MMS messages
|
||||
*
|
||||
* @param group is a boolean specifying whether or not to send messages with multiple recipients as a group MMS message
|
||||
*/
|
||||
public void setGroup(boolean group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to receive delivery reports from SMS messages
|
||||
*
|
||||
@@ -296,13 +284,6 @@ public class Settings {
|
||||
*/
|
||||
public String getUaProfTagName() { return this.uaProfTagName; }
|
||||
|
||||
/**
|
||||
* @return whether or not to send Group MMS or multiple SMS/Voice messages
|
||||
*/
|
||||
public boolean getGroup() {
|
||||
return this.group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether or not to request delivery reports on SMS messages
|
||||
*/
|
||||
|
||||
@@ -488,7 +488,7 @@ public class Transaction {
|
||||
if (saveMessage) {
|
||||
try {
|
||||
PduPersister persister = PduPersister.getPduPersister(context);
|
||||
info.location = persister.persist(sendRequest, Uri.parse("content://mms/outbox"), true, settings.getGroup(), null);
|
||||
info.location = persister.persist(sendRequest, Uri.parse("content://mms/outbox"), true, true, null);
|
||||
} catch (Exception e) {
|
||||
Log.v("sending_mms_library", "error saving mms message");
|
||||
Log.e(TAG, "exception thrown", e);
|
||||
@@ -527,7 +527,7 @@ public class Transaction {
|
||||
SendReq sendReq = buildPdu(context, addresses, subject, parts);
|
||||
PduPersister persister = PduPersister.getPduPersister(context);
|
||||
Uri messageUri = persister.persist(sendReq, Uri.parse("content://mms/outbox"),
|
||||
true, settings.getGroup(), null);
|
||||
true, true, null);
|
||||
|
||||
Intent intent;
|
||||
if (explicitSentMmsReceiver == null) {
|
||||
@@ -565,7 +565,7 @@ public class Transaction {
|
||||
}
|
||||
|
||||
Bundle configOverrides = new Bundle();
|
||||
configOverrides.putBoolean(SmsManager.MMS_CONFIG_GROUP_MMS_ENABLED, settings.getGroup());
|
||||
configOverrides.putBoolean(SmsManager.MMS_CONFIG_GROUP_MMS_ENABLED, true);
|
||||
String httpParams = MmsConfig.getHttpParams();
|
||||
if (!TextUtils.isEmpty(httpParams)) {
|
||||
configOverrides.putString(SmsManager.MMS_CONFIG_HTTP_PARAMS, httpParams);
|
||||
@@ -828,7 +828,7 @@ public class Transaction {
|
||||
return message.getImages().length != 0 ||
|
||||
(message.getParts().size() != 0) ||
|
||||
(settings.getSendLongAsMms() && Utils.getNumPages(settings, message.getText()) > settings.getSendLongAsMmsAfter()) ||
|
||||
(message.getAddresses().length > 1 && settings.getGroup()) ||
|
||||
(message.getAddresses().length > 1) ||
|
||||
message.getSubject() != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,6 @@ public class Utils {
|
||||
sendSettings.setAgent(sharedPrefs.getString("mms_agent", ""));
|
||||
sendSettings.setUserProfileUrl(sharedPrefs.getString("mms_user_agent_profile_url", ""));
|
||||
sendSettings.setUaProfTagName(sharedPrefs.getString("mms_user_agent_tag_name", ""));
|
||||
sendSettings.setGroup(sharedPrefs.getBoolean("group_message", true));
|
||||
sendSettings.setDeliveryReports(sharedPrefs.getBoolean("delivery_reports", false));
|
||||
sendSettings.setSplit(sharedPrefs.getBoolean("split_sms", false));
|
||||
sendSettings.setSplitCounter(sharedPrefs.getBoolean("split_counter", false));
|
||||
|
||||
Reference in New Issue
Block a user