mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-24 14:09:44 +01:00
apply theming to user mentions
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
2b29685d7b
commit
0a107c455f
@ -48,6 +48,7 @@ import io.reactivex.SingleObserver
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -60,6 +61,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
|
||||
@Inject
|
||||
lateinit var userManager: UserManager
|
||||
private var job: Job? = null
|
||||
|
||||
@Inject
|
||||
lateinit var userGroupsOrCirclesRepository: UserGroupsCirclesRepository
|
||||
@ -92,6 +94,11 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
|
||||
handleIntent(intent)
|
||||
|
||||
job = lifecycleScope.launch {
|
||||
val initialized = userGroupsOrCirclesRepository.initialize()
|
||||
Log.d("MainActivity", "$initialized")
|
||||
}
|
||||
|
||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||
}
|
||||
|
||||
@ -144,6 +151,11 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
job?.cancel()
|
||||
}
|
||||
|
||||
private fun openConversationList() {
|
||||
val intent = Intent(this, ConversationsListActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
@ -152,10 +164,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
}
|
||||
|
||||
private fun handleActionFromContact(intent: Intent) {
|
||||
lifecycleScope.launch {
|
||||
val initialized = userGroupsOrCirclesRepository.initialize()
|
||||
Log.d("MainActivity", "$initialized")
|
||||
}
|
||||
|
||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
val cursor = contentResolver.query(intent.data!!, null, null, null, null)
|
||||
|
||||
|
@ -193,8 +193,8 @@ class RepositoryModule {
|
||||
fun provideUserGroupsCirclesRepository(
|
||||
userCirclesOrGroupsDao: UserCirclesOrGroupsDao,
|
||||
ncApiCoroutines: NcApiCoroutines,
|
||||
userProvider: CurrentUserProviderNew
|
||||
currentUserProvider: CurrentUserProviderNew
|
||||
): UserGroupsCirclesRepository {
|
||||
return UserGroupsCirclesRepository(userCirclesOrGroupsDao, ncApiCoroutines, userProvider)
|
||||
return UserGroupsCirclesRepository(userCirclesOrGroupsDao, ncApiCoroutines, currentUserProvider)
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import com.nextcloud.talk.data.database.model.UserGroupsEntity
|
||||
interface UserCirclesOrGroupsDao {
|
||||
|
||||
@Query("SELECT groups FROM user_groups")
|
||||
fun getUserGroups(): List<UserGroupsEntity>
|
||||
fun getUserGroups():List<UserGroupsEntity>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertUserGroups(groups:List<UserGroupsEntity>)
|
||||
@ -29,4 +29,10 @@ interface UserCirclesOrGroupsDao {
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertUserCircles(circles: List<UserCirclesEntity>)
|
||||
|
||||
@Query("DELETE FROM user_groups")
|
||||
suspend fun deleteAllUserGroups()
|
||||
|
||||
@Query("DELETE FROM user_circles")
|
||||
suspend fun deleteAllUserCircles()
|
||||
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ class UserGroupsCirclesRepository @Inject constructor(
|
||||
|
||||
coroutineScope {
|
||||
launch {
|
||||
userCirclesOrGroupsDao.deleteAllUserGroups()
|
||||
val response = ncApiCoroutines.getUserGroups(
|
||||
credentials,
|
||||
ApiUtils.getUrlForUserGroups(
|
||||
@ -38,7 +39,7 @@ class UserGroupsCirclesRepository @Inject constructor(
|
||||
)
|
||||
)
|
||||
val groups = response.ocs?.data?.groups?: emptyList()
|
||||
|
||||
Log.d("UserDataRepo","$groups")
|
||||
userCirclesOrGroupsDao.insertUserGroups(
|
||||
groups.map{
|
||||
UserGroupsEntity(it)
|
||||
@ -47,12 +48,13 @@ class UserGroupsCirclesRepository @Inject constructor(
|
||||
}
|
||||
|
||||
launch {
|
||||
|
||||
userCirclesOrGroupsDao.deleteAllUserCircles()
|
||||
val response = ncApiCoroutines.getUserCircles(
|
||||
credentials,
|
||||
ApiUtils.getUrlForUserCircles(user.baseUrl!!)
|
||||
)
|
||||
val circles = response.ocs?.data?.map { it.displayName!! }?: emptyList()
|
||||
Log.d("UserDataRepo","$circles")
|
||||
userCirclesOrGroupsDao.insertUserCircles(
|
||||
circles.map{
|
||||
UserCirclesEntity(it)
|
||||
@ -66,13 +68,14 @@ class UserGroupsCirclesRepository @Inject constructor(
|
||||
Log.e("UserDataRepo", "Error initializing user data", e)
|
||||
return@withContext false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getUserGroups(): List<UserGroupsEntity> {
|
||||
fun getUserGroups(): List<UserGroupsEntity> {
|
||||
return userCirclesOrGroupsDao.getUserGroups()
|
||||
}
|
||||
|
||||
fun getUserCircles(): List<UserCirclesEntity> {
|
||||
fun getUserCircles(): List<UserCirclesEntity>{
|
||||
return userCirclesOrGroupsDao.getUserCircles()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user