MirrorUploadHelper.java
5.43 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
package com.bitstrips.imoji.experiments;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Build.VERSION;
import android.util.Log;
import com.bitstrips.imoji.abv3.AvatarBuilderActivityMode;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.api.BitmojiMirrorImageUploadRequest;
import com.bitstrips.imoji.api.BitmojiMirrorImageUploadRequest.BitmojiMirrorImageUploadUserAgent;
import com.bitstrips.imoji.api.MirrorValidGeoIpResponse;
import com.bitstrips.imoji.behaviour.BehaviourHelper;
import com.bitstrips.imoji.hardware.CameraUtils;
import com.bitstrips.imoji.util.PreferenceUtils;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.json.JSONObject;
import retrofit.Callback;
import retrofit.RetrofitError;
@Singleton
public class MirrorUploadHelper
{
private static final String a = MirrorUploadHelper.class.getSimpleName();
private final BitmojiApi b;
private final PreferenceUtils c;
private final BehaviourHelper d;
private final Experiments e;
@Inject
public MirrorUploadHelper(BitmojiApi paramBitmojiApi, PreferenceUtils paramPreferenceUtils, BehaviourHelper paramBehaviourHelper, Experiments paramExperiments)
{
this.b = paramBitmojiApi;
this.c = paramPreferenceUtils;
this.d = paramBehaviourHelper;
this.e = paramExperiments;
}
public boolean shouldSaveMirrorImage()
{
float f2 = this.d.mirrorSaveRatio();
float f1 = f2;
if (f2 == -1.0D) {
f1 = this.e.getFloat("settings.mirror-save-ratio-android", 0.0F);
}
return Math.random() < f1;
}
public boolean shouldShowMirrorImage()
{
float f = this.d.mirrorSaveRatio();
if (f != -1.0D) {
if (f <= 0.0D) {}
}
while ((this.e.getBoolean("settings.mirror-show-enabled", false)) && (this.e.getBoolean("experiments.mirror-show.enabled", false)))
{
return true;
return false;
}
return false;
}
public void uploadMirrorImage(final FullCharacterDataWithOrigins paramFullCharacterDataWithOrigins, final Bitmap paramBitmap, final AvatarBuilderActivityMode paramAvatarBuilderActivityMode, final String paramString1, Context paramContext, final String paramString2, final boolean paramBoolean)
{
if ((paramBitmap == null) || (paramFullCharacterDataWithOrigins == null)) {}
do
{
return;
paramFullCharacterDataWithOrigins = new Runnable()
{
public final void run()
{
BitmojiMirrorImageUploadRequest localBitmojiMirrorImageUploadRequest = new BitmojiMirrorImageUploadRequest();
Object localObject = new JSONObject(paramFullCharacterDataWithOrigins.getOptions());
if (paramBoolean) {
localBitmojiMirrorImageUploadRequest.setCurrOptionAvatar(((JSONObject)localObject).toString());
}
for (;;)
{
localBitmojiMirrorImageUploadRequest.getClass();
localObject = new BitmojiMirrorImageUploadRequest.BitmojiMirrorImageUploadUserAgent(localBitmojiMirrorImageUploadRequest);
localBitmojiMirrorImageUploadRequest.setUserAgentJson((BitmojiMirrorImageUploadRequest.BitmojiMirrorImageUploadUserAgent)localObject);
((BitmojiMirrorImageUploadRequest.BitmojiMirrorImageUploadUserAgent)localObject).setAppName(paramString1);
((BitmojiMirrorImageUploadRequest.BitmojiMirrorImageUploadUserAgent)localObject).setAppVersion("10.29.98");
((BitmojiMirrorImageUploadRequest.BitmojiMirrorImageUploadUserAgent)localObject).setOsName("android");
((BitmojiMirrorImageUploadRequest.BitmojiMirrorImageUploadUserAgent)localObject).setOsVersion(Build.VERSION.RELEASE);
localBitmojiMirrorImageUploadRequest.setDeviceModel(Build.MANUFACTURER + "-" + Build.MODEL);
localBitmojiMirrorImageUploadRequest.setRequestType(MirrorUploadHelper.a(paramAvatarBuilderActivityMode));
localBitmojiMirrorImageUploadRequest.setMirrorImage(CameraUtils.getBase64String(paramBitmap));
localBitmojiMirrorImageUploadRequest.setRecognitionLog(paramString2);
localBitmojiMirrorImageUploadRequest.setCurrAvatarOrigin(new JSONObject(paramFullCharacterDataWithOrigins.getOrigins()).toString());
localObject = new Callback()
{
public final void failure(RetrofitError paramAnonymous2RetrofitError)
{
Log.e(MirrorUploadHelper.a(), "Failed to save mirror image.");
}
};
MirrorUploadHelper.a(MirrorUploadHelper.this).mirrorImageUploadUniversal(localBitmojiMirrorImageUploadRequest, (Callback)localObject);
return;
localBitmojiMirrorImageUploadRequest.setCurrAvatar(((JSONObject)localObject).toString());
}
}
};
if (this.d.isMirrorGeoIpValidationOverrideEnabled())
{
paramFullCharacterDataWithOrigins.run();
return;
}
} while (!this.c.getBoolean("MirrorHasValidGeoIpSharedPreference", true));
paramFullCharacterDataWithOrigins = new Callback()
{
public final void failure(RetrofitError paramAnonymousRetrofitError)
{
Log.e(MirrorUploadHelper.a(), "Failed to reach mirror valid geo ip.");
}
};
this.b.hasValidMirrorGeoIp(paramFullCharacterDataWithOrigins);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/experiments/MirrorUploadHelper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/