1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-07-04 11:13:36 +00:00

Fix sessions

This commit is contained in:
世界 2021-03-14 20:09:46 +08:00
parent 4ef352adfd
commit 3baedb37f2
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -431,39 +431,39 @@ public class SessionsActivity extends BaseFragment implements NotificationCenter
}
}
if (currentType == 0) {
undoView = new UndoView(context) {
@Override
public void hide(boolean apply, int animated) {
if (!apply) {
TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) getCurrentInfoObject();
TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization();
req.hash = authorization.hash;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
if (error == null) {
sessions.remove(authorization);
passwordSessions.remove(authorization);
updateRows();
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
loadSessions(true);
}
}));
}
super.hide(apply, animated);
}
};
frameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
}
if (newAuthorizationToOpen != null && undoView != null) {
AndroidUtilities.runOnUIThread(() -> undoView.showWithAction(0, UndoView.ACTION_QR_SESSION_ACCEPTED, newAuthorizationToOpen), 3000L);
}
}
});
if (currentType == 0) {
undoView = new UndoView(context) {
@Override
public void hide(boolean apply, int animated) {
if (!apply) {
TLRPC.TL_authorization authorization = (TLRPC.TL_authorization) getCurrentInfoObject();
TLRPC.TL_account_resetAuthorization req = new TLRPC.TL_account_resetAuthorization();
req.hash = authorization.hash;
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
if (error == null) {
sessions.remove(authorization);
passwordSessions.remove(authorization);
updateRows();
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
loadSessions(true);
}
}));
}
super.hide(apply, animated);
}
};
frameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
}
if (newAuthorizationToOpen != null && undoView != null) {
AndroidUtilities.runOnUIThread(() -> undoView.showWithAction(0, UndoView.ACTION_QR_SESSION_ACCEPTED, newAuthorizationToOpen), 3000L);
}
return fragmentView;
}