Search in sources :

Example 6 with RemoteLogger

use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.

the class AccountHelper method init.

/**
 * Init the class by getting the KeyStore that contains encryption keys or make
 * new keys when they do not exists yet.
 */
private void init() {
    mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
    mRemoteLogger = new RemoteLogger(AccountHelper.class);
    // several workarounds.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        try {
            mKeyStore = KeyStore.getInstance("AndroidKeyStore");
            mKeyStore.load(null);
            if (!mKeyStore.containsAlias(KEY_ALIAS)) {
                generateKeyPair();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : RemoteLogger(com.voipgrid.vialer.logging.RemoteLogger)

Example 7 with RemoteLogger

use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.

the class CallRecordFragment method failedFeedback.

private void failedFeedback(Response response) {
    if (getActivity() == null) {
        new RemoteLogger(CallRecordFragment.class).enableConsoleLogging().e("CallRecordFragment is no longer attached to an activity");
        return;
    }
    String message = getString(R.string.empty_view_default_message);
    // Check if authorized.
    if (response != null && (response.code() == 401 || response.code() == 403)) {
        message = getString(R.string.empty_view_unauthorized_message);
    }
    if (mAdapter.getCount() == 0) {
        setEmptyView(new EmptyView(getActivity(), message), true);
    } else {
        // Adapter has cached values and we're not about to overwrite them. However,
        // we do want to notify the user.
        Snackbar.make(getView(), message, Snackbar.LENGTH_SHORT).show();
    }
    mSwipeRefreshLayout.setRefreshing(false);
}
Also used : RemoteLogger(com.voipgrid.vialer.logging.RemoteLogger) EmptyView(com.voipgrid.vialer.EmptyView)

Example 8 with RemoteLogger

use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.

the class SyncUtils method setFullSyncInProgress.

/**
 * Set the value of the fullSyncInProgress setting.
 * @param inProgress
 */
public static void setFullSyncInProgress(Context context, boolean inProgress) {
    new RemoteLogger(SyncUtils.class).d(TAG + " setFullSyncInProgress");
    PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(SyncConstants.FULL_SYNC_INPROGRESS, inProgress).apply();
}
Also used : RemoteLogger(com.voipgrid.vialer.logging.RemoteLogger)

Example 9 with RemoteLogger

use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.

the class SyncUtils method setPeriodicSync.

/**
 * Function to set the periodic sync interval (1 day) for a full contact sync.
 * @param context
 */
public static void setPeriodicSync(Context context) {
    new RemoteLogger(SyncUtils.class).d(TAG + " setPeriodicSync");
    // job we can't really ask the user for permission.
    if (!ContactsPermission.hasPermission(context)) {
        // TODO VIALA-349 Delete sync account.
        return;
    }
    Account account = checkSyncAccount(context);
    // Full sync every day.
    ContentResolver.addPeriodicSync(account, ContactsContract.AUTHORITY, new Bundle(), SyncConstants.PERIODIC_SYNC_INTERVAL);
}
Also used : Account(android.accounts.Account) Bundle(android.os.Bundle) RemoteLogger(com.voipgrid.vialer.logging.RemoteLogger)

Example 10 with RemoteLogger

use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.

the class LoginRequiredActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    Preferences prefs = new Preferences(this);
    if (!prefs.isLoggedIn() && prefs.finishedOnboarding()) {
        new RemoteLogger(LoginRequiredActivity.class).w("Not logged in anymore! Redirecting to onboarding");
        // Go to onboarding.
        Intent intent = new Intent(new Intent(this, SetupActivity.class));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
        finish();
    }
}
Also used : SetupActivity(com.voipgrid.vialer.onboarding.SetupActivity) Intent(android.content.Intent) RemoteLogger(com.voipgrid.vialer.logging.RemoteLogger) Preferences(com.voipgrid.vialer.Preferences)

Aggregations

RemoteLogger (com.voipgrid.vialer.logging.RemoteLogger)17 JsonStorage (com.voipgrid.vialer.util.JsonStorage)5 Bundle (android.os.Bundle)4 Preferences (com.voipgrid.vialer.Preferences)4 Intent (android.content.Intent)3 Account (android.accounts.Account)2 SharedPreferences (android.content.SharedPreferences)2 AnalyticsApplication (com.voipgrid.vialer.analytics.AnalyticsApplication)2 AnalyticsHelper (com.voipgrid.vialer.analytics.AnalyticsHelper)2 PhoneAccount (com.voipgrid.vialer.api.models.PhoneAccount)2 SystemUser (com.voipgrid.vialer.api.models.SystemUser)2 SetupActivity (com.voipgrid.vialer.onboarding.SetupActivity)2 AccountHelper (com.voipgrid.vialer.util.AccountHelper)2 Activity (android.app.Activity)1 Fragment (android.app.Fragment)1 IntentFilter (android.content.IntentFilter)1 MatrixCursor (android.database.MatrixCursor)1 Handler (android.os.Handler)1 MediaSessionCompat (android.support.v4.media.session.MediaSessionCompat)1 PlaybackStateCompat (android.support.v4.media.session.PlaybackStateCompat)1