mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-29 10:46:35 +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) {
|
for (Account element : myAccountList) {
|
||||||
try {
|
try {
|
||||||
OCSMSOwnCloudClient _client = new OCSMSOwnCloudClient(_context, element);
|
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);
|
_client.doPushRequest(smsBuffer);
|
||||||
OCSMSNotificationUI.cancel(_context);
|
OCSMSNotificationUI.cancel(_context);
|
||||||
} catch (IllegalStateException e) { // Fail to read account data
|
} 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 fr.unix_experience.owncloud_sms.providers.AndroidVersionProvider;
|
||||||
import ncsmsgo.SmsBuffer;
|
import ncsmsgo.SmsBuffer;
|
||||||
import ncsmsgo.SmsHTTPClient;
|
import ncsmsgo.SmsHTTPClient;
|
||||||
|
import ncsmsgo.SmsIDListResponse;
|
||||||
import ncsmsgo.SmsPhoneListResponse;
|
import ncsmsgo.SmsPhoneListResponse;
|
||||||
import ncsmsgo.SmsPushResponse;
|
import ncsmsgo.SmsPushResponse;
|
||||||
|
|
||||||
@ -118,8 +119,11 @@ public class OCHttpClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<Integer, JSONObject> getAllSmsIds() throws OCSyncException {
|
Pair<Integer, SmsIDListResponse> getAllSmsIds() throws OCSyncException {
|
||||||
return get(_smsHttpClient.getAllSmsIdsCall(), false);
|
SmsIDListResponse silr = _smsHttpClient.doGetSmsIDList();
|
||||||
|
int httpStatus = (int) _smsHttpClient.getLastHTTPStatus();
|
||||||
|
handleEarlyHTTPStatus(httpStatus);
|
||||||
|
return new Pair<>(httpStatus, silr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform the GoLang doVersionCall and handle return
|
// 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.exceptions.OCSyncException;
|
||||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||||
import ncsmsgo.SmsBuffer;
|
import ncsmsgo.SmsBuffer;
|
||||||
|
import ncsmsgo.SmsIDListResponse;
|
||||||
import ncsmsgo.SmsPhoneListResponse;
|
import ncsmsgo.SmsPhoneListResponse;
|
||||||
import ncsmsgo.SmsPushResponse;
|
import ncsmsgo.SmsPushResponse;
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ public class OCSMSOwnCloudClient {
|
|||||||
|
|
||||||
private void doPushRequestV1(SmsBuffer smsBuffer) throws OCSyncException {
|
private void doPushRequestV1(SmsBuffer smsBuffer) throws OCSyncException {
|
||||||
if (smsBuffer == null) {
|
if (smsBuffer == null) {
|
||||||
Pair<Integer, JSONObject> response = _http.getAllSmsIds();
|
Pair<Integer, SmsIDListResponse> response = _http.getAllSmsIds();
|
||||||
if (response.second == null) {
|
if (response.second == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user