Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 147e8627 authored by Android Dialer's avatar Android Dialer Committed by Copybara-Service
Browse files

Use StorageComponent to get SharedPreference in SpamBlockingPromoHelper

Test: SpamBlockingPromoHelperTest
PiperOrigin-RevId: 197068358
Change-Id: Ic4b69781d0b32035c7d12d91d27e85d99e7d3732
parent d9d4b060
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.app.Notification.Builder;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface.OnDismissListener;
import android.preference.PreferenceManager;
import android.support.design.widget.Snackbar;
import android.support.v4.os.BuildCompat;
import android.view.View;
@@ -35,6 +34,7 @@ import com.android.dialer.notification.DialerNotificationManager;
import com.android.dialer.notification.NotificationChannelId;
import com.android.dialer.spam.SpamSettings;
import com.android.dialer.spam.promo.SpamBlockingPromoDialogFragment.OnEnableListener;
import com.android.dialer.storage.StorageComponent;

/** Helper class for showing spam blocking on-boarding promotions. */
public class SpamBlockingPromoHelper {
@@ -71,7 +71,8 @@ public class SpamBlockingPromoHelper {
    }

    long lastShowMillis =
        PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext())
        StorageComponent.get(context)
            .unencryptedSharedPrefs()
            .getLong(SPAM_BLOCKING_PROMO_LAST_SHOW_MILLIS, 0);
    long showPeriodMillis =
        ConfigProviderBindings.get(context)
@@ -103,10 +104,11 @@ public class SpamBlockingPromoHelper {
  }

  private void updateLastShowSpamTimestamp() {
    PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext())
    StorageComponent.get(context)
        .unencryptedSharedPrefs()
        .edit()
        .putLong(SPAM_BLOCKING_PROMO_LAST_SHOW_MILLIS, System.currentTimeMillis())
        .commit();
        .apply();
  }

  /**