Some fixes with notifications
This commit is contained in:
parent
73b1312554
commit
c0afccc84f
|
@ -30,7 +30,6 @@ import androidx.core.app.ActivityCompat;
|
|||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
|
@ -3244,6 +3244,7 @@ public class API {
|
|||
} catch (UnsupportedEncodingException e) {
|
||||
params.put("q", query);
|
||||
}
|
||||
params.put("resolve", "true");
|
||||
try {
|
||||
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
||||
String response = httpsConnection.get(getAbsoluteUrl("/search"), 10, params, prefKeyOauthTokenT);
|
||||
|
|
|
@ -43,6 +43,8 @@ import com.bumptech.glide.Glide;
|
|||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
|
@ -1044,6 +1046,10 @@ public class Account implements Parcelable {
|
|||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String toString(){
|
||||
return this.getAcct()+ " - " + this.getUrl();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ import android.text.Html;
|
|||
import android.widget.Toast;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -343,14 +345,48 @@ public class CrossActions {
|
|||
}
|
||||
List<Account> remoteAccounts = response.getAccounts();
|
||||
if( remoteAccounts != null && remoteAccounts.size() > 0) {
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
//Flag it has a peertube account
|
||||
if( remoteAccount.getHost() != null && remoteAccount.getAcct().split("@").length > 1)
|
||||
b.putBoolean("peertubeaccount", true);
|
||||
b.putParcelable("account", remoteAccounts.get(0));
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
|
||||
Account fetchedAccount = null;
|
||||
if( remoteAccounts.size() == 1){
|
||||
Account acc = remoteAccounts.get(0);
|
||||
if (acc.getUsername().equals(remoteAccount.getUsername())) {
|
||||
fetchedAccount = acc;
|
||||
}
|
||||
}else {
|
||||
remoteAccounts.size();
|
||||
for(Account acc: remoteAccounts){
|
||||
|
||||
String instance = null;
|
||||
try {
|
||||
URI url = new URI(acc.getUrl());
|
||||
instance = url.getHost();
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if( instance != null ) {
|
||||
if (acc.getUsername().equals(remoteAccount.getUsername()) && instance.equals(remoteAccount.getInstance())) {
|
||||
fetchedAccount = acc;
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
if (acc.getUsername().equals(remoteAccount.getUsername())) {
|
||||
fetchedAccount = acc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(fetchedAccount != null){
|
||||
Intent intent = new Intent(context, ShowAccountActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
//Flag it has a peertube account
|
||||
if( remoteAccount.getHost() != null && remoteAccount.getAcct().split("@").length > 1)
|
||||
b.putBoolean("peertubeaccount", true);
|
||||
b.putParcelable("account", fetchedAccount);
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR );
|
||||
|
|
Loading…
Reference in New Issue