committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 981 additions and 43 deletions
-
9android/app/src/main/AndroidManifest.xml
-
73android/app/src/main/java/com/vernu/sms/dtos/SMSDTO.java
-
225android/app/src/main/java/com/vernu/sms/helpers/SMSHelper.java
-
18android/app/src/main/java/com/vernu/sms/models/SMSPayload.java
-
85android/app/src/main/java/com/vernu/sms/receivers/BootCompletedReceiver.java
-
180android/app/src/main/java/com/vernu/sms/receivers/SMSStatusReceiver.java
-
127android/app/src/main/java/com/vernu/sms/services/FCMService.java
-
3android/app/src/main/java/com/vernu/sms/services/GatewayApiService.java
-
35api/src/gateway/gateway.controller.ts
-
59api/src/gateway/gateway.dto.ts
-
167api/src/gateway/gateway.service.ts
-
3api/src/gateway/queue/sms-queue.service.ts
-
4api/src/gateway/schemas/sms-batch.schema.ts
-
13api/src/gateway/schemas/sms.schema.ts
-
1api/src/webhook/webhook-event.enum.ts
@ -1,25 +1,236 @@ |
|||||
package com.vernu.sms.helpers; |
package com.vernu.sms.helpers; |
||||
|
|
||||
|
import android.Manifest; |
||||
|
import android.app.PendingIntent; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
import android.telephony.SmsManager; |
import android.telephony.SmsManager; |
||||
|
import android.os.Build; |
||||
|
import android.telephony.SubscriptionManager; |
||||
|
import android.util.Log; |
||||
|
|
||||
|
import com.vernu.sms.ApiManager; |
||||
|
import com.vernu.sms.AppConstants; |
||||
|
import com.vernu.sms.TextBeeUtils; |
||||
|
import com.vernu.sms.dtos.SMSDTO; |
||||
|
import com.vernu.sms.dtos.SMSForwardResponseDTO; |
||||
|
import com.vernu.sms.receivers.SMSStatusReceiver; |
||||
|
import com.vernu.sms.services.GatewayApiService; |
||||
|
|
||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
public class SMSHelper { |
public class SMSHelper { |
||||
public static void sendSMS(String phoneNo, String message) { |
|
||||
|
private static final String TAG = "SMSHelper"; |
||||
|
|
||||
|
/** |
||||
|
* Sends an SMS message and returns whether the operation was successful |
||||
|
* |
||||
|
* @param phoneNo The recipient's phone number |
||||
|
* @param message The SMS message to send |
||||
|
* @param smsId The unique ID for this SMS |
||||
|
* @param smsBatchId The batch ID for this SMS |
||||
|
* @param context The application context |
||||
|
* @return boolean True if sending was initiated, false if permissions aren't granted |
||||
|
*/ |
||||
|
public static boolean sendSMS(String phoneNo, String message, String smsId, String smsBatchId, Context context) { |
||||
|
// Check if we have permission to send SMS |
||||
|
if (!TextBeeUtils.isPermissionGranted(context, Manifest.permission.SEND_SMS)) { |
||||
|
Log.e(TAG, "SMS permission not granted. Unable to send SMS."); |
||||
|
|
||||
|
// Report failure to API |
||||
|
reportPermissionError(context, smsId, smsBatchId); |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
try { |
||||
SmsManager smsManager = SmsManager.getDefault(); |
SmsManager smsManager = SmsManager.getDefault(); |
||||
|
|
||||
//for sms with more than 160 chars |
|
||||
|
// Create pending intents for status tracking |
||||
|
PendingIntent sentIntent = createSentPendingIntent(context, smsId, smsBatchId); |
||||
|
PendingIntent deliveredIntent = createDeliveredPendingIntent(context, smsId, smsBatchId); |
||||
|
|
||||
|
// For SMS with more than 160 chars |
||||
|
ArrayList<String> parts = smsManager.divideMessage(message); |
||||
|
if (parts.size() > 1) { |
||||
|
ArrayList<PendingIntent> sentIntents = new ArrayList<>(); |
||||
|
ArrayList<PendingIntent> deliveredIntents = new ArrayList<>(); |
||||
|
|
||||
|
for (int i = 0; i < parts.size(); i++) { |
||||
|
sentIntents.add(sentIntent); |
||||
|
deliveredIntents.add(deliveredIntent); |
||||
|
} |
||||
|
|
||||
|
smsManager.sendMultipartTextMessage(phoneNo, null, parts, sentIntents, deliveredIntents); |
||||
|
} else { |
||||
|
smsManager.sendTextMessage(phoneNo, null, message, sentIntent, deliveredIntent); |
||||
|
} |
||||
|
|
||||
|
return true; |
||||
|
} catch (Exception e) { |
||||
|
Log.e(TAG, "Exception when sending SMS: " + e.getMessage()); |
||||
|
|
||||
|
// Report exception to API |
||||
|
reportSendingError(context, smsId, smsBatchId, e.getMessage()); |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Sends an SMS message from a specific SIM slot and returns whether the operation was successful |
||||
|
* |
||||
|
* @param phoneNo The recipient's phone number |
||||
|
* @param message The SMS message to send |
||||
|
* @param simSubscriptionId The specific SIM subscription ID to use |
||||
|
* @param smsId The unique ID for this SMS |
||||
|
* @param smsBatchId The batch ID for this SMS |
||||
|
* @param context The application context |
||||
|
* @return boolean True if sending was initiated, false if permissions aren't granted |
||||
|
*/ |
||||
|
public static boolean sendSMSFromSpecificSim(String phoneNo, String message, int simSubscriptionId, |
||||
|
String smsId, String smsBatchId, Context context) { |
||||
|
// Check for required permissions |
||||
|
if (!TextBeeUtils.isPermissionGranted(context, Manifest.permission.SEND_SMS) || |
||||
|
!TextBeeUtils.isPermissionGranted(context, Manifest.permission.READ_PHONE_STATE)) { |
||||
|
Log.e(TAG, "SMS or Phone State permission not granted. Unable to send SMS from specific SIM."); |
||||
|
|
||||
|
// Report failure to API |
||||
|
reportPermissionError(context, smsId, smsBatchId); |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
// Get the SmsManager for the specific SIM |
||||
|
SmsManager smsManager; |
||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { |
||||
|
smsManager = SmsManager.getSmsManagerForSubscriptionId(simSubscriptionId); |
||||
|
} else { |
||||
|
// Fallback to default SmsManager for older Android versions |
||||
|
smsManager = SmsManager.getDefault(); |
||||
|
Log.w(TAG, "Using default SIM as specific SIM selection not supported on this Android version"); |
||||
|
} |
||||
|
|
||||
|
// Create pending intents for status tracking |
||||
|
PendingIntent sentIntent = createSentPendingIntent(context, smsId, smsBatchId); |
||||
|
PendingIntent deliveredIntent = createDeliveredPendingIntent(context, smsId, smsBatchId); |
||||
|
|
||||
|
// For SMS with more than 160 chars |
||||
ArrayList<String> parts = smsManager.divideMessage(message); |
ArrayList<String> parts = smsManager.divideMessage(message); |
||||
if (parts.size() > 1) { |
if (parts.size() > 1) { |
||||
smsManager.sendMultipartTextMessage(phoneNo, null, parts, null, null); |
|
||||
|
ArrayList<PendingIntent> sentIntents = new ArrayList<>(); |
||||
|
ArrayList<PendingIntent> deliveredIntents = new ArrayList<>(); |
||||
|
|
||||
|
for (int i = 0; i < parts.size(); i++) { |
||||
|
sentIntents.add(sentIntent); |
||||
|
deliveredIntents.add(deliveredIntent); |
||||
|
} |
||||
|
|
||||
|
smsManager.sendMultipartTextMessage(phoneNo, null, parts, sentIntents, deliveredIntents); |
||||
|
} else { |
||||
|
smsManager.sendTextMessage(phoneNo, null, message, sentIntent, deliveredIntent); |
||||
|
} |
||||
|
|
||||
|
return true; |
||||
|
} catch (Exception e) { |
||||
|
Log.e(TAG, "Exception when sending SMS from specific SIM: " + e.getMessage()); |
||||
|
|
||||
|
// Report exception to API |
||||
|
reportSendingError(context, smsId, smsBatchId, e.getMessage()); |
||||
|
|
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static void reportPermissionError(Context context, String smsId, String smsBatchId) { |
||||
|
SMSDTO smsDTO = new SMSDTO(); |
||||
|
smsDTO.setSmsId(smsId); |
||||
|
smsDTO.setSmsBatchId(smsBatchId); |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(System.currentTimeMillis()); |
||||
|
smsDTO.setErrorCode("PERMISSION_DENIED"); |
||||
|
smsDTO.setErrorMessage("SMS permission not granted"); |
||||
|
|
||||
|
updateSMSStatus(context, smsDTO); |
||||
|
} |
||||
|
|
||||
|
private static void reportSendingError(Context context, String smsId, String smsBatchId, String errorMessage) { |
||||
|
SMSDTO smsDTO = new SMSDTO(); |
||||
|
smsDTO.setSmsId(smsId); |
||||
|
smsDTO.setSmsBatchId(smsBatchId); |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(System.currentTimeMillis()); |
||||
|
smsDTO.setErrorCode("SENDING_EXCEPTION"); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
|
||||
|
updateSMSStatus(context, smsDTO); |
||||
|
} |
||||
|
|
||||
|
private static void updateSMSStatus(Context context, SMSDTO smsDTO) { |
||||
|
String deviceId = SharedPreferenceHelper.getSharedPreferenceString(context, AppConstants.SHARED_PREFS_DEVICE_ID_KEY, ""); |
||||
|
String apiKey = SharedPreferenceHelper.getSharedPreferenceString(context, AppConstants.SHARED_PREFS_API_KEY_KEY, ""); |
||||
|
|
||||
|
if (deviceId.isEmpty() || apiKey.isEmpty()) { |
||||
|
Log.e(TAG, "Device ID or API key not found"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
GatewayApiService apiService = ApiManager.getApiService(); |
||||
|
Call<SMSForwardResponseDTO> call = apiService.updateSMSStatus(deviceId, apiKey, smsDTO); |
||||
|
|
||||
|
call.enqueue(new Callback<SMSForwardResponseDTO>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<SMSForwardResponseDTO> call, Response<SMSForwardResponseDTO> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
Log.d(TAG, "SMS status updated successfully - ID: " + smsDTO.getSmsId() + ", Status: " + smsDTO.getStatus()); |
||||
} else { |
} else { |
||||
smsManager.sendTextMessage(phoneNo, null, message, null, null); |
|
||||
|
Log.e(TAG, "Failed to update SMS status. Response code: " + response.code()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<SMSForwardResponseDTO> call, Throwable t) { |
||||
|
Log.e(TAG, "API call failed: " + t.getMessage()); |
||||
} |
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private static PendingIntent createSentPendingIntent(Context context, String smsId, String smsBatchId) { |
||||
|
// Create explicit intent (specify the component) |
||||
|
Intent intent = new Intent(context, SMSStatusReceiver.class); |
||||
|
intent.setAction(SMSStatusReceiver.SMS_SENT); |
||||
|
intent.putExtra("sms_id", smsId); |
||||
|
intent.putExtra("sms_batch_id", smsBatchId); |
||||
|
|
||||
|
int flags = PendingIntent.FLAG_UPDATE_CURRENT; |
||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
||||
|
flags |= PendingIntent.FLAG_MUTABLE; |
||||
|
} |
||||
|
|
||||
|
// Use a unique request code to avoid PendingIntent collisions |
||||
|
int requestCode = (smsId + "_sent").hashCode(); |
||||
|
return PendingIntent.getBroadcast(context, requestCode, intent, flags); |
||||
|
} |
||||
|
|
||||
|
private static PendingIntent createDeliveredPendingIntent(Context context, String smsId, String smsBatchId) { |
||||
|
// Create explicit intent (specify the component) |
||||
|
Intent intent = new Intent(context, SMSStatusReceiver.class); |
||||
|
intent.setAction(SMSStatusReceiver.SMS_DELIVERED); |
||||
|
intent.putExtra("sms_id", smsId); |
||||
|
intent.putExtra("sms_batch_id", smsBatchId); |
||||
|
|
||||
|
int flags = PendingIntent.FLAG_UPDATE_CURRENT; |
||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { |
||||
|
flags |= PendingIntent.FLAG_MUTABLE; |
||||
} |
} |
||||
|
|
||||
public static void sendSMSFromSpecificSim(String phoneNo, String message, int simSlot) { |
|
||||
SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(simSlot); |
|
||||
smsManager.sendMultipartTextMessage(phoneNo, null, smsManager.divideMessage(message), null, null); |
|
||||
|
// Use a unique request code to avoid PendingIntent collisions |
||||
|
int requestCode = (smsId + "_delivered").hashCode(); |
||||
|
return PendingIntent.getBroadcast(context, requestCode, intent, flags); |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,180 @@ |
|||||
|
package com.vernu.sms.receivers; |
||||
|
|
||||
|
import android.app.Activity; |
||||
|
import android.content.BroadcastReceiver; |
||||
|
import android.content.Context; |
||||
|
import android.content.Intent; |
||||
|
import android.telephony.SmsManager; |
||||
|
import android.util.Log; |
||||
|
|
||||
|
import com.vernu.sms.ApiManager; |
||||
|
import com.vernu.sms.AppConstants; |
||||
|
import com.vernu.sms.dtos.SMSDTO; |
||||
|
import com.vernu.sms.dtos.SMSForwardResponseDTO; |
||||
|
import com.vernu.sms.helpers.SharedPreferenceHelper; |
||||
|
import com.vernu.sms.services.GatewayApiService; |
||||
|
|
||||
|
import retrofit2.Call; |
||||
|
import retrofit2.Callback; |
||||
|
import retrofit2.Response; |
||||
|
|
||||
|
public class SMSStatusReceiver extends BroadcastReceiver { |
||||
|
private static final String TAG = "SMSStatusReceiver"; |
||||
|
|
||||
|
public static final String SMS_SENT = "SMS_SENT"; |
||||
|
public static final String SMS_DELIVERED = "SMS_DELIVERED"; |
||||
|
|
||||
|
@Override |
||||
|
public void onReceive(Context context, Intent intent) { |
||||
|
String smsId = intent.getStringExtra("sms_id"); |
||||
|
String smsBatchId = intent.getStringExtra("sms_batch_id"); |
||||
|
String action = intent.getAction(); |
||||
|
|
||||
|
SMSDTO smsDTO = new SMSDTO(); |
||||
|
smsDTO.setSmsId(smsId); |
||||
|
smsDTO.setSmsBatchId(smsBatchId); |
||||
|
|
||||
|
if (SMS_SENT.equals(action)) { |
||||
|
handleSentStatus(context, getResultCode(), smsDTO); |
||||
|
} else if (SMS_DELIVERED.equals(action)) { |
||||
|
handleDeliveredStatus(context, getResultCode(), smsDTO); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void handleSentStatus(Context context, int resultCode, SMSDTO smsDTO) { |
||||
|
long timestamp = System.currentTimeMillis(); |
||||
|
String errorMessage = ""; |
||||
|
|
||||
|
switch (resultCode) { |
||||
|
case Activity.RESULT_OK: |
||||
|
smsDTO.setStatus("SENT"); |
||||
|
smsDTO.setSentAtInMillis(timestamp); |
||||
|
Log.d(TAG, "SMS sent successfully - ID: " + smsDTO.getSmsId()); |
||||
|
break; |
||||
|
case SmsManager.RESULT_ERROR_GENERIC_FAILURE: |
||||
|
errorMessage = "Generic failure"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
case SmsManager.RESULT_ERROR_RADIO_OFF: |
||||
|
errorMessage = "Radio off"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
case SmsManager.RESULT_ERROR_NULL_PDU: |
||||
|
errorMessage = "Null PDU"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
case SmsManager.RESULT_ERROR_NO_SERVICE: |
||||
|
errorMessage = "No service"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
case SmsManager.RESULT_ERROR_LIMIT_EXCEEDED: |
||||
|
errorMessage = "Sending limit exceeded"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
case SmsManager.RESULT_ERROR_SHORT_CODE_NOT_ALLOWED: |
||||
|
errorMessage = "Short code not allowed"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
case SmsManager.RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED: |
||||
|
errorMessage = "Short code never allowed"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
default: |
||||
|
errorMessage = "Unknown error"; |
||||
|
smsDTO.setStatus("FAILED"); |
||||
|
smsDTO.setFailedAtInMillis(timestamp); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS failed to send - ID: " + smsDTO.getSmsId() + ", Unknown error code: " + resultCode); |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
updateSMSStatus(context, smsDTO); |
||||
|
} |
||||
|
|
||||
|
private void handleDeliveredStatus(Context context, int resultCode, SMSDTO smsDTO) { |
||||
|
long timestamp = System.currentTimeMillis(); |
||||
|
String errorMessage = ""; |
||||
|
|
||||
|
switch (resultCode) { |
||||
|
case Activity.RESULT_OK: |
||||
|
smsDTO.setStatus("DELIVERED"); |
||||
|
smsDTO.setDeliveredAtInMillis(timestamp); |
||||
|
Log.d(TAG, "SMS delivered successfully - ID: " + smsDTO.getSmsId()); |
||||
|
break; |
||||
|
case Activity.RESULT_CANCELED: |
||||
|
errorMessage = "Delivery canceled"; |
||||
|
smsDTO.setStatus("DELIVERY_FAILED"); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS delivery failed - ID: " + smsDTO.getSmsId() + ", Error code: " + resultCode + ", Error: " + errorMessage); |
||||
|
break; |
||||
|
default: |
||||
|
errorMessage = "Unknown delivery error"; |
||||
|
smsDTO.setStatus("DELIVERY_FAILED"); |
||||
|
smsDTO.setErrorCode(String.valueOf(resultCode)); |
||||
|
smsDTO.setErrorMessage(errorMessage); |
||||
|
Log.e(TAG, "SMS delivery failed - ID: " + smsDTO.getSmsId() + ", Unknown error code: " + resultCode); |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
updateSMSStatus(context, smsDTO); |
||||
|
} |
||||
|
|
||||
|
private void updateSMSStatus(Context context, SMSDTO smsDTO) { |
||||
|
String deviceId = SharedPreferenceHelper.getSharedPreferenceString(context, AppConstants.SHARED_PREFS_DEVICE_ID_KEY, ""); |
||||
|
String apiKey = SharedPreferenceHelper.getSharedPreferenceString(context, AppConstants.SHARED_PREFS_API_KEY_KEY, ""); |
||||
|
|
||||
|
if (deviceId.isEmpty() || apiKey.isEmpty()) { |
||||
|
Log.e(TAG, "Device ID or API key not found"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
GatewayApiService apiService = ApiManager.getApiService(); |
||||
|
Call<SMSForwardResponseDTO> call = apiService.updateSMSStatus(deviceId, apiKey, smsDTO); |
||||
|
|
||||
|
call.enqueue(new Callback<SMSForwardResponseDTO>() { |
||||
|
@Override |
||||
|
public void onResponse(Call<SMSForwardResponseDTO> call, Response<SMSForwardResponseDTO> response) { |
||||
|
if (response.isSuccessful()) { |
||||
|
Log.d(TAG, "SMS status updated successfully - ID: " + smsDTO.getSmsId() + ", Status: " + smsDTO.getStatus()); |
||||
|
} else { |
||||
|
Log.e(TAG, "Failed to update SMS status. Response code: " + response.code()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onFailure(Call<SMSForwardResponseDTO> call, Throwable t) { |
||||
|
Log.e(TAG, "API call failed: " + t.getMessage()); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -1,3 +1,4 @@ |
|||||
export enum WebhookEvent { |
export enum WebhookEvent { |
||||
MESSAGE_RECEIVED = 'MESSAGE_RECEIVED', |
MESSAGE_RECEIVED = 'MESSAGE_RECEIVED', |
||||
|
SMS_STATUS_UPDATED = 'SMS_STATUS_UPDATED', |
||||
} |
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue