Java Code Examples for org.telegram.tgnet.TLRPC#TL_messages_exportChatInvite

The following examples show how to use org.telegram.tgnet.TLRPC#TL_messages_exportChatInvite . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GroupInviteActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void generateLink(final boolean newRequest) {
    loading = true;
    TLRPC.TL_messages_exportChatInvite req = new TLRPC.TL_messages_exportChatInvite();
    req.peer = MessagesController.getInstance(currentAccount).getInputPeer(-chat_id);
    final int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            invite = (TLRPC.ExportedChatInvite) response;
            if (newRequest) {
                if (getParentActivity() == null) {
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setMessage(LocaleController.getString("RevokeAlertNewLink", R.string.RevokeAlertNewLink));
                builder.setTitle(LocaleController.getString("RevokeLink", R.string.RevokeLink));
                builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
                showDialog(builder.create());
            }
        }
        loading = false;
        listAdapter.notifyDataSetChanged();
    }));
    ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
    if (listAdapter != null) {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example 2
Source File: GroupInviteActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void generateLink(final boolean newRequest) {
    loading = true;
    TLRPC.TL_messages_exportChatInvite req = new TLRPC.TL_messages_exportChatInvite();
    req.peer = MessagesController.getInstance(currentAccount).getInputPeer(-chat_id);
    final int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            invite = (TLRPC.ExportedChatInvite) response;
            if (newRequest) {
                if (getParentActivity() == null) {
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setMessage(LocaleController.getString("RevokeAlertNewLink", R.string.RevokeAlertNewLink));
                builder.setTitle(LocaleController.getString("RevokeLink", R.string.RevokeLink));
                builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
                showDialog(builder.create());
            }
        }
        loading = false;
        listAdapter.notifyDataSetChanged();
    }));
    ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
    if (listAdapter != null) {
        listAdapter.notifyDataSetChanged();
    }
}
 
Example 3
Source File: ChatEditTypeActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void generateLink(final boolean newRequest) {
    loadingInvite = true;
    TLRPC.TL_messages_exportChatInvite req = new TLRPC.TL_messages_exportChatInvite();
    req.peer = getMessagesController().getInputPeer(-chatId);
    final int reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            invite = (TLRPC.ExportedChatInvite) response;
            if (info != null) {
                info.exported_invite = invite;
            }
            if (newRequest) {
                if (getParentActivity() == null) {
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setMessage(LocaleController.getString("RevokeAlertNewLink", R.string.RevokeAlertNewLink));
                builder.setTitle(LocaleController.getString("RevokeLink", R.string.RevokeLink));
                builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
                showDialog(builder.create());
            }
        }
        loadingInvite = false;
        if (privateTextView != null) {
            privateTextView.setText(invite != null ? invite.link : LocaleController.getString("Loading", R.string.Loading), true);
        }
    }));
    getConnectionsManager().bindRequestToGuid(reqId, classGuid);
}
 
Example 4
Source File: ChannelCreateActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void generateLink() {
    if (loadingInvite || invite != null) {
        return;
    }
    loadingInvite = true;
    TLRPC.TL_messages_exportChatInvite req = new TLRPC.TL_messages_exportChatInvite();
    req.peer = MessagesController.getInstance(currentAccount).getInputPeer(-chatId);
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            invite = (TLRPC.ExportedChatInvite) response;
        }
        loadingInvite = false;
        privateContainer.setText(invite != null ? invite.link : LocaleController.getString("Loading", R.string.Loading), false);
    }));
}
 
Example 5
Source File: ChatEditTypeActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void generateLink(final boolean newRequest) {
    loadingInvite = true;
    TLRPC.TL_messages_exportChatInvite req = new TLRPC.TL_messages_exportChatInvite();
    req.peer = getMessagesController().getInputPeer(-chatId);
    final int reqId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            invite = (TLRPC.ExportedChatInvite) response;
            if (info != null) {
                info.exported_invite = invite;
            }
            if (newRequest) {
                if (getParentActivity() == null) {
                    return;
                }
                AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                builder.setMessage(LocaleController.getString("RevokeAlertNewLink", R.string.RevokeAlertNewLink));
                builder.setTitle(LocaleController.getString("RevokeLink", R.string.RevokeLink));
                builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
                showDialog(builder.create());
            }
        }
        loadingInvite = false;
        if (privateTextView != null) {
            privateTextView.setText(invite != null ? invite.link : LocaleController.getString("Loading", R.string.Loading), true);
        }
    }));
    getConnectionsManager().bindRequestToGuid(reqId, classGuid);
}
 
Example 6
Source File: ChannelCreateActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void generateLink() {
    if (loadingInvite || invite != null) {
        return;
    }
    loadingInvite = true;
    TLRPC.TL_messages_exportChatInvite req = new TLRPC.TL_messages_exportChatInvite();
    req.peer = MessagesController.getInstance(currentAccount).getInputPeer(-chatId);
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            invite = (TLRPC.ExportedChatInvite) response;
        }
        loadingInvite = false;
        privateContainer.setText(invite != null ? invite.link : LocaleController.getString("Loading", R.string.Loading), false);
    }));
}