UserLogoutController.java
4.59 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
package com.bitstrips.imoji.monouser.controllers;
import android.content.Context;
import android.support.annotation.VisibleForTesting;
import com.bitstrips.imoji.abv3.camera.AvatarBuilderImageHelper;
import com.bitstrips.imoji.analytics.Action;
import com.bitstrips.imoji.analytics.BitstripsAnalyticsService;
import com.bitstrips.imoji.analytics.Category;
import com.bitstrips.imoji.api.BitmojiApi;
import com.bitstrips.imoji.experiments.Experiments;
import com.bitstrips.imoji.injection.ForApplication;
import com.bitstrips.imoji.manager.AppIndexingManager;
import com.bitstrips.imoji.manager.StickerPacksManager;
import com.bitstrips.imoji.monouser.oauth2.OAuth2Manager;
import com.bitstrips.imoji.persistence.MediaCache;
import com.bitstrips.imoji.util.PreferenceUtils;
import com.squareup.okhttp.Cache;
import java.io.File;
import javax.inject.Inject;
import javax.inject.Singleton;
import retrofit.Callback;
import retrofit.RetrofitError;
@Singleton
public class UserLogoutController
{
private final BitstripsAnalyticsService a;
private final StickerPacksManager b;
private final PreferenceUtils c;
private final BitmojiApi d;
private final AppIndexingManager e;
private final Cache f;
private final MediaCache g;
private final Context h;
private final OAuth2Manager i;
private final Experiments j;
@Inject
public UserLogoutController(BitstripsAnalyticsService paramBitstripsAnalyticsService, StickerPacksManager paramStickerPacksManager, PreferenceUtils paramPreferenceUtils, BitmojiApi paramBitmojiApi, AppIndexingManager paramAppIndexingManager, Cache paramCache, MediaCache paramMediaCache, @ForApplication Context paramContext, OAuth2Manager paramOAuth2Manager, Experiments paramExperiments)
{
this.a = paramBitstripsAnalyticsService;
this.b = paramStickerPacksManager;
this.c = paramPreferenceUtils;
this.d = paramBitmojiApi;
this.e = paramAppIndexingManager;
this.f = paramCache;
this.g = paramMediaCache;
this.h = paramContext;
this.i = paramOAuth2Manager;
this.j = paramExperiments;
}
@VisibleForTesting
protected void clearAvatarBuilderData()
{
AvatarBuilderImageHelper.deleteImage(this.h, "avatar_builder_bitmoji_user_image");
}
@VisibleForTesting
protected void clearCachedData()
{
Object localObject = this.h.getCacheDir();
if ((localObject != null) && (((File)localObject).exists()))
{
localObject = ((File)localObject).list();
int m = localObject.length;
int k = 0;
while (k < m)
{
String str = localObject[k];
if ((str != null) && (!str.equals("lib")) && (!str.contains(".dex"))) {
deleteDir(str);
}
k += 1;
}
}
try
{
clearSharedPrefFile();
return;
}
catch (Exception localException) {}
}
@VisibleForTesting
protected void clearHttpCache()
{
try
{
if (this.f != null) {
this.f.evictAll();
}
return;
}
catch (Exception localException) {}
}
@VisibleForTesting
protected void clearSharedPrefFile()
throws Exception
{
new File(this.h.getCacheDir().getParent() + "/shared_prefs/" + this.h.getString(2131231305) + ".xml").delete();
}
@VisibleForTesting
protected boolean deleteDir(File paramFile)
{
int k;
if ((paramFile != null) && (paramFile.isDirectory()))
{
String[] arrayOfString = paramFile.list();
int m = arrayOfString.length;
k = 0;
if (k < m) {
if (deleteDir(new File(paramFile, arrayOfString[k]))) {}
}
}
while ((paramFile == null) || (!paramFile.delete()))
{
return false;
k += 1;
break;
}
return true;
}
@VisibleForTesting
protected boolean deleteDir(String paramString)
{
return deleteDir(new File(this.h.getCacheDir(), paramString));
}
@VisibleForTesting
protected void invalidateServerSession()
{
if (this.i.isUserLoggedIn())
{
this.i.revokeToken();
return;
}
this.d.logout("", new Callback()
{
public final void failure(RetrofitError paramAnonymousRetrofitError) {}
});
}
public void logout()
{
this.a.sendEvent(Category.AUTH, Action.LOGOUT);
this.a.resetSession();
this.g.flush();
this.b.clear();
this.e.clearIndex();
invalidateServerSession();
clearHttpCache();
clearCachedData();
clearAvatarBuilderData();
this.c.reset();
this.j.reset();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/monouser/controllers/UserLogoutController.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/