Java Code Examples for org.telegram.tgnet.TLRPC#TL_account_updateProfile
The following examples show how to use
org.telegram.tgnet.TLRPC#TL_account_updateProfile .
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: ChangeNameActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private void saveName() { TLRPC.User currentUser = UserConfig.getInstance(currentAccount).getCurrentUser(); if (currentUser == null || lastNameField.getText() == null || firstNameField.getText() == null) { return; } String newFirst = firstNameField.getText().toString(); String newLast = lastNameField.getText().toString(); if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) { return; } TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); req.flags = 3; currentUser.first_name = req.first_name = newFirst; currentUser.last_name = req.last_name = newLast; TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); if (user != null) { user.first_name = req.first_name; user.last_name = req.last_name; } UserConfig.getInstance(currentAccount).saveConfig(true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { }); }
Example 2
Source File: ChangeNameActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
private void saveName() { TLRPC.User currentUser = UserConfig.getInstance(currentAccount).getCurrentUser(); if (currentUser == null || lastNameField.getText() == null || firstNameField.getText() == null) { return; } String newFirst = firstNameField.getText().toString(); String newLast = lastNameField.getText().toString(); if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) { return; } TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); req.flags = 3; currentUser.first_name = req.first_name = newFirst; currentUser.last_name = req.last_name = newLast; TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); if (user != null) { user.first_name = req.first_name; user.last_name = req.last_name; } UserConfig.getInstance(currentAccount).saveConfig(true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { }); }
Example 3
Source File: ChangeNameActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void saveName() { TLRPC.User currentUser = UserConfig.getInstance(currentAccount).getCurrentUser(); if (currentUser == null || lastNameField.getText() == null || firstNameField.getText() == null) { return; } String newFirst = firstNameField.getText().toString(); String newLast = lastNameField.getText().toString(); if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) { return; } TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); req.flags = 3; currentUser.first_name = req.first_name = newFirst; currentUser.last_name = req.last_name = newLast; TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); if (user != null) { user.first_name = req.first_name; user.last_name = req.last_name; } UserConfig.getInstance(currentAccount).saveConfig(true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { }); }
Example 4
Source File: ChangeNameActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void saveName() { TLRPC.User currentUser = UserConfig.getInstance(currentAccount).getCurrentUser(); if (currentUser == null || lastNameField.getText() == null || firstNameField.getText() == null) { return; } String newFirst = firstNameField.getText().toString(); String newLast = lastNameField.getText().toString(); if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) { return; } TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); req.flags = 3; currentUser.first_name = req.first_name = newFirst; currentUser.last_name = req.last_name = newLast; TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId()); if (user != null) { user.first_name = req.first_name; user.last_name = req.last_name; } UserConfig.getInstance(currentAccount).saveConfig(true); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged); NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME); ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> { }); }