Detects Pleroma accounts

This commit is contained in:
stom79 2019-01-27 10:40:09 +01:00
parent f4c828eaee
commit 3a222d88a0
20 changed files with 80 additions and 68 deletions

View File

@ -55,6 +55,7 @@ import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.util.Patterns;
import android.util.SparseArray;
import android.view.Gravity;
@ -246,12 +247,15 @@ public abstract class BaseMainActivity extends BaseActivity
}
//Update the static variable which manages account type
if( account.getSocial() == null || account.getSocial().equals("MASTODON") )
Log.v(Helper.TAG,"account.getSocial()= " + account.getSocial() );
if( account.getSocial() == null || account.getSocial().equals("MASTODON"))
social = UpdateAccountInfoAsyncTask.SOCIAL.MASTODON;
else if( account.getSocial().equals("PEERTUBE"))
social = UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE;
else if( account.getSocial().equals("PIXELFED"))
social = UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED;
else if( account.getSocial().equals("PLEROMA"))
social = UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA;
countNewStatus = 0;
countNewNotifications = 0;
@ -341,7 +345,7 @@ public abstract class BaseMainActivity extends BaseActivity
delete_all = findViewById(R.id.delete_all);
add_new = findViewById(R.id.add_new);
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
TabLayout.Tab tabHome = tabLayout.newTab();
TabLayout.Tab tabNotif = tabLayout.newTab();
TabLayout.Tab tabDirect = tabLayout.newTab();
@ -1071,14 +1075,14 @@ public abstract class BaseMainActivity extends BaseActivity
changeDrawableColor(getApplicationContext(), R.drawable.ic_recently_added,R.color.dark_text);
}
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
startSreaming();
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
Helper.refreshSearchTag(BaseMainActivity.this, tabLayout, adapter);
int tabCount = tabLayout.getTabCount();
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
for( int j = countPage ; j < tabCount ; j++){
attacheDelete(j);
}
@ -1198,7 +1202,7 @@ public abstract class BaseMainActivity extends BaseActivity
tabLayout.getTabAt(0).select();
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
toot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -1471,7 +1475,7 @@ public abstract class BaseMainActivity extends BaseActivity
// Asked once for notification opt-in
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
if(!popupShown && social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON){
if(!popupShown && (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)){
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.popup_quick_settings, null);
@ -1511,7 +1515,7 @@ public abstract class BaseMainActivity extends BaseActivity
mamageNewIntent(getIntent());
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
// Retrieves instance
new RetrieveInstanceAsyncTask(getApplicationContext(), BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -2410,14 +2414,14 @@ public abstract class BaseMainActivity extends BaseActivity
}
public void removeTabPage() {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
this.mNumOfTabs--;
notifyDataSetChanged();
}
}
public void addTabPage(String title) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
TabLayout.Tab tab = tabLayout.newTab();
tab.setText(title);
this.mNumOfTabs++;
@ -2427,7 +2431,7 @@ public abstract class BaseMainActivity extends BaseActivity
@Override
public Fragment getItem(int position) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
//Remove the search bar
if (!toolbar_search.isIconified()) {
toolbarTitle.setVisibility(View.VISIBLE);
@ -2540,7 +2544,7 @@ public abstract class BaseMainActivity extends BaseActivity
public Object instantiateItem(@NonNull ViewGroup container, int position) {
Fragment createdFragment = (Fragment) super.instantiateItem(container, position);
registeredFragments.put(position, createdFragment);
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
// save the appropriate reference depending on position
if (position == 0) {
@ -3021,7 +3025,7 @@ public abstract class BaseMainActivity extends BaseActivity
public void manageFloatingButton(boolean display){
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
boolean displayFollowInstance = sharedpreferences.getBoolean(Helper.SET_DISPLAY_FOLLOW_INSTANCE, true);
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
if (display) {
tootShow();
if (!displayFollowInstance)
@ -3038,14 +3042,14 @@ public abstract class BaseMainActivity extends BaseActivity
}
}
public void tootShow(){
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
toot.show();
}else{
toot.hide();
}
}
public void federatedTimelinesShow(){
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
federatedTimelines.show();
}else{
federatedTimelines.hide();
@ -3116,7 +3120,7 @@ public abstract class BaseMainActivity extends BaseActivity
federatedTimelines.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
new ManageListsAsyncTask(BaseMainActivity.this, ManageListsAsyncTask.action.GET_LIST, null, null, null, null, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
SQLiteDatabase db = Sqlite.getInstance(BaseMainActivity.this, DB_NAME, null, Sqlite.DB_VERSION).open();
new InstancesDAO(BaseMainActivity.this, db).cleanDoublon();

View File

@ -370,7 +370,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
finish();
return true;
case R.id.action_comment:
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
Toasty.info(PeertubeActivity.this, getString(R.string.retrieve_remote_status), Toast.LENGTH_LONG).show();
new AsyncTask<Void, Void, Void>() {

View File

@ -311,7 +311,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
}
//Peertube account watched by a Mastodon account
if( peertubeAccount && MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( peertubeAccount && (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)) {
account_type.setVisibility(View.VISIBLE);
}
//Bot account
@ -513,7 +513,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
});
if ( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON && account.getFields() != null && account.getFields().size() > 0){
if ( (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) && account.getFields() != null && account.getFields().size() > 0){
LinkedHashMap<String, String> fields = account.getFields();
LinkedHashMap<String, Boolean> fieldsVerified = account.getFieldsVerified();
Iterator it = fields.entrySet().iterator();
@ -614,7 +614,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
}
SpannableString spannableString = Helper.clickableElementsDescription(ShowAccountActivity.this, account.getNote());
account.setNoteSpan(spannableString);
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
account.makeEmojisAccountProfile(ShowAccountActivity.this, ShowAccountActivity.this, account);
account_note.setText(account.getNoteSpan(), TextView.BufferType.SPANNABLE);
account_note.setMovementMethod(LinkMovementMethod.getInstance());
@ -829,7 +829,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
return;
account_follow.setEnabled(true);
account_follow.setBackgroundTintList(ColorStateList.valueOf( ContextCompat.getColor(ShowAccountActivity.this, R.color.mastodonC4)));
if( account.getId() != null && account.getId().equals(userId) && MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON){
if( account.getId() != null && account.getId().equals(userId) && (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)){
account_follow.hide();
header_edit_profile.show();
header_edit_profile.bringToFront();

View File

@ -112,6 +112,7 @@ import fr.gouv.etalab.mastodon.asynctasks.RetrieveAccountsForReplyAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveEmojiAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveSearchAccountsAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveSearchAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.UpdateAccountInfoAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.UpdateDescriptionAttachmentAsyncTask;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.APIResponse;
@ -518,34 +519,35 @@ public class TootActivity extends BaseActivity implements OnPostActionInterface,
}
});
toot_it.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
PopupMenu popup = new PopupMenu(TootActivity.this, toot_it);
popup.getMenuInflater()
.inflate(R.menu.main_content_type, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
case R.id.action_plain_text:
contentType = "text/plain";
break;
case R.id.action_html:
contentType = "text/html";
break;
case R.id.action_markdown:
contentType = "text/markdown";
break;
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
toot_it.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
PopupMenu popup = new PopupMenu(TootActivity.this, toot_it);
popup.getMenuInflater()
.inflate(R.menu.main_content_type, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
case R.id.action_plain_text:
contentType = "text/plain";
break;
case R.id.action_html:
contentType = "text/html";
break;
case R.id.action_markdown:
contentType = "text/markdown";
break;
}
popup.dismiss();
sendToot(null, contentType);
return false;
}
popup.dismiss();
sendToot(null, contentType);
return false;
}
});
popup.show();
return false;
}
});
});
popup.show();
return false;
}
});
toot_picture.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -118,7 +118,7 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PIXELFED) {
//Remote action
API api;
if (account != null)

View File

@ -49,7 +49,7 @@ public class RetrieveAccountAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
API api = new API(this.contextReference.get());
account = api.getAccount(targetedId);
error = api.getError();

View File

@ -210,7 +210,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
apiResponse = api.getFavourites(max_id);
break;
case USER:
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
if (showMediaOnly)
apiResponse = api.getStatusWithMedia(targetedID, max_id);
else if (showPinned)
@ -315,7 +315,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
case HASHTAG:
break;
}
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
List<String> bookmarks = new StatusCacheDAO(contextReference.get(), db).getAllStatusId(StatusCacheDAO.BOOKMARK_CACHE);
if (apiResponse != null && apiResponse.getStatuses() != null && bookmarks != null && apiResponse.getStatuses().size() > 0) {
List<fr.gouv.etalab.mastodon.client.Entities.Status> statuses = apiResponse.getStatuses();

View File

@ -56,7 +56,7 @@ public class RetrievePeertubeSingleAsyncTask extends AsyncTask<Void, Void, Void>
@Override
protected Void doInBackground(Void... params) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
API api = new API(this.contextReference.get());
apiResponse = api.getSinglePeertube(this.instanceName, videoId);
}else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){

View File

@ -49,7 +49,7 @@ public class RetrieveRelationshipAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
API api = new API(this.contextReference.get());
relationship = api.getRelationship(accountId);
error = api.getError();

View File

@ -50,7 +50,8 @@ public class UpdateAccountInfoAsyncTask extends AsyncTask<Void, Void, Void> {
public enum SOCIAL{
MASTODON,
PEERTUBE,
PIXELFED
PIXELFED,
PLEROMA
}
public UpdateAccountInfoAsyncTask(Context context, String token, String client_id, String client_secret, String refresh_token, String instance, SOCIAL social){
this.contextReference = new WeakReference<>(context);

View File

@ -58,7 +58,7 @@ public class UpdateAccountInfoByIDAsyncTask extends AsyncTask<Void, Void, Void>
SharedPreferences sharedpreferences = this.contextReference.get().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
Account account = null;
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
account = new API(this.contextReference.get()).getAccount(userId);
else if( social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
@ -97,7 +97,7 @@ public class UpdateAccountInfoByIDAsyncTask extends AsyncTask<Void, Void, Void>
new AccountDAO(this.contextReference.get(), db).updateAccount(account);
}
}
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
try {
APIResponse response = new API(contextReference.get()).getCustomEmoji();
if (response != null && response.getEmojis() != null && response.getEmojis().size() > 0) {

View File

@ -3862,6 +3862,10 @@ public class API {
}catch (Exception ignored){
account.setSocial("MASTODON");
}
try{
if( resobj.has("pleroma") )
account.setSocial("PLEROMA");
}catch (Exception ignored){}
try {
JSONArray fields = resobj.getJSONArray("fields");
LinkedHashMap<String, String> fieldsMap = new LinkedHashMap<>();

View File

@ -96,7 +96,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
final Account account = accounts.get(position);
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if(MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
holder.account_mute_notification.hide();
if (action == RetrieveAccountsAsyncTask.Type.BLOCKED)
account.setFollowType(Account.followAction.BLOCK);

View File

@ -230,7 +230,7 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
}
swipeRefreshLayout.setRefreshing(false);
firstLoad = false;
if( type != RetrieveAccountsAsyncTask.Type.BLOCKED && MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( type != RetrieveAccountsAsyncTask.Type.BLOCKED && (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA))
new RetrieveManyRelationshipsAsyncTask(context, accounts,DisplayAccountsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

View File

@ -132,7 +132,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
}
});
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
if( receive_action != null)
LocalBroadcastManager.getInstance(context).unregisterReceiver(receive_action);

View File

@ -235,7 +235,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
//Manage broadcast receiver for Mastodon timelines
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
if( receive_action != null)
LocalBroadcastManager.getInstance(context).unregisterReceiver(receive_action);
receive_action = new BroadcastReceiver() {

View File

@ -88,7 +88,7 @@ public class CrossActions {
for(Account account: accountstmp){
String mentionAcct = (mention.getAcct().contains("@"))?mention.getAcct():mention.getAcct()+"@"+currentAccount.getInstance();
if( (account.getAcct() + "@" + account.getInstance()).equals(mentionAcct) && !addedAccount.contains(account.getId() + "|" + account.getAcct())) {
if( account.getSocial() == null || account.getSocial().equals("MASTODON"))
if( account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA"))
accounts.add(account);
}
}
@ -97,7 +97,7 @@ public class CrossActions {
Account tootOwner = status.getAccount();
String mentionAcct = (tootOwner.getAcct().contains("@"))?tootOwner.getAcct():tootOwner.getAcct()+"@"+currentAccount.getInstance();
if( (account.getAcct() + "@" + account.getInstance()).equals(mentionAcct) && !addedAccount.contains(account.getId() + "|" + account.getAcct())) {
if( account.getSocial() == null || account.getSocial().equals("MASTODON"))
if( account.getSocial() == null || account.getSocial().equals("MASTODON")|| account.getSocial().equals("PLEROMA"))
accounts.add(account);
}
}

View File

@ -1299,7 +1299,7 @@ public class Helper {
MenuItem itemPCom = menu.findItem(R.id.nav_peertube_comm);
if( itemPCom != null)
itemPCom.setVisible(false);
}else if( BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON){
}else if( BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA){
MenuItem itemCom = menu.findItem(R.id.nav_peertube_comm);
if( itemCom != null)
itemCom.setVisible(false);
@ -1594,7 +1594,7 @@ public class Helper {
}
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
finalIcon.setImageResource(R.drawable.missing);
else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
finalIcon.setImageResource(R.drawable.missing_peertube);
@ -1648,7 +1648,7 @@ public class Helper {
}
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON)
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA)
itemIconAcc.setImageResource(R.drawable.missing);
else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE)
itemIconAcc.setImageResource(R.drawable.missing_peertube);
@ -2738,7 +2738,7 @@ public class Helper {
url = Helper.getLiveInstanceWithProtocol(context) + url;
}
if( url == null || url.equals("null") || url.contains("missing.png") || url.contains(".svg")) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
try {
Glide.with(imageView.getContext())
.load(R.drawable.missing)

View File

@ -131,7 +131,7 @@ public class NotificationsSyncJob extends Job {
return;
//Retrieve users in db that owner has.
for (Account account: accounts) {
if( account.getSocial() == null || account.getSocial().equals("MASTODON")) {
if( account.getSocial() == null || account.getSocial().equals("MASTODON")|| account.getSocial().equals("PLEROMA")) {
API api = new API(getContext(), account.getInstance(), account.getToken());
APIResponse apiResponse = api.getNotificationsSince(null, false);
onRetrieveNotifications(apiResponse, account);

View File

@ -113,6 +113,7 @@ public class AccountDAO {
values.put(Sqlite.COL_CREATED_AT, Helper.dateToString(account.getCreated_at()));
values.put(Sqlite.COL_INSTANCE, account.getInstance());
values.put(Sqlite.COL_EMOJIS, Helper.emojisToStringStorage(account.getEmojis()));
values.put(Sqlite.COL_SOCIAL, account.getSocial());
if( account.getClient_id() != null && account.getClient_secret() != null && account.getRefresh_token() != null) {
values.put(Sqlite.COL_CLIENT_ID, account.getClient_id());
values.put(Sqlite.COL_CLIENT_SECRET, account.getClient_secret());