1
0
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:
Loic Blot 2018-02-10 11:23:46 +01:00
parent db2cc05a3a
commit 8ad3b251b0
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
4 changed files with 10 additions and 3 deletions

Binary file not shown.

View File

@ -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

View File

@ -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

View File

@ -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;
}