forked from mirror/monocles_chat_clean
update fork #128
6 changed files with 41 additions and 5 deletions
Add "Follow feed" switch to contact details and change the comments and posts node configuration
commit
e39252616c
|
|
@ -846,10 +846,23 @@ public class Contact implements ListItem, Blockable {
|
|||
public static final int DIRTY_DELETE = 7;
|
||||
private static final int SYNCED_VIA_ADDRESS_BOOK = 8;
|
||||
public static final int SYNCED_VIA_OTHER = 9;
|
||||
public static final int FOLLOWED = 10;
|
||||
}
|
||||
|
||||
// Method to update this Contact's presences/status messages
|
||||
public void updatePresences(List<String> newStatusMessages) {
|
||||
this.presences.updateStatusMessages(newStatusMessages);
|
||||
}
|
||||
|
||||
public boolean isFollowed() {
|
||||
return getOption(Options.FOLLOWED);
|
||||
}
|
||||
|
||||
public void setFollowed(boolean followed) {
|
||||
if (followed) {
|
||||
setOption(Options.FOLLOWED);
|
||||
} else {
|
||||
resetOption(Options.FOLLOWED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -875,7 +875,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||
options.putString("pubsub#type", Namespace.PUBSUB_SOCIAL_FEED);
|
||||
options.putString("pubsub#access_model", "roster");
|
||||
options.putString("pubsub#persist_items", "1");
|
||||
options.putString("pubsub#max_items", "1000");
|
||||
options.putString("pubsub#max_items", "max");
|
||||
options.putString("pubsub#notify_retract", "1");
|
||||
options.putString("pubsub#send_last_published_item", "never");
|
||||
options.putString("pubsub#publish_model", "publishers");
|
||||
|
|
@ -886,7 +886,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||
Bundle options = new Bundle();
|
||||
options.putString("pubsub#node_type", "leaf");
|
||||
options.putString("pubsub#type", Namespace.PUBSUB_SOCIAL_FEED);
|
||||
options.putString("pubsub#access_model", "open");
|
||||
options.putString("pubsub#access_model", "roster");
|
||||
options.putString("pubsub#persist_items", "1");
|
||||
options.putString("pubsub#max_items", "1000");
|
||||
options.putString("pubsub#notify_retract", "1");
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ public class ContactDetailsActivity extends OmemoActivity
|
|||
|
||||
private Contact contact;
|
||||
private MaterialSwitch mDisableCallsSwitch;
|
||||
private MaterialSwitch mFollowFeedSwitch;
|
||||
private final DialogInterface.OnClickListener removeFromRoster =
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
|
|
@ -180,6 +181,15 @@ public class ContactDetailsActivity extends OmemoActivity
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final OnCheckedChangeListener mOnFollowFeedCheckedChange =
|
||||
(buttonView, isChecked) -> {
|
||||
if (contact != null) {
|
||||
contact.setFollowed(isChecked);
|
||||
xmppConnectionService.updateContact(contact);
|
||||
}
|
||||
};
|
||||
|
||||
private Jid accountJid;
|
||||
private Jid contactJid;
|
||||
private boolean showDynamicTags = false;
|
||||
|
|
@ -312,6 +322,8 @@ public class ContactDetailsActivity extends OmemoActivity
|
|||
});
|
||||
binding.addContactButton.setOnClickListener(v -> showAddToRosterDialog(contact));
|
||||
mDisableCallsSwitch = binding.disableCalls;
|
||||
mFollowFeedSwitch = binding.followFeedSwitch;
|
||||
mFollowFeedSwitch.setOnCheckedChangeListener(mOnFollowFeedCheckedChange);
|
||||
mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
|
||||
this.binding.media.setAdapter(mMediaAdapter);
|
||||
GridManager.setupLayoutManager(this, this.binding.media, R.dimen.media_size);
|
||||
|
|
@ -611,7 +623,6 @@ public class ContactDetailsActivity extends OmemoActivity
|
|||
xmppConnectionService.updateContact(contact);
|
||||
});
|
||||
|
||||
|
||||
List<String> statusMessages = contact.getPresences().getStatusMessages();
|
||||
if (statusMessages.isEmpty()) {
|
||||
binding.statusMessage.setVisibility(View.GONE);
|
||||
|
|
@ -889,6 +900,9 @@ public class ContactDetailsActivity extends OmemoActivity
|
|||
this.binding.recentThreadsWrapper.setVisibility(View.VISIBLE);
|
||||
Util.justifyListViewHeightBasedOnChildren(binding.recentThreads);
|
||||
}
|
||||
if (contact != null) {
|
||||
mFollowFeedSwitch.setChecked(contact.isFollowed());
|
||||
}
|
||||
}
|
||||
|
||||
private void onBadgeClick(final View view) {
|
||||
|
|
|
|||
|
|
@ -216,12 +216,12 @@ public class PostsActivity extends XmppActivity implements XmppConnectionService
|
|||
java.util.Collections.sort(postList, (p1, p2) -> Long.compare(p2.getPublished().getTime(), p1.getPublished().getTime()));
|
||||
postsAdapter.notifyDataSetChanged();
|
||||
|
||||
for(Account account : xmppConnectionService.getAccounts()) {
|
||||
for(final Account account : xmppConnectionService.getAccounts()) {
|
||||
if(account.isOnlineAndConnected()) {
|
||||
final List<Jid> sourcesToFetch = new ArrayList<>();
|
||||
sourcesToFetch.add(account.getJid().asBareJid());
|
||||
for (eu.siacs.conversations.entities.Contact contact : account.getRoster().getContacts()) {
|
||||
if (contact.getOption(Contact.Options.FROM)) {
|
||||
if (contact.isFollowed()) {
|
||||
sourcesToFetch.add(contact.getJid().asBareJid());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,6 +163,12 @@
|
|||
android:textColor="@color/black87"
|
||||
android:text="@string/add_contact" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/follow_feed_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/follow_feed" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@+id/details_send_presence"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -180,7 +186,9 @@
|
|||
android:id="@+id/disable_calls"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/disable_voice_and_video_calls" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -1623,6 +1623,7 @@
|
|||
<string name="choose_account_for_reply">Choose an account for the reply</string>
|
||||
<string name="choose_account_for_comment">Choose an account for the comment</string>
|
||||
<string name="account_not_found">Account not found</string>
|
||||
<string name="follow_feed">Follow feed</string>
|
||||
<plurals name="publishing_to_x_contacts">
|
||||
<item quantity="one">Publishing to %d contact</item>
|
||||
<item quantity="other">Publishing to %d contacts</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue