line length 1220 characters

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-26 22:51:59 +02:00
parent f4cfc9cef3
commit f8a8b81ef7
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
7 changed files with 60 additions and 22 deletions

View file

@ -182,7 +182,11 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
for (key in messageParameters.keys) {
val individualHashMap = message.messageParameters[key]
if (individualHashMap != null) {
if (individualHashMap["type"] == "user" || individualHashMap["type"] == "guest" || individualHashMap["type"] == "call") {
if (
individualHashMap["type"] == "user" ||
individualHashMap["type"] == "guest" ||
individualHashMap["type"] == "call"
) {
if (individualHashMap["id"] == message.activeUser!!.userId) {
messageString = DisplayUtils.searchAndReplaceWithMentionSpan(
messageText!!.context,

View file

@ -77,7 +77,16 @@ import java.util.concurrent.TimeUnit
import javax.inject.Inject
import javax.inject.Singleton
@AutoComponent(modules = [BusModule::class, ContextModule::class, DatabaseModule::class, RestModule::class, UserModule::class, ArbitraryStorageModule::class])
@AutoComponent(
modules = [
BusModule::class,
ContextModule::class,
DatabaseModule::class,
RestModule::class,
UserModule::class,
ArbitraryStorageModule::class
]
)
@Singleton
@AutoInjector(NextcloudTalkApplication::class)
class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {

View file

@ -1650,7 +1650,9 @@ class ChatController(args: Bundle) :
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Observer<RoomOverall> {
override fun onSubscribe(d: Disposable) {}
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(roomOverall: RoomOverall) {
val bundle = Bundle()
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)

View file

@ -241,7 +241,10 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
fun hasLinkedAccount(id: String): Boolean {
var hasLinkedAccount = false
val where =
ContactsContract.Data.MIMETYPE + " = ? AND " + ContactsContract.CommonDataKinds.StructuredName.CONTACT_ID + " = ?"
ContactsContract.Data.MIMETYPE +
" = ? AND " +
ContactsContract.CommonDataKinds.StructuredName.CONTACT_ID +
" = ?"
val params = arrayOf(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE, id)
val rawContactUri = ContactsContract.Data.CONTENT_URI
@ -393,7 +396,10 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
private fun getDisplayNameFromDeviceContact(id: String?): String? {
var displayName: String? = null
val whereName =
ContactsContract.Data.MIMETYPE + " = ? AND " + ContactsContract.CommonDataKinds.StructuredName.CONTACT_ID + " = ?"
ContactsContract.Data.MIMETYPE +
" = ? AND " +
ContactsContract.CommonDataKinds.StructuredName.CONTACT_ID +
" = ?"
val whereNameParams = arrayOf(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE, id)
val nameCursor = context.contentResolver.query(
ContactsContract.Data.CONTENT_URI,
@ -405,7 +411,9 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
if (nameCursor != null) {
while (nameCursor.moveToNext()) {
displayName =
nameCursor.getString(nameCursor.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME))
nameCursor.getString(
nameCursor.getColumnIndex(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME)
)
}
nameCursor.close()
}
@ -424,7 +432,11 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
if (phonesNumbersCursor != null) {
while (phonesNumbersCursor.moveToNext()) {
numbers.add(phonesNumbersCursor.getString(phonesNumbersCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)))
numbers.add(
phonesNumbersCursor.getString(
phonesNumbersCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)
)
)
}
phonesNumbersCursor.close()
}

View file

@ -71,8 +71,10 @@ class PackageReplacedReceiver : BroadcastReceiver() {
}
if (!appPreferences.isNotificationChannelUpgradedToV3 && packageInfo.versionCode > 51) {
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V2)
notificationManager.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_CALLS_V2)
notificationManager
.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V2)
notificationManager
.deleteNotificationChannel(NotificationUtils.NOTIFICATION_CHANNEL_CALLS_V2)
appPreferences.setNotificationChannelIsUpgradedToV3(true)
}

View file

@ -55,8 +55,14 @@ object AccountUtils {
internalUserEntity = userEntitiesList[i]
importAccount = getInformationFromAccount(account)
if (importAccount.token != null) {
if (importAccount.baseUrl.startsWith("http://") || importAccount.baseUrl.startsWith("https://")) {
if (internalUserEntity.username == importAccount.username && internalUserEntity.baseUrl == importAccount.baseUrl) {
if (
importAccount.baseUrl.startsWith("http://") ||
importAccount.baseUrl.startsWith("https://")
) {
if (
internalUserEntity.username == importAccount.username &&
internalUserEntity.baseUrl == importAccount.baseUrl
) {
accountFound = true
break
}

View file

@ -85,7 +85,10 @@ object NotificationUtils {
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && notificationManager.getNotificationChannel(channelId) == null) {
if (
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
notificationManager.getNotificationChannel(channelId) == null
) {
val channel = NotificationChannel(
channelId, channelName,
@ -156,9 +159,9 @@ object NotificationUtils {
notification = statusBarNotification.notification
if (notification != null && !notification.extras.isEmpty) {
if (conversationUser.id == notification.extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID) && notificationId == notification.extras.getLong(
BundleKeys.KEY_NOTIFICATION_ID
)
if (
conversationUser.id == notification.extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID) &&
notificationId == notification.extras.getLong(BundleKeys.KEY_NOTIFICATION_ID)
) {
notificationManager.cancel(statusBarNotification.id)
}
@ -184,9 +187,9 @@ object NotificationUtils {
notification = statusBarNotification.notification
if (notification != null && !notification.extras.isEmpty) {
if (conversationUser.id == notification.extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID) && roomTokenOrId == statusBarNotification.notification.extras.getString(
BundleKeys.KEY_ROOM_TOKEN
)
if (
conversationUser.id == notification.extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID) &&
roomTokenOrId == statusBarNotification.notification.extras.getString(BundleKeys.KEY_ROOM_TOKEN)
) {
return statusBarNotification
}
@ -202,7 +205,9 @@ object NotificationUtils {
conversationUser: UserEntity,
roomTokenOrId: String
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && conversationUser.id != -1L &&
if (
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
conversationUser.id != -1L &&
context != null
) {
@ -215,9 +220,7 @@ object NotificationUtils {
if (notification != null && !notification.extras.isEmpty) {
if (conversationUser.id == notification.extras.getLong(BundleKeys.KEY_INTERNAL_USER_ID) &&
roomTokenOrId == statusBarNotification.notification.extras.getString(
BundleKeys.KEY_ROOM_TOKEN
)
roomTokenOrId == statusBarNotification.notification.extras.getString(BundleKeys.KEY_ROOM_TOKEN)
) {
notificationManager.cancel(statusBarNotification.id)
}