TOUManager.java
3.04 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
package com.bitstrips.imoji.manager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import android.util.Log;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.injection.ForApplication;
import com.bitstrips.imoji.models.UserData;
import com.bitstrips.imoji.util.PreferenceUtils;
import com.squareup.okhttp.Cache;
import java.util.Iterator;
import javax.inject.Inject;
import javax.inject.Singleton;
import retrofit.Callback;
import retrofit.RetrofitError;
@Singleton
public class TOUManager
{
private BroadcastReceiver a;
private boolean b = false;
private final BitmojiApi c;
private final Context d;
private final PreferenceUtils e;
private final Cache f;
@Inject
public TOUManager(@ForApplication Context paramContext, BitmojiApi paramBitmojiApi, PreferenceUtils paramPreferenceUtils, Cache paramCache)
{
this.d = paramContext;
this.c = paramBitmojiApi;
this.e = paramPreferenceUtils;
this.f = paramCache;
}
protected void checkTOUUpdate()
{
if (TextUtils.isEmpty(this.e.getString(2131231175, null))) {
Log.i("TOUManager", "Current avatar id is null, not checking terms.");
}
while (this.b) {
return;
}
this.b = true;
this.c.getUserData(new Callback()
{
public final void failure(RetrofitError paramAnonymousRetrofitError)
{
TOUManager.a(TOUManager.this);
Log.i("TOUManager", "Failed get for terms of service", paramAnonymousRetrofitError);
}
});
}
public void checkTermsChanged(Context paramContext)
{
LocalBroadcastManager.getInstance(paramContext).sendBroadcast(new Intent("com.bitstrips.imoji.TOU_CHANGED_CHECK"));
}
public void initializeReceiver()
{
if (this.a == null)
{
IntentFilter localIntentFilter = new IntentFilter();
localIntentFilter.addAction("com.bitstrips.imoji.TOU_CHANGED_CHECK");
this.a = new BroadcastReceiver()
{
public final void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent)
{
TOUManager.this.checkTOUUpdate();
}
};
LocalBroadcastManager.getInstance(this.d).registerReceiver(this.a, localIntentFilter);
}
}
public void invalidateCache()
{
try
{
if (this.f == null)
{
Log.e("TOUManager", "Cache was null");
return;
}
Iterator localIterator = this.f.urls();
while (localIterator.hasNext()) {
if (((String)localIterator.next()).endsWith("user/data"))
{
localIterator.remove();
return;
}
}
}
catch (Exception localException)
{
Log.e("TOUManager", "Failed to obtain urls from cache", localException);
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/manager/TOUManager.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/