File tree Expand file tree Collapse file tree 2 files changed +29
-37
lines changed
chat/src/main/kotlin/com/walletconnect/chat/client
push/src/main/kotlin/com/walletconnect/push/client Expand file tree Collapse file tree 2 files changed +29
-37
lines changed Original file line number Diff line number Diff line change @@ -26,25 +26,21 @@ internal class ChatProtocol(private val koinApp: KoinApplication = wcKoinApp) :
2626
2727 @Throws(IllegalStateException ::class )
2828 override fun initialize (init : Chat .Params .Init , onError : (Chat .Model .Error ) -> Unit ) {
29- if (! ::chatEngine.isInitialized) {
30- try {
31- koinApp.run {
32- modules(
33- jsonRpcModule(),
34- storageModule(koinApp.koin.get<DatabaseConfig >().CHAT_SDK_DB_NAME ),
35- syncInChatModule(),
36- engineModule(),
37- commonModule()
38- )
39- }
40-
41- chatEngine = koinApp.koin.get()
42- chatEngine.setup()
43- } catch (e: Exception ) {
44- onError(Chat .Model .Error (e))
29+ try {
30+ koinApp.run {
31+ modules(
32+ jsonRpcModule(),
33+ storageModule(koinApp.koin.get<DatabaseConfig >().CHAT_SDK_DB_NAME ),
34+ syncInChatModule(),
35+ engineModule(),
36+ commonModule()
37+ )
4538 }
46- } else {
47- onError(Chat .Model .Error (IllegalStateException (" ChatClient already initialized" )))
39+
40+ chatEngine = koinApp.koin.get()
41+ chatEngine.setup()
42+ } catch (e: Exception ) {
43+ onError(Chat .Model .Error (e))
4844 }
4945 }
5046
Original file line number Diff line number Diff line change @@ -32,25 +32,21 @@ class PushWalletProtocol(private val koinApp: KoinApplication = wcKoinApp) : Pus
3232 }
3333
3434 override fun initialize (init : Push .Params .Init , onError : (Push .Model .Error ) -> Unit ) {
35- if (::pushWalletEngine.isInitialized) {
36- try {
37- koinApp.modules(
38- pushJsonRpcModule(),
39- pushStorageModule(koinApp.koin.get<DatabaseConfig >().PUSH_WALLET_SDK_DB_NAME ),
40- syncInPushModule(),
41- walletEngineModule(),
42- messageModule(),
43- commonModule(),
44- pushEngineUseCaseModules()
45- )
46-
47- pushWalletEngine = koinApp.koin.get()
48- runBlocking(scope.coroutineContext) { pushWalletEngine.setup() }
49- } catch (e: Exception ) {
50- onError(Push .Model .Error (e))
51- }
52- } else {
53- onError(Push .Model .Error (IllegalStateException (" PushWalletClient already initialized" )))
35+ try {
36+ koinApp.modules(
37+ pushJsonRpcModule(),
38+ pushStorageModule(koinApp.koin.get<DatabaseConfig >().PUSH_WALLET_SDK_DB_NAME ),
39+ syncInPushModule(),
40+ walletEngineModule(),
41+ messageModule(),
42+ commonModule(),
43+ pushEngineUseCaseModules()
44+ )
45+
46+ pushWalletEngine = koinApp.koin.get()
47+ runBlocking(scope.coroutineContext) { pushWalletEngine.setup() }
48+ } catch (e: Exception ) {
49+ onError(Push .Model .Error (e))
5450 }
5551 }
5652
You can’t perform that action at this time.
0 commit comments