chat-sdk-android icon indicating copy to clipboard operation
chat-sdk-android copied to clipboard

Where is saved chat rooms?

Open ahsengrw opened this issue 9 years ago • 13 comments

hey,

i have integrated chatsdk on my app but when i loggedin there is already chatrooms maded by other users appear in the thread list.

Please help how to remove these chat rooms and where is it saved?

thanks, screenshot_1485539707

ahsengrw avatar Jan 27 '17 17:01 ahsengrw

Hey,

To prevent this from happening, you should disable the button that allows users to make a new chat room themselves. You can do this by modifying the ChatSDKThreadFragment.java.

To remove the additional public threads, you can log in to the Firebase dashboard and delete the unwanted threads from the public-threads branch.

Thanks,

Ben

bensmiley avatar Jan 27 '17 18:01 bensmiley

Hey, i have removed public threads from firebase database but chat rooms still appears

ahsengrw avatar Jan 27 '17 18:01 ahsengrw

Hello,

Have you changed which Firebase database you are connecting to with the SDK? You can adjust your firebase root path in Chatcat-Android\sdk\src\main\java\com\braunster\chatsdk\network\BDefines.java

public static final String BRootPath = "testRoot/";

public static String ServerUrl = "https://your-firebase-name.firebaseio.com/" + BRootPath;

public static String FirebaseStoragePath = "gs://your-firebase-name.appspot.com";

kykrueger avatar Jan 27 '17 18:01 kykrueger

@kykrueger yes i have changed serverURL and StoragePath to my firebase serverURL/StoragePath

ahsengrw avatar Jan 27 '17 18:01 ahsengrw

This will be because the app caches the public threads in the database. You should add a line of code to delete the public threads when the app first starts up - before it starts adding the Firebase listeners.

DaoCore.fetchEntitiesWithProperty(BThread.class, BThreadDao.Properties.Type, BThread.Type.Public); Then loop over the results and delete them:

DaoCore.deleteEntity(model);

This will cause the app to re-download the public threads each time it loads up.

Thanks,

Ben

bensmiley avatar Jan 27 '17 18:01 bensmiley

Thannk you, this issue is solved but i have got one new error when creating public threads, app crashed, and its crash on when i login. also in the firebase database public-threads shows null

ahsengrw avatar Jan 27 '17 18:01 ahsengrw

Could you share the stack trace that you see in the log when the app crashes?

kykrueger avatar Jan 27 '17 20:01 kykrueger

                                                                 java.lang.IllegalArgumentException: the bind value at index 1 is null
                                                                     at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:164)
                                                                     at android.database.sqlite.SQLiteProgram.bindAllArgsAsStrings(SQLiteProgram.java:200)
                                                                     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
                                                                     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316)
                                                                     at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1255)
                                                                     at de.greenrobot.dao.query.Query.list(Unknown)
                                                                     at de.greenrobot.dao.query.QueryBuilder.list(Unknown)
                                                                     at com.braunster.chatsdk.dao.core.DaoCore.fetchEntityWithProperty(Unknown)
                                                                     at com.braunster.chatsdk.dao.core.DaoCore.fetchEntityWithEntityID(Unknown)
                                                                     at com.braunster.chatsdk.dao.core.DaoCore.fetchOrCreateEntityWithEntityID(Unknown)
                                                                     at com.braunster.androidchatsdk.firebaseplugin.firebase.wrappers.BThreadWrapper.<init>(Unknown)
                                                                     at com.braunster.androidchatsdk.firebaseplugin.firebase.FirebaseEventsManager$5$1.run(Unknown)
                                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                     at java.lang.Thread.run(Thread.java:818)

ahsengrw avatar Jan 27 '17 20:01 ahsengrw

It looks like a query for a Thread with ID == null is being made to the database, and that the query is being made with the constructor for the ThreadWrapper class. Normally I would never expect to see the BThreadWrapper class to be initialized with an empty string; have you added a new call to the constructor anywhere in the code?

Otherwise, this could be related to how you deleted the public threads on firebase. Could you share a screencap of what the Firebase Database now looks like for you from your firebase console? If there are some fields left in the publicThreads that are null, it is possible that we are discovering them as threads with that as the id. That would explain the constructor being passed null when it expects the EntityId of the thread.

Lastly, you said this problem occurred when creating a new thread, and that it is occurring now every time you log in. Could you try reproducing this by running the app on another emulator, and repeating the process with another account?

-- Kyle

kykrueger avatar Jan 28 '17 13:01 kykrueger

hey, i have not create any constructor and i have tested in different emulators with different accounts but crashed in every device,

here is the screenshot of firebase database screenshot_1485539707

ahsengrw avatar Jan 28 '17 17:01 ahsengrw

@kykrueger @bensmiley is there any way to create public thread?

ahsengrw avatar Jan 31 '17 10:01 ahsengrw

The problem isn't something that is found in the main branch. So I expect it has to do with customizations that have been made. Where exactly did you add the code to remove the cached public threads that Ben had suggested?

kykrueger avatar Jan 31 '17 10:01 kykrueger

finallly, i solved the issue by re-integrating chat sdk now it works fine.. thanks everyone for helping me on this issue.

ahsengrw avatar Jan 31 '17 12:01 ahsengrw