Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,30 @@ public void onReceive(final Context context, final Intent intent) {

SmsMessage msg = null;
String addr = null;
String taddr = null;
final StringBuilder body = new StringBuilder();

for (final Object one : msgs) {
msg = SmsMessage.createFromPdu((byte[]) one);
addr = msg.getOriginatingAddress();
if (smsNumbers.contains(addr)) {
/*if (smsNumbers.contains(addr)) {
body.append(msg.getDisplayMessageBody());
}
}*/
for( Object two : smsNumbers) {
taddr = two.toString();
if(addr.startsWith(taddr)){
body.append(msg.getDisplayMessageBody());
break;
}
}
}

final String fullSmsBody = body.toString();
if (!fullSmsBody.isEmpty()) {
Log.d(FTAG, format("%s sms from %s: `%s`", msg.getTimestampMillis(), addr, fullSmsBody));

Intent serviceIntent = new Intent(ACTION_NEW_TRANSACTION_SMS, null, context, FinancistoService.class);
serviceIntent.putExtra(SMS_TRANSACTION_NUMBER, addr);
serviceIntent.putExtra(SMS_TRANSACTION_NUMBER, taddr);
serviceIntent.putExtra(SMS_TRANSACTION_BODY, fullSmsBody);
FinancistoService.enqueueWork(context, serviceIntent);
}
Expand Down