Java Code Examples for org.telegram.messenger.MessagesController#getMainSettings()

The following examples show how to use org.telegram.messenger.MessagesController#getMainSettings() . 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: VoIPService.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateServerConfig(){
	final SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
	VoIPServerConfig.setConfig(preferences.getString("voip_server_config", "{}"));
	ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_phone_getCallConfig(), new RequestDelegate(){
		@Override
		public void run(TLObject response, TLRPC.TL_error error){
			if(error==null){
				String data=((TLRPC.TL_dataJSON) response).data;
				VoIPServerConfig.setConfig(data);
				preferences.edit().putString("voip_server_config", data).commit();
			}
		}
	});
}
 
Example 2
Source File: VoIPHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public static void upgradeP2pSetting(int account){
	SharedPreferences prefs=MessagesController.getMainSettings(account);
	if(prefs.contains("calls_p2p")){
		SharedPreferences.Editor e=prefs.edit();
		if(!prefs.getBoolean("calls_p2p", true)){
			e.putInt("calls_p2p_new", 2);
		}
		e.remove("calls_p2p").commit();
	}
}
 
Example 3
Source File: ChatActivityEnterView.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void hidePopup(boolean byBackButton)
{
    if (isPopupShowing())
    {
        if (currentPopupContentType == 1 && byBackButton && botButtonsMessageObject != null)
        {
            SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
            preferences.edit().putInt("hidekeyboard_" + dialog_id, botButtonsMessageObject.getId()).commit();
        }
        if (byBackButton && searchingStickers)
        {
            searchingStickers = false;
            emojiView.closeSearch(true);
            messageEditText.requestFocus();
            setStickersExpanded(false, true, false);
        }
        else
        {
            if (searchingStickers)
            {
                searchingStickers = false;
                emojiView.closeSearch(false);
                messageEditText.requestFocus();
            }
            showPopup(0, 0);
            removeGifFromInputField();
        }
    }
}
 
Example 4
Source File: VoIPService.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateServerConfig(){
	final SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
	VoIPServerConfig.setConfig(preferences.getString("voip_server_config", "{}"));
	ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_phone_getCallConfig(), new RequestDelegate(){
		@Override
		public void run(TLObject response, TLRPC.TL_error error){
			if(error==null){
				String data=((TLRPC.TL_dataJSON) response).data;
				VoIPServerConfig.setConfig(data);
				preferences.edit().putString("voip_server_config", data).commit();
			}
		}
	});
}
 
Example 5
Source File: VoIPHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public static void upgradeP2pSetting(int account){
	SharedPreferences prefs=MessagesController.getMainSettings(account);
	if(prefs.contains("calls_p2p")){
		SharedPreferences.Editor e=prefs.edit();
		if(!prefs.getBoolean("calls_p2p", true)){
			e.putInt("calls_p2p_new", 2);
		}
		e.remove("calls_p2p").commit();
	}
}
 
Example 6
Source File: ChatActivityEnterView.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public void hidePopup(boolean byBackButton)
{
    if (isPopupShowing())
    {
        if (currentPopupContentType == 1 && byBackButton && botButtonsMessageObject != null)
        {
            SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
            preferences.edit().putInt("hidekeyboard_" + dialog_id, botButtonsMessageObject.getId()).commit();
        }
        if (byBackButton && searchingStickers)
        {
            searchingStickers = false;
            emojiView.closeSearch(true);
            messageEditText.requestFocus();
            setStickersExpanded(false, true, false);
        }
        else
        {
            if (searchingStickers)
            {
                searchingStickers = false;
                emojiView.closeSearch(false);
                messageEditText.requestFocus();
            }
            showPopup(0, 0);
            removeGifFromInputField();
        }
    }
}
 
Example 7
Source File: VoIPService.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateServerConfig(){
	final SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
	TgVoip.setGlobalServerConfig(preferences.getString("voip_server_config", "{}"));
	ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_phone_getCallConfig(), (response, error) -> {
		if (error == null) {
			String data = ((TLRPC.TL_dataJSON) response).data;
			TgVoip.setGlobalServerConfig(data);
			preferences.edit().putString("voip_server_config", data).commit();
		}
	});
}
 
Example 8
Source File: TestActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onFragmentDestroy() {
    super.onFragmentDestroy();
    if (encryptedString != null) {
        SharedPreferences preferences = MessagesController.getMainSettings(UserConfig.selectedAccount);
        preferences.edit().remove("test_enc").commit();
    }
}
 
Example 9
Source File: VoIPService.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateServerConfig(){
	final SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
	TgVoip.setGlobalServerConfig(preferences.getString("voip_server_config", "{}"));
	ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_phone_getCallConfig(), (response, error) -> {
		if (error == null) {
			String data = ((TLRPC.TL_dataJSON) response).data;
			TgVoip.setGlobalServerConfig(data);
			preferences.edit().putString("voip_server_config", data).commit();
		}
	});
}
 
Example 10
Source File: TestActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onFragmentDestroy() {
    super.onFragmentDestroy();
    if (encryptedString != null) {
        SharedPreferences preferences = MessagesController.getMainSettings(UserConfig.selectedAccount);
        preferences.edit().remove("test_enc").commit();
    }
}