Search in sources :

Example 11 with XMPPAccountSettings

use of com.xabber.android.data.xaccount.XMPPAccountSettings in project xabber-android by redsolution.

the class AccountSyncActivity method deleteAccountSettings.

private void deleteAccountSettings(final boolean deleteAccount) {
    showProgress(getResources().getString(R.string.progress_title_delete_settings));
    if (XabberAccountManager.getInstance().getAccountSyncState(jid) != null && !deleteAccount) {
        SettingsManager.setSyncAllAccounts(false);
        XabberAccountManager.getInstance().setAccountSyncState(jid, false);
    }
    Subscription deleteSubscription = AuthManager.deleteClientSettings(jid).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<List<XMPPAccountSettings>>() {

        @Override
        public void call(List<XMPPAccountSettings> settings) {
            handleSuccessDelete(settings, deleteAccount);
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
            handleErrorDelete(throwable);
        }
    });
    compositeSubscription.add(deleteSubscription);
}
Also used : XMPPAccountSettings(com.xabber.android.data.xaccount.XMPPAccountSettings) List(java.util.List) CompositeSubscription(rx.subscriptions.CompositeSubscription) Subscription(rx.Subscription)

Example 12 with XMPPAccountSettings

use of com.xabber.android.data.xaccount.XMPPAccountSettings in project xabber-android by redsolution.

the class AccountSyncActivity method updateAccountSettings.

public void updateAccountSettings() {
    showProgress(getResources().getString(R.string.progress_title_sync));
    Subscription updateSettingsSubscription = AuthManager.patchClientSettings(XabberAccountManager.getInstance().createSettingsList()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<List<XMPPAccountSettings>>() {

        @Override
        public void call(List<XMPPAccountSettings> s) {
            handleSuccessUpdateSettings(s);
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
            handleErrorUpdateSettings(throwable);
        }
    });
    compositeSubscription.add(updateSettingsSubscription);
}
Also used : XMPPAccountSettings(com.xabber.android.data.xaccount.XMPPAccountSettings) List(java.util.List) CompositeSubscription(rx.subscriptions.CompositeSubscription) Subscription(rx.Subscription)

Example 13 with XMPPAccountSettings

use of com.xabber.android.data.xaccount.XMPPAccountSettings in project xabber-android by redsolution.

the class XabberAccountInfoActivity method onDeleteXabberOrgClick.

public void onDeleteXabberOrgClick(String jid) {
    showProgress(getString(R.string.progress_title_complete));
    Subscription deleteSubscription = AuthManager.deleteClientSettings(jid).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<List<XMPPAccountSettings>>() {

        @Override
        public void call(List<XMPPAccountSettings> settings) {
            handleSuccessDelete(settings);
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
            handleErrorDelete(throwable);
        }
    });
    compositeSubscription.add(deleteSubscription);
}
Also used : XMPPAccountSettings(com.xabber.android.data.xaccount.XMPPAccountSettings) List(java.util.List) Subscription(rx.Subscription)

Example 14 with XMPPAccountSettings

use of com.xabber.android.data.xaccount.XMPPAccountSettings in project xabber-android by redsolution.

the class XabberAccountInfoActivity method updateSettings.

private void updateSettings(final boolean needGoToMainActivity) {
    Subscription getSettingsSubscription = AuthManager.patchClientSettings(XabberAccountManager.getInstance().createSettingsList()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<List<XMPPAccountSettings>>() {

        @Override
        public void call(List<XMPPAccountSettings> s) {
            Log.d(LOG_TAG, "XMPP accounts loading from net: successfully");
            hideProgress();
            updateLastSyncTime();
            Toast.makeText(XabberAccountInfoActivity.this, R.string.sync_success, Toast.LENGTH_SHORT).show();
            if (needGoToMainActivity)
                goToMainActivity();
        }
    }, new Action1<Throwable>() {

        @Override
        public void call(Throwable throwable) {
            Log.d(LOG_TAG, "XMPP accounts loading from net: error: " + throwable.toString());
            hideProgress();
            Toast.makeText(XabberAccountInfoActivity.this, R.string.sync_fail, Toast.LENGTH_SHORT).show();
        }
    });
    compositeSubscription.add(getSettingsSubscription);
}
Also used : XMPPAccountSettings(com.xabber.android.data.xaccount.XMPPAccountSettings) List(java.util.List) Subscription(rx.Subscription)

Aggregations

XMPPAccountSettings (com.xabber.android.data.xaccount.XMPPAccountSettings)14 List (java.util.List)8 Subscription (rx.Subscription)8 CompositeSubscription (rx.subscriptions.CompositeSubscription)5 AccountJid (com.xabber.android.data.entity.AccountJid)2 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 CompoundButton (android.widget.CompoundButton)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 NetworkException (com.xabber.android.data.NetworkException)1 AccountItem (com.xabber.android.data.account.AccountItem)1 XabberAccountInfoActivity (com.xabber.android.ui.activity.XabberAccountInfoActivity)1 HashMap (java.util.HashMap)1