Fixes issue #117 - Fixes remote actions with GNU instances
This commit is contained in:
parent
24a82b5252
commit
2000d179f8
Binary file not shown.
|
@ -93,7 +93,19 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
else
|
||||
api = new API(contextReference.get());
|
||||
if( remoteStatus != null){
|
||||
Results search = api.search(remoteStatus.getReblog()!=null?remoteStatus.getReblog().getUri():remoteStatus.getUri());
|
||||
String uri;
|
||||
if( remoteStatus.getReblog() != null){
|
||||
if( remoteStatus.getReblog().getUri().startsWith("http"))
|
||||
uri = remoteStatus.getReblog().getUri();
|
||||
else
|
||||
uri = remoteStatus.getReblog().getUrl();
|
||||
}else {
|
||||
if( remoteStatus.getUri().startsWith("http"))
|
||||
uri = remoteStatus.getUri();
|
||||
else
|
||||
uri = remoteStatus.getUrl();
|
||||
}
|
||||
Results search = api.search(uri);
|
||||
if( search != null){
|
||||
List<fr.gouv.etalab.mastodon.client.Entities.Status> remoteStatuses = search.getStatuses();
|
||||
if( remoteStatuses != null && remoteStatuses.size() > 0 ){
|
||||
|
|
|
@ -16,9 +16,7 @@ package fr.gouv.etalab.mastodon.asynctasks;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import fr.gouv.etalab.mastodon.client.API;
|
||||
import fr.gouv.etalab.mastodon.client.Entities.Results;
|
||||
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRemoteAccountInterface;
|
||||
|
|
|
@ -1111,8 +1111,10 @@ public class API {
|
|||
results = parseResultsResponse(new JSONObject(response));
|
||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||
setError(e.getStatusCode(), e);
|
||||
e.printStackTrace();
|
||||
}catch (Exception e) {
|
||||
setDefaultError();
|
||||
e.printStackTrace();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ package fr.gouv.etalab.mastodon.drawers;
|
|||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Handler;
|
||||
|
@ -43,7 +42,6 @@ import android.text.SpannableString;
|
|||
import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
|
|
@ -222,8 +222,21 @@ public class CrossActions {
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... voids) {
|
||||
|
||||
API api = new API(contextReference.get(), account.getInstance(), account.getToken());
|
||||
Results search = api.search(status.getReblog()!=null?status.getReblog().getUri():status.getUri());
|
||||
String uri;
|
||||
if(status.getReblog() != null ){
|
||||
if( status.getReblog().getUri().startsWith("http"))
|
||||
uri = status.getReblog().getUri();
|
||||
else
|
||||
uri = status.getReblog().getUrl();
|
||||
}else {
|
||||
if( status.getUri().startsWith("http"))
|
||||
uri = status.getUri();
|
||||
else
|
||||
uri = status.getUrl();
|
||||
}
|
||||
Results search = api.search(uri);
|
||||
if( search != null){
|
||||
remoteStatuses = search.getStatuses();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue