use of com.fanap.podchat.repository.ChatDataSource in project pod-chat-android-sdk by FanapSoft.
the class ChatCore method init.
/**
* Initialize the Chat
*
* @param context for Async sdk and other usage
*/
public static synchronized Chat init(Context context) {
if (instance == null) {
setupSentry(context);
async = Async.getInstance(context);
async.rawLog(BuildConfig.DEBUG);
async.isLoggable(BuildConfig.DEBUG);
async.setReconnectOnClose(false);
instance = new Chat();
gson = new GsonBuilder().setPrettyPrinting().create();
parser = new JsonParser();
instance.setContext(context);
listenerManager = new ChatListenerManager();
threadCallbacks = new HashMap<>();
leaveThreadCallbacks = new HashMap<>();
mSecurePrefs = new SecurePreferences(context, "", "chat_prefs.xml");
// SecurePreferences.setLoggingEnabled(true);
runDatabase(context);
sendingQList = new HashMap();
uploadingQList = new HashMap();
waitQList = new HashMap<>();
hashTagCallBacks = new HashMap<>();
messageCallbacks = new HashMap<>();
handlerSend = new HashMap<>();
gson = new GsonBuilder().create();
Sentry.setExtra("chat-sdk-version-name", BuildConfig.VERSION_NAME);
Sentry.setExtra("chat-sdk-version-code", String.valueOf(BuildConfig.VERSION_CODE));
Sentry.setExtra("chat-sdk-build-type", BuildConfig.BUILD_TYPE);
Sentry.setExtra("chat-sdk-flavor", BuildConfig.FLAVOR);
dataSource = new ChatDataSource(new MemoryDataSource(), new CacheDataSource(instance.messageDatabaseHelper));
}
return instance;
}
Aggregations