blob: c8b37cdcc833b2311f502d5ed5ec0ecd93f2dabe (
plain)
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
|
package cgeo.geocaching.connector.oc;
import cgeo.geocaching.R;
import cgeo.geocaching.connector.oc.OkapiError.OkapiErrors;
public class UserInfo {
public enum UserInfoStatus {
NOT_RETRIEVED(R.string.init_login_popup_working),
SUCCESSFUL(R.string.init_login_popup_ok),
FAILED(R.string.init_login_popup_failed),
NOT_SUPPORTED(R.string.init_login_popup_not_authorized),
INVALID_TIMESTAMP(R.string.init_login_popup_invalid_timestamp),
INVALID_TOKEN(R.string.init_login_popup_invalid_token);
public final int resId;
UserInfoStatus(int resId) {
this.resId = resId;
}
public static UserInfoStatus getFromOkapiError(OkapiErrors result) {
switch (result) {
case NO_ERROR:
return SUCCESSFUL;
case INVALID_TIMESTAMP:
return INVALID_TIMESTAMP;
case INVALID_TOKEN:
return INVALID_TOKEN;
default:
return FAILED;
}
}
}
private final String name;
private final int finds;
private final UserInfoStatus status;
UserInfo(String name, int finds, UserInfoStatus status) {
this.name = name;
this.finds = finds;
this.status = status;
}
public String getName() {
return name;
}
public int getFinds() {
return finds;
}
public UserInfoStatus getStatus() {
return status;
}
}
|