Experiments.java
5.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
package com.bitstrips.imoji.experiments;
import android.util.Log;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.util.PreferenceUtils;
import com.google.gson.Gson;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Singleton;
import retrofit.Callback;
import retrofit.RetrofitError;
@Singleton
public class Experiments
{
public static final String EXPERIMENT_BIGGER_SELFIE_ENABLED = "experiments.bigger-selfie.enabled";
public static final String EXPERIMENT_FILTER_OPTION_TRAITS_ENABLED = "experiments.filter-option-traits.enabled";
public static final String SETTINGS_FACE_RECOGNITION_ENABLE_RATIO = "settings.face-recognition-v2-enable-ratio";
public static final String SETTINGS_MIRROR_SAVE_RATIO = "settings.mirror-save-ratio-android";
public static final String SETTINGS_MIRROR_SHOW_ENABLED = "settings.mirror-show-enabled";
public static final String SETTINGS_MONOUSER_ENABLE_RATIO = "settings.monouser-enable";
public static final String STUDY_CHILLVIBES_CONTENT_GROUP = "experiments.chillvibes.content-group";
public static final String STUDY_CHILLVIBES_CONTENT_GROUP_DEFAULT = "default";
public static final String STUDY_MIRROR_SHOW_ENABLED = "experiments.mirror-show.enabled";
public static final String STUDY_SMARTVIBES_REORDER_CONTENT_ENABLED = "experiments.smartvibes.reorderContentEnabled";
public static final String STUDY_SMARTVIBES_SUGGEST_CONTENT_ENABLED = "experiments.smartvibes.suggestContentEnabled";
public static final String STUDY_UPGRADE_TEASER_ENABLED = "experiments.full-upgrade-teaser-android.enabled";
private static final String a = Experiments.class.getSimpleName();
private ExperimentsResult b;
private ExperimentsResult c;
private final BitmojiApi d;
private final PreferenceUtils e;
@Inject
public Experiments(BitmojiApi paramBitmojiApi, PreferenceUtils paramPreferenceUtils)
{
this.d = paramBitmojiApi;
this.e = paramPreferenceUtils;
}
private Object a(String paramString)
{
boolean bool;
Object localObject;
if (paramString.split("\\.").length == 2)
{
bool = true;
if (!Boolean.valueOf(bool).booleanValue()) {
break label93;
}
if (this.c == null) {
break label53;
}
localObject = this.c;
}
for (;;)
{
if ((localObject != null) && (((ExperimentsResult)localObject).settings != null)) {
break label101;
}
return null;
bool = false;
break;
label53:
localObject = this.e.getString(2131231223, "");
this.c = ((ExperimentsResult)new Gson().fromJson((String)localObject, ExperimentsResult.class));
localObject = this.c;
continue;
label93:
localObject = b();
}
label101:
return ((ExperimentsResult)localObject).settings.get(paramString);
}
private ExperimentsResult b()
{
if (this.b != null) {
return this.b;
}
String str = this.e.getString(2131231224, "");
this.b = ((ExperimentsResult)new Gson().fromJson(str, ExperimentsResult.class));
return this.b;
}
public boolean getBoolean(String paramString, boolean paramBoolean)
{
paramString = a(paramString);
if (paramString == null) {
return paramBoolean;
}
if ((paramString instanceof Boolean)) {
return ((Boolean)paramString).booleanValue();
}
Log.e(a, "Non-boolean value detected.");
return paramBoolean;
}
public int[] getExperimentIds()
{
ExperimentsResult localExperimentsResult = b();
if ((localExperimentsResult == null) || (localExperimentsResult.experimentIds == null)) {
return new int[0];
}
return (int[])localExperimentsResult.experimentIds.clone();
}
public float getFloat(String paramString, float paramFloat)
{
paramString = a(paramString);
if (paramString == null) {
return paramFloat;
}
if ((paramString instanceof Number)) {
return ((Number)paramString).floatValue();
}
Log.e(a, "Non-float value detected.");
return paramFloat;
}
public int getInt(String paramString, int paramInt)
{
paramString = a(paramString);
if (paramString == null) {
return paramInt;
}
if ((paramString instanceof Number)) {
return ((Number)paramString).intValue();
}
Log.e(a, "Non-integer value detected.");
return paramInt;
}
public String getString(String paramString1, String paramString2)
{
paramString1 = a(paramString1);
if (paramString1 == null) {
return paramString2;
}
if ((paramString1 instanceof String)) {
return (String)paramString1;
}
Log.e(a, "Non-string value detected.");
return paramString2;
}
public void init(ExperimentsResult paramExperimentsResult)
{
ExperimentsResult localExperimentsResult = paramExperimentsResult;
if (paramExperimentsResult == null) {
localExperimentsResult = new ExperimentsResult();
}
this.e.putString(2131231224, new Gson().toJson(localExperimentsResult));
this.e.putString(2131231223, new Gson().toJson(localExperimentsResult));
this.c = localExperimentsResult;
}
public void reset()
{
this.b = null;
this.e.clearKey(2131231224);
}
public void updateABConfig()
{
this.d.getExperiments(new Callback()
{
public final void failure(RetrofitError paramAnonymousRetrofitError)
{
Log.e(Experiments.a(), "Failed to obtain experiments.", paramAnonymousRetrofitError);
}
});
}
public void updateGlobalVars()
{
this.d.getExperimentsGlobal(new Callback()
{
public final void failure(RetrofitError paramAnonymousRetrofitError)
{
Log.e(Experiments.a(), "Failed to obtain globalVars.", paramAnonymousRetrofitError);
}
});
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/experiments/Experiments.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/