Java Code Examples for org.telegram.messenger.SharedConfig#loadProxyList()

The following examples show how to use org.telegram.messenger.SharedConfig#loadProxyList() . 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: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean onFragmentCreate()
{
    super.onFragmentCreate();

    SharedConfig.loadProxyList();
    currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();

    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxyCheckDone);
    NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didUpdatedConnectionState);

    final SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    useProxySettings = preferences.getBoolean("proxy_enabled", false) && !SharedConfig.proxyList.isEmpty();
    useProxyForCalls = preferences.getBoolean("proxy_enabled_calls", false);

    updateRows(true);

    return true;
}
 
Example 2
Source File: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean onFragmentCreate()
{
    super.onFragmentCreate();

    SharedConfig.loadProxyList();
    currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();

    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxyCheckDone);
    NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didUpdatedConnectionState);

    final SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    useProxySettings = preferences.getBoolean("proxy_enabled", false) && !SharedConfig.proxyList.isEmpty();
    useProxyForCalls = preferences.getBoolean("proxy_enabled_calls", false);

    updateRows(true);

    return true;
}
 
Example 3
Source File: ProxyListActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean onFragmentCreate() {
    super.onFragmentCreate();

    SharedConfig.loadProxyList();
    currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();

    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxyCheckDone);
    NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didUpdateConnectionState);

    final SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    useProxySettings = preferences.getBoolean("proxy_enabled", false) && !SharedConfig.proxyList.isEmpty();
    useProxyForCalls = preferences.getBoolean("proxy_enabled_calls", false);

    updateRows(true);

    return true;
}
 
Example 4
Source File: ProxyListActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean onFragmentCreate() {
    super.onFragmentCreate();

    SharedConfig.loadProxyList();
    currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();

    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
    NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxyCheckDone);
    NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didUpdateConnectionState);

    final SharedPreferences preferences = MessagesController.getGlobalMainSettings();
    useProxySettings = preferences.getBoolean("proxy_enabled", false) && !SharedConfig.proxyList.isEmpty();
    useProxyForCalls = preferences.getBoolean("proxy_enabled_calls", false);

    updateRows(true);

    return true;
}
 
Example 5
Source File: DialogsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onFragmentCreate()
{
    super.onFragmentCreate();

    if (getArguments() != null)
    {
        onlySelect = arguments.getBoolean("onlySelect", false);
        cantSendToChannels = arguments.getBoolean("cantSendToChannels", false);
        dialogsType = arguments.getInt("dialogsType", MessagesController.DialogType.All);
        selectAlertString = arguments.getString("selectAlertString");
        selectAlertStringGroup = arguments.getString("selectAlertStringGroup");
        addToGroupAlertString = arguments.getString("addToGroupAlertString");
        allowSwitchAccount = arguments.getBoolean("allowSwitchAccount");
    }

    if (dialogsType == 0)
        dialogsType = MessagesController.DialogType.All;

    if (dialogsType == MessagesController.DialogType.All)
    {
        askAboutContacts = MessagesController.getGlobalNotificationsSettings().getBoolean("askAboutContacts", true);
        SharedConfig.loadProxyList();
    }

    if (searchString == null)
    {
        currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.dialogsNeedReload);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoaded);
        if (!onlySelect)
        {
            NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeSearchByActiveAction);
            NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
        }
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.encryptedChatUpdated);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.contactsDidLoaded);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.appDidLogout);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.openedChatChanged);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.notificationsSettingsUpdated);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messageReceivedByAck);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messageReceivedByServer);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messageSendError);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.needReloadRecentDialogsSearch);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didLoadedReplyMessages);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.reloadHints);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didUpdatedConnectionState);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.dialogsUnreadCounterChanged);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.userStatusChanged);

        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetPasscode);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.refreshTabs);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.refreshMenuIcons);
    }

    if (!dialogsLoaded[currentAccount])
    {
        MessagesController.getInstance(currentAccount).loadGlobalNotificationsSettings();
        MessagesController.getInstance(currentAccount).loadDialogs(0, 100, true);
        MessagesController.getInstance(currentAccount).loadHintDialogs();
        ContactsController.getInstance(currentAccount).checkInviteText();
        MessagesController.getInstance(currentAccount).loadPinnedDialogs(0, null);
        DataQuery.getInstance(currentAccount).loadRecents(DataQuery.TYPE_FAVE, false, true, false);
        DataQuery.getInstance(currentAccount).checkFeaturedStickers();
        dialogsLoaded[currentAccount] = true;
    }
    return true;
}
 
Example 6
Source File: DialogsActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean onFragmentCreate()
{
    super.onFragmentCreate();

    if (getArguments() != null)
    {
        onlySelect = arguments.getBoolean("onlySelect", false);
        cantSendToChannels = arguments.getBoolean("cantSendToChannels", false);
        dialogsType = arguments.getInt("dialogsType", MessagesController.DialogType.All);
        selectAlertString = arguments.getString("selectAlertString");
        selectAlertStringGroup = arguments.getString("selectAlertStringGroup");
        addToGroupAlertString = arguments.getString("addToGroupAlertString");
        allowSwitchAccount = arguments.getBoolean("allowSwitchAccount");
    }

    if (dialogsType == 0)
        dialogsType = MessagesController.DialogType.All;

    if (dialogsType == MessagesController.DialogType.All)
    {
        askAboutContacts = MessagesController.getGlobalNotificationsSettings().getBoolean("askAboutContacts", true);
        SharedConfig.loadProxyList();
    }

    if (searchString == null)
    {
        currentConnectionState = ConnectionsManager.getInstance(currentAccount).getConnectionState();
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.dialogsNeedReload);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoaded);
        if (!onlySelect)
        {
            NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeSearchByActiveAction);
            NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
        }
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.encryptedChatUpdated);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.contactsDidLoaded);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.appDidLogout);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.openedChatChanged);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.notificationsSettingsUpdated);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messageReceivedByAck);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messageReceivedByServer);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messageSendError);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.needReloadRecentDialogsSearch);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didLoadedReplyMessages);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.reloadHints);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.didUpdatedConnectionState);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.dialogsUnreadCounterChanged);
        NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.userStatusChanged);

        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetPasscode);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.refreshTabs);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.refreshMenuIcons);
    }

    if (!dialogsLoaded[currentAccount])
    {
        MessagesController.getInstance(currentAccount).loadGlobalNotificationsSettings();
        MessagesController.getInstance(currentAccount).loadDialogs(0, 100, true);
        MessagesController.getInstance(currentAccount).loadHintDialogs();
        ContactsController.getInstance(currentAccount).checkInviteText();
        MessagesController.getInstance(currentAccount).loadPinnedDialogs(0, null);
        DataQuery.getInstance(currentAccount).loadRecents(DataQuery.TYPE_FAVE, false, true, false);
        DataQuery.getInstance(currentAccount).checkFeaturedStickers();
        dialogsLoaded[currentAccount] = true;
    }
    return true;
}