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

Commit 6367ff13 authored by Anushree Ganjam's avatar Anushree Ganjam Committed by Automerger Merge Worker
Browse files

Merge "Add "incrementEventCountBy" function to OnboardingPrefs." into tm-dev...

Merge "Add "incrementEventCountBy" function to OnboardingPrefs." into tm-dev am: 218703d5 am: bfc82b02

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/18500283



Change-Id: I2715b9694e6c49e5b6e593be05eff3cb77fcea96
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 50d8cf6d bfc82b02
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -140,4 +140,19 @@ public class OnboardingPrefs<T extends ActivityContext> {
        mSharedPrefs.edit().putInt(eventKey, count).apply();
        return hasReachedMaxCount(count, eventKey);
    }

    /**
     * Add "incCountBy" to the given event count, if we haven't already reached the max count.
     *
     * @return Whether we have now reached the max count.
     */
    public boolean incrementEventCountBy(int incCountBy, @EventCountKey String eventKey) {
        int count = getCount(eventKey);
        if (hasReachedMaxCount(count, eventKey)) {
            return true;
        }
        count += incCountBy;
        mSharedPrefs.edit().putInt(eventKey, count).apply();
        return hasReachedMaxCount(count, eventKey);
    }
}