mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-24 21:25:35 +01:00
ktlintformat
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
0a107c455f
commit
17f4a20cbd
@ -164,7 +164,6 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
}
|
||||
|
||||
private fun handleActionFromContact(intent: Intent) {
|
||||
|
||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
val cursor = contentResolver.query(intent.data!!, null, null, null, null)
|
||||
|
||||
|
@ -18,10 +18,10 @@ 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>)
|
||||
suspend fun insertUserGroups(groups: List<UserGroupsEntity>)
|
||||
|
||||
@Query("SELECT displayName FROM user_circles")
|
||||
fun getUserCircles(): List<UserCirclesEntity>
|
||||
@ -34,5 +34,4 @@ interface UserCirclesOrGroupsDao {
|
||||
|
||||
@Query("DELETE FROM user_circles")
|
||||
suspend fun deleteAllUserCircles()
|
||||
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ import androidx.room.PrimaryKey
|
||||
data class UserCirclesEntity(
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "displayName")
|
||||
var displayName: String,
|
||||
var displayName: String
|
||||
)
|
||||
|
@ -24,58 +24,60 @@ class UserGroupsCirclesRepository @Inject constructor(
|
||||
private val currentUserProvider: CurrentUserProviderNew
|
||||
) {
|
||||
val user = currentUserProvider.currentUser.blockingGet()
|
||||
suspend fun initialize(): Boolean = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
val credentials: String = ApiUtils.getCredentials(user.username, user.token)!!
|
||||
|
||||
coroutineScope {
|
||||
launch {
|
||||
userCirclesOrGroupsDao.deleteAllUserGroups()
|
||||
val response = ncApiCoroutines.getUserGroups(
|
||||
credentials,
|
||||
ApiUtils.getUrlForUserGroups(
|
||||
user.baseUrl!!,
|
||||
user.userId!!
|
||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||
suspend fun initialize(): Boolean =
|
||||
withContext(Dispatchers.IO) {
|
||||
try {
|
||||
val credentials: String = ApiUtils.getCredentials(user.username, user.token)!!
|
||||
|
||||
coroutineScope {
|
||||
launch {
|
||||
userCirclesOrGroupsDao.deleteAllUserGroups()
|
||||
val response = ncApiCoroutines.getUserGroups(
|
||||
credentials,
|
||||
ApiUtils.getUrlForUserGroups(
|
||||
user.baseUrl!!,
|
||||
user.userId!!
|
||||
)
|
||||
)
|
||||
)
|
||||
val groups = response.ocs?.data?.groups?: emptyList()
|
||||
Log.d("UserDataRepo","$groups")
|
||||
userCirclesOrGroupsDao.insertUserGroups(
|
||||
groups.map{
|
||||
UserGroupsEntity(it)
|
||||
}
|
||||
)
|
||||
val groups = response.ocs?.data?.groups ?: emptyList()
|
||||
Log.d("UserDataRepo", "$groups")
|
||||
userCirclesOrGroupsDao.insertUserGroups(
|
||||
groups.map {
|
||||
UserGroupsEntity(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
)
|
||||
}
|
||||
return@withContext true
|
||||
} catch (e: Exception) {
|
||||
Log.e("UserDataRepo", "Error initializing user data", e)
|
||||
return@withContext false
|
||||
}
|
||||
|
||||
return@withContext true
|
||||
} catch (e: Exception) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,5 @@ import androidx.room.PrimaryKey
|
||||
@Entity(tableName = "user_groups")
|
||||
data class UserGroupsEntity(
|
||||
@PrimaryKey
|
||||
@ColumnInfo (name="groups") var groups: String,
|
||||
@ColumnInfo(name = "groups") var groups: String
|
||||
)
|
||||
|
@ -51,7 +51,7 @@ import java.util.Locale
|
||||
ConversationEntity::class,
|
||||
ChatMessageEntity::class,
|
||||
ChatBlockEntity::class,
|
||||
UserCirclesEntity:: class,
|
||||
UserCirclesEntity::class,
|
||||
UserGroupsEntity::class
|
||||
],
|
||||
version = 16,
|
||||
|
@ -98,7 +98,7 @@ class MessageUtils(val context: Context) {
|
||||
return processedMessageText
|
||||
}
|
||||
|
||||
@Suppress("NestedBlockDepth", "LongParameterList")
|
||||
@Suppress("NestedBlockDepth", "LongParameterList", "Detekt.LongMethod")
|
||||
private fun processMessageParameters(
|
||||
themingContext: Context,
|
||||
viewThemeUtils: ViewThemeUtils,
|
||||
|
Loading…
Reference in New Issue
Block a user