.class public final Ldev/maelstrom/ykit/settings/YkitCurrentSettings;
.super Ljava/lang/Object;
.source "SourceFile"

# static fields
.field public static bringBackPhoebeEnabled:Z

.field public static enhancedBlockEnabled:Z

.field public static blockAdsEnabled:Z

.field public static reduceDashboardClutterEnabled:Z

.field public static boilTheFrog:Z

.field public static hideBlazedPosts:Z

.field public static hideFilteredPosts:Z

.field public static hideBlazeButton:Z

# direct methods
.method static constructor <clinit>()V
    .locals 3

    # Get context from CoreApp
    invoke-static {}, Lcom/tumblr/CoreApp;->M()Landroid/content/Context;
    move-result-object v0

    # Get shared prefs
    const-string v1, "dev.maelstrom.ykit.YKIT_PREFERENCES"
    const v2, 0x0
    invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
    move-result-object v0

    sput-object v0, Ldev/maelstrom/ykit/settings/YkitCurrentSettings;->prefs:Landroid/content/SharedPreferences;

    invoke-static {}, Ldev/maelstrom/ykit/settings/YkitCurrentSettings;->loadSettings()V

    return-void
.end method

.method public static update()V
    .locals 0

    invoke-static {}, Ldev/maelstrom/ykit/settings/YkitCurrentSettings;->saveSettings()V

    return-void
.end method

# constructor
.method private constructor <init>()V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# private fields
.field private static prefs:Landroid/content/SharedPreferences;

# private methods
.method private static loadSettings()V
    .locals 7

    sget-object v0, Ldev/maelstrom/ykit/settings/YkitCurrentSettings;->prefs:Landroid/content/SharedPreferences;

    # Get fields from class
    const-class v1, Ldev/maelstrom/ykit/settings/YkitCurrentSettings; # YkitCurrentSettings.class
    invoke-virtual {v1}, Ljava/lang/Class;->getFields()[Ljava/lang/reflect/Field; # clazz.getFields()
    move-result-object v1

    # Iterate over each field
    const v2, 0x0 # i
    :loop
    # i < v1_array.length()
    array-length v3, v1
    if-ge v2, v3, :loopEnd

    aget-object v4, v1, v2 # v4 = v1_array[v2_i]

    # Get field name
    invoke-virtual {v4}, Ljava/lang/reflect/Field;->getName()Ljava/lang/String;
    move-result-object v5 # v5_name = v4.getName()

    # Get stored value in preferences
    const v6, 0x0 # default value
    invoke-interface {v0, v5, v6}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
    move-result v6 # v6_value = v0_prefs.getBoolean(v5_name, v6_false);

    # Set field value
    const v5, 0x0 # v5_null = null;
    invoke-virtual {v4, v5, v6}, Ljava/lang/reflect/Field;->setBoolean(Ljava/lang/Object;Z)V # v4_field.setBoolean(v5_null, v6_value);

    const v3, 0x1
    add-int v2, v3, v2 # i++
    goto :loop
    :loopEnd

    return-void
.end method

.method private static saveSettings()V
    .locals 7

    sget-object v0, Ldev/maelstrom/ykit/settings/YkitCurrentSettings;->prefs:Landroid/content/SharedPreferences;
    invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
    move-result-object v0

    # Get fields from class
    const-class v1, Ldev/maelstrom/ykit/settings/YkitCurrentSettings; # YkitCurrentSettings.class
    invoke-virtual {v1}, Ljava/lang/Class;->getFields()[Ljava/lang/reflect/Field; # clazz.getFields()
    move-result-object v1

    # Iterate over each field
    const v2, 0x0 # i
    :loop
    # i < v1_array.length()
    array-length v3, v1
    if-ge v2, v3, :loopEnd

    aget-object v4, v1, v2 # v4 = v1_array[v2_i]

    # Get field name
    invoke-virtual {v4}, Ljava/lang/reflect/Field;->getName()Ljava/lang/String;
    move-result-object v5 # v5_name = v4.getName()

    # Get field value
    const v6, 0x0 # null
    invoke-virtual {v4, v6}, Ljava/lang/reflect/Field;->getBoolean(Ljava/lang/Object;)Z
    move-result v6 # v6_value = v4.getBoolean(null)

    # Put it into preferences
    invoke-interface {v0, v5, v6}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    const v3, 0x1
    add-int v2, v3, v2 # i++
    goto :loop
    :loopEnd

    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V

    return-void
.end method