MCPcopy Create free account
hub / github.com/InsightIM/Tok-Android / State

Class State

app/src/main/java/com/client/tok/tox/State.java:8–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import com.client.tok.transfer.TransferManager;
7
8public class State {
9 /**
10 * chat page is active、pause
11 */
12 private static boolean chatPageActive = false;
13 /**
14 * current active chat friend key
15 */
16 private static String activeKey;
17
18 public static TransferManager transfers = new TransferManager();
19
20 private static InfoRepository infoRepository;
21
22 private static UserRepository userRepository = new UserRepository();
23
24 public static void setDb(InfoRepository db) {
25 infoRepository = db;
26 }
27
28 public static InfoRepository infoRepo() {
29 return infoRepository;
30 }
31
32 public static UserRepository userRepo() {
33 return userRepository;
34 }
35
36 public static TransferManager transferManager() {
37 return transfers;
38 }
39
40 public static boolean isChatActive(String key) {
41 return chatPageActive && key != null && key.equals(activeKey);
42 }
43
44 public static void setChatPageActive(boolean active) {
45 chatPageActive = active;
46 }
47
48 public static void setChatKey(String key) {
49 activeKey = key;
50 }
51
52 public static boolean isLoggedIn() {
53 return userRepository.loggedIn();
54 }
55
56 public static void login(String name) {
57 userRepository.login(name);
58 }
59
60 public static void logout() {
61 NotifyManager.getInstance().cleanAllNotify();
62 infoRepository.synchroniseWithTox(ToxManager.getManager().toxBase.getFriendList());
63 ToxManager.getManager().saveAndClose();
64 userRepository.logout();
65 infoRepository.destroy();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected