mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-29 02:36:43 +00:00
Migrate getAllSmsIds to golang implementation
This commit is contained in:
parent
db2cc05a3a
commit
8ad3b251b0
Binary file not shown.
@ -111,6 +111,8 @@ public interface ASyncSMSSync {
|
||||
for (Account element : myAccountList) {
|
||||
try {
|
||||
OCSMSOwnCloudClient _client = new OCSMSOwnCloudClient(_context, element);
|
||||
// Fetch API version first to do some early verifications
|
||||
Log.i(ASyncSMSSync.TAG, "Server API version: " + _client.getServerAPIVersion());
|
||||
_client.doPushRequest(smsBuffer);
|
||||
OCSMSNotificationUI.cancel(_context);
|
||||
} catch (IllegalStateException e) { // Fail to read account data
|
||||
|
@ -47,6 +47,7 @@ import fr.unix_experience.owncloud_sms.exceptions.OCSyncException;
|
||||
import fr.unix_experience.owncloud_sms.providers.AndroidVersionProvider;
|
||||
import ncsmsgo.SmsBuffer;
|
||||
import ncsmsgo.SmsHTTPClient;
|
||||
import ncsmsgo.SmsIDListResponse;
|
||||
import ncsmsgo.SmsPhoneListResponse;
|
||||
import ncsmsgo.SmsPushResponse;
|
||||
|
||||
@ -118,8 +119,11 @@ public class OCHttpClient {
|
||||
}
|
||||
}
|
||||
|
||||
Pair<Integer, JSONObject> getAllSmsIds() throws OCSyncException {
|
||||
return get(_smsHttpClient.getAllSmsIdsCall(), false);
|
||||
Pair<Integer, SmsIDListResponse> getAllSmsIds() throws OCSyncException {
|
||||
SmsIDListResponse silr = _smsHttpClient.doGetSmsIDList();
|
||||
int httpStatus = (int) _smsHttpClient.getLastHTTPStatus();
|
||||
handleEarlyHTTPStatus(httpStatus);
|
||||
return new Pair<>(httpStatus, silr);
|
||||
}
|
||||
|
||||
// Perform the GoLang doVersionCall and handle return
|
||||
|
@ -33,6 +33,7 @@ import fr.unix_experience.owncloud_sms.enums.OCSyncErrorType;
|
||||
import fr.unix_experience.owncloud_sms.exceptions.OCSyncException;
|
||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||
import ncsmsgo.SmsBuffer;
|
||||
import ncsmsgo.SmsIDListResponse;
|
||||
import ncsmsgo.SmsPhoneListResponse;
|
||||
import ncsmsgo.SmsPushResponse;
|
||||
|
||||
@ -94,7 +95,7 @@ public class OCSMSOwnCloudClient {
|
||||
|
||||
private void doPushRequestV1(SmsBuffer smsBuffer) throws OCSyncException {
|
||||
if (smsBuffer == null) {
|
||||
Pair<Integer, JSONObject> response = _http.getAllSmsIds();
|
||||
Pair<Integer, SmsIDListResponse> response = _http.getAllSmsIds();
|
||||
if (response.second == null) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user