Closed workspace closed 1 year ago
Hello @workspace, could you share how you're initializing our SDK? I believe you didn't add the state plugin.
Hello @workspace, could you share how you're initializing our SDK? I believe you didn't add the state plugin.
class StreamChatInitializer : Initializer<Unit> {
override fun create(context: Context) {
// Set up the OfflinePlugin for offline storage
val offlinePluginFactory = StreamOfflinePluginFactory(
appContext = context
)
val statePluginFactory = StreamStatePluginFactory(
config = StatePluginConfig(
backgroundSyncEnabled = true,
userPresence = true
),
appContext = context
)
// Set up the client for API calls with the plugin for offline storage
ChatClient.Builder("stream key", context)
.logLevel(
if (BuildConfig.DEBUG) {
ChatLogLevel.DEBUG
} else {
ChatLogLevel.NOTHING
}
)
.withPlugin(offlinePluginFactory, statePluginFactory )
.build()
}
override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
}
<manifest>
<application>
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
...
<meta-data
android:name="com.holix.android.startup.StreamChatInitializer"
android:value="androidx.startup" />
</provider>
</application>
</manifest>
This capture is a diff of a pull request that tested applying v6. If I open it by tapping the app icon, it works fine. However, there is a problem when opening the app through push notifications.
Hi @workspace How are you connecting the user? Are you waiting for the result of the call?
If you are using connectUser(user, token).enqueue()
, are you passing a callback for the result? Or are you ignoring the result and moving directly to the chat?
ignoring the result and moving directly to the chat.Then, I am watching initializationState before using ChatClient in the screen.
Thanks for your reply. It helps me to understand the a little bit better the problem and find a bug we introduced with the new approach. It will be fixed soon
Thanks for the quick fix, I'm really happy to have contributed to stabilizing the STREAM V6 SDK. I can't wait to get the STREAM V6 SDK into my product. 😃
@JcMinarro I've verified that this snapshot build resolved the issue, I think we can close this issue.
@workspace @JcMinarro Thanks bro this helped me
Describe the bug I am initializing ChatClient using jetpack app startup library. After completely shutting down the app, clicking the push notification to run the app, and then calling the state-related method(ex. watchChannelAsState), the following exception appears.
It could be a problem with our app's implementation, but we had no issues with v5.
ChatClient initialization and connection was completed before calling watchChannelAsState
SDK version
To Reproduce (With our implementation)
I'll try to reproduce with stream-chat-android sample
Expected behavior in v5, there was no problem.
Device: