Fixes pagination issue with Pleroma
This commit is contained in:
parent
f255e4e7e9
commit
353789db3b
|
@ -99,13 +99,11 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
|
||||
Log.v(Helper.TAG,"account: " + account);
|
||||
//Remote action
|
||||
if (account != null)
|
||||
api = new API(contextReference.get(), account.getInstance(), account.getToken());
|
||||
else
|
||||
api = new API(contextReference.get());
|
||||
Log.v(Helper.TAG,"remoteStatus: " + remoteStatus);
|
||||
if (remoteStatus != null) {
|
||||
String uri;
|
||||
if (remoteStatus.getReblog() != null) {
|
||||
|
@ -119,9 +117,7 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
else
|
||||
uri = remoteStatus.getUrl();
|
||||
}
|
||||
Log.v(Helper.TAG,"uri: " + uri);
|
||||
Results search = api.search(uri);
|
||||
Log.v(Helper.TAG,"search: " + search);
|
||||
if (search != null) {
|
||||
List<fr.gouv.etalab.mastodon.client.Entities.Status> remoteStatuses = search.getStatuses();
|
||||
if (remoteStatuses != null && remoteStatuses.size() > 0) {
|
||||
|
|
|
@ -36,6 +36,7 @@ import android.text.style.ClickableSpan;
|
|||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.view.View;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.os.Build;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import org.json.JSONObject;
|
||||
|
@ -1605,12 +1606,14 @@ public class HttpsConnection {
|
|||
return;
|
||||
Map<String, List<String>> map = httpsURLConnection.getHeaderFields();
|
||||
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
|
||||
if (entry.toString().startsWith("Link")) {
|
||||
Log.v(Helper.TAG, entry.toString() );
|
||||
if (entry.toString().startsWith("Link") || entry.toString().startsWith("link") ) {
|
||||
Pattern patternMaxId = Pattern.compile("max_id=([0-9]{1,}).*");
|
||||
Matcher matcherMaxId = patternMaxId.matcher(entry.toString());
|
||||
if (matcherMaxId.find()) {
|
||||
max_id = matcherMaxId.group(1);
|
||||
}
|
||||
Log.v(Helper.TAG, "max_id -> " + max_id );
|
||||
if (entry.toString().startsWith("Link")) {
|
||||
Pattern patternSinceId = Pattern.compile("since_id=([0-9]{1,}).*");
|
||||
Matcher matcherSinceId = patternSinceId.matcher(entry.toString());
|
||||
|
@ -1619,6 +1622,7 @@ public class HttpsConnection {
|
|||
}
|
||||
|
||||
}
|
||||
Log.v(Helper.TAG, "since_id -> " + since_id );
|
||||
}
|
||||
}
|
||||
}else {
|
||||
|
@ -1626,7 +1630,7 @@ public class HttpsConnection {
|
|||
return;
|
||||
Map<String, List<String>> map = httpURLConnection.getHeaderFields();
|
||||
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
|
||||
if (entry.toString().startsWith("Link")) {
|
||||
if (entry.toString().startsWith("Link") || entry.toString().startsWith("link")) {
|
||||
Pattern patternMaxId = Pattern.compile("max_id=([0-9]{1,}).*");
|
||||
Matcher matcherMaxId = patternMaxId.matcher(entry.toString());
|
||||
if (matcherMaxId.find()) {
|
||||
|
|
Loading…
Reference in New Issue