-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Expand file tree
/
Copy pathAccountInstance.java
More file actions
108 lines (83 loc) · 3.26 KB
/
Copy pathAccountInstance.java
File metadata and controls
108 lines (83 loc) · 3.26 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
package org.telegram.messenger;
import android.content.SharedPreferences;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.ui.Components.Paint.PersistColorPalette;
public class AccountInstance {
private int currentAccount;
private static volatile AccountInstance[] Instance = new AccountInstance[UserConfig.MAX_ACCOUNT_COUNT];
public static AccountInstance getInstance(int num) {
AccountInstance localInstance = Instance[num];
if (localInstance == null) {
synchronized (AccountInstance.class) {
localInstance = Instance[num];
if (localInstance == null) {
Instance[num] = localInstance = new AccountInstance(num);
}
}
}
return localInstance;
}
public AccountInstance(int instance) {
currentAccount = instance;
}
public MessagesController getMessagesController() {
return MessagesController.getInstance(currentAccount);
}
public GiftAuctionController getGiftAuctionsController() {
return GiftAuctionController.getInstance(currentAccount);
}
public MessagesStorage getMessagesStorage() {
return MessagesStorage.getInstance(currentAccount);
}
public ContactsController getContactsController() {
return ContactsController.getInstance(currentAccount);
}
public PersistColorPalette getColorPalette() {
return PersistColorPalette.getInstance(currentAccount);
}
public MediaDataController getMediaDataController() {
return MediaDataController.getInstance(currentAccount);
}
public ConnectionsManager getConnectionsManager() {
return ConnectionsManager.getInstance(currentAccount);
}
public NotificationsController getNotificationsController() {
return NotificationsController.getInstance(currentAccount);
}
public NotificationCenter getNotificationCenter() {
return NotificationCenter.getInstance(currentAccount);
}
public LocationController getLocationController() {
return LocationController.getInstance(currentAccount);
}
public UserConfig getUserConfig() {
return UserConfig.getInstance(currentAccount);
}
public DownloadController getDownloadController() {
return DownloadController.getInstance(currentAccount);
}
public SendMessagesHelper getSendMessagesHelper() {
return SendMessagesHelper.getInstance(currentAccount);
}
public SecretChatHelper getSecretChatHelper() {
return SecretChatHelper.getInstance(currentAccount);
}
public StatsController getStatsController() {
return StatsController.getInstance(currentAccount);
}
public FileLoader getFileLoader() {
return FileLoader.getInstance(currentAccount);
}
public FileRefController getFileRefController() {
return FileRefController.getInstance(currentAccount);
}
public SharedPreferences getNotificationsSettings() {
return MessagesController.getNotificationsSettings(currentAccount);
}
public MemberRequestsController getMemberRequestsController() {
return MemberRequestsController.getInstance(currentAccount);
}
public int getCurrentAccount() {
return currentAccount;
}
}