Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
LiuYi0526 committed May 10, 2024
2 parents 0ea29e0 + a344045 commit be26081
Show file tree
Hide file tree
Showing 29 changed files with 465 additions and 360 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7751,7 +7751,7 @@ public void getBlockedPeers(boolean reset) {
}));
}

public void unblockAllUsers() {
public void unblockAllUsers(boolean isDeleted, boolean retry) {

if (totalBlockedCount == 0) return;

Expand All @@ -7762,9 +7762,18 @@ public void unblockAllUsers() {
if (blockedCopy.size() == 0) return;

for (int index = 0; index < blockedCopy.size(); index++) {

TLRPC.TL_contacts_unblock req = new TLRPC.TL_contacts_unblock();
long peer_id = blockedCopy.keyAt(index);
if (isDeleted) {
if (peer_id > 0) {
TLRPC.User user = getMessagesController().getUser(peer_id);
if (!UserObject.isDeleted(user)) {
continue;
}
} else {
continue;
}
}
TLRPC.TL_contacts_unblock req = new TLRPC.TL_contacts_unblock();
req.id = getInputPeer(peer_id);
getConnectionsManager().sendRequest(req, (response, error) -> {

Expand All @@ -7779,7 +7788,9 @@ public void unblockAllUsers() {

}

unblockAllUsers();
if (retry) {
unblockAllUsers(isDeleted, isDeleted ? false : retry);
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ private void resetItems() {
if (NekoXConfig.keepOnlineStatus) {
message += " (" + LocaleController.getString("Locked", R.string.Locked) + ")";
}
items.add(new CheckItem(14, message, R.drawable.msg_views, () -> online, () -> {
items.add(new CheckItem(14, message, R.drawable.msg_view_file, () -> online, () -> {
MessagesController controller = MessagesController.getInstance(UserConfig.selectedAccount);
controller.updateStatus(!online);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public class PrivacyUsersActivity extends BaseFragment implements NotificationCe
public static final int TYPE_BLOCKED = 1;
public static final int TYPE_FILTER = 2;

private int unblock_all = 1;
private static final int unblockAll = 100;
private static final int unblockDeleted = 101;

public interface PrivacyActivityDelegate {
void didUpdateUserList(ArrayList<Long> ids, boolean added);
Expand Down Expand Up @@ -155,13 +156,27 @@ public View createView(Context context) {
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
} else if (id == unblock_all) {
} else if (id == unblockAll) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("UnblockAll", R.string.UnblockAll));
if (getMessagesController().totalBlockedCount != 0) {
builder.setMessage(LocaleController.getString("UnblockAllWarn", R.string.UnblockAllWarn));
builder.setPositiveButton(LocaleController.getString("UnblockAll", R.string.UnblockAll), (dialog, which) -> {
new Thread(() -> getMessagesController().unblockAllUsers()).start();
new Thread(() -> getMessagesController().unblockAllUsers(false, true)).start();
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
} else {
builder.setMessage(LocaleController.getString("BlockedListEmpty",R.string.BlockedListEmpty));
builder.setPositiveButton(LocaleController.getString("OK",R.string.OK),null);
}
showDialog(builder.create());
} else if (id == unblockDeleted) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("UnblockDeleted", R.string.UnblockDeleted));
if (getMessagesController().totalBlockedCount != 0) {
builder.setMessage(LocaleController.getString("UnblockDeletedWarn", R.string.UnblockDeletedWarn));
builder.setPositiveButton(LocaleController.getString("UnblockDeleted", R.string.UnblockDeleted), (dialog, which) -> {
new Thread(() -> getMessagesController().unblockAllUsers(true, true)).start();
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
} else {
Expand All @@ -179,7 +194,8 @@ public void onItemClick(int id) {

ActionBarMenuItem otherItem = menu.addItem(0, R.drawable.ic_ab_other);
otherItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
otherItem.addSubItem(unblock_all, LocaleController.getString("UnblockAll", R.string.UnblockAll));
otherItem.addSubItem(unblockAll, LocaleController.getString("UnblockAll", R.string.UnblockAll));
otherItem.addSubItem(unblockDeleted, LocaleController.getString("UnblockDeleted", R.string.UnblockDeleted));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public static void processDeepLink(Uri uri, Callback callback, Runnable unknown)
case "account":
fragment = nekox_fragment = new NekoAccountSettingsActivity();
break;
case "about":
fragment = new NekoSettingsActivity().startOnAbout();
break;
case "chat":
case "chats":
case "c":
Expand Down
Loading

0 comments on commit be26081

Please sign in to comment.