Merge pull request #1864 from nextcloud/bugfix/noid/detektImprovements

Detekt improvements
This commit is contained in:
Tim Krueger 2022-03-14 14:43:10 +01:00 committed by GitHub
commit 37b950d03d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 185 additions and 80 deletions

View File

@ -81,7 +81,9 @@ import javax.inject.Inject
@SuppressLint("LongLogTag")
@AutoInjector(NextcloudTalkApplication::class)
class MagicFirebaseMessagingService : FirebaseMessagingService() {
private val TAG = "MagicFirebaseMessagingService"
companion object {
const val TAG = "MagicFirebaseMessagingService"
}
@JvmField
@Inject
@ -147,6 +149,7 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
}
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun decryptMessage(subject: String, signature: String) {
try {
val base64DecodedSubject = Base64.decode(subject, Base64.DEFAULT)
@ -283,6 +286,7 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
.subscribeOn(Schedulers.io())
.subscribe(object : Observer<ParticipantsOverall> {
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(participantsOverall: ParticipantsOverall) {

View File

@ -52,9 +52,11 @@ class ClosedInterfaceImpl : ClosedInterface, ProviderInstaller.ProviderInstallLi
}
override fun onProviderInstalled() {
// unused atm
}
override fun onProviderInstallFailed(p0: Int, p1: Intent?) {
// unused atm
}
private fun isGPlayServicesAvailable(): Boolean {

View File

@ -87,6 +87,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
private var router: Router? = null
@Suppress("Detekt.TooGenericExceptionCaught")
override fun onCreate(savedInstanceState: Bundle?) {
Log.d(TAG, "onCreate: Activity: " + System.identityHashCode(this).toString())

View File

@ -53,6 +53,7 @@ import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.ui.bottom.sheet.ProfileBottomSheet
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.UriUtils
import com.nextcloud.talk.utils.preferences.AppPreferences
import com.stfalcon.chatkit.messages.MessageHolders
import java.net.URLEncoder
@ -218,7 +219,7 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
binding.webview.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
return if (url != null && (url.startsWith("http://") || url.startsWith("https://"))
return if (url != null && UriUtils.hasHttpProtocollPrefixed(url)
) {
view?.context?.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
true

View File

@ -47,6 +47,7 @@ import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.models.json.chat.ReadStatus
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.UriUtils
import com.stfalcon.chatkit.messages.MessageHolders
import java.net.URLEncoder
import javax.inject.Inject
@ -131,7 +132,7 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
binding.webview.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
return if (url != null && (url.startsWith("http://") || url.startsWith("https://"))
return if (url != null && UriUtils.hasHttpProtocollPrefixed(url)
) {
view?.context?.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
true

View File

@ -48,6 +48,7 @@ import com.nextcloud.talk.models.json.generic.Status
import com.nextcloud.talk.models.json.userprofile.UserProfileOverall
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.ClosedInterfaceImpl
import com.nextcloud.talk.utils.UriUtils
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_BASE_URL
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_ACCOUNT_IMPORT
@ -112,11 +113,10 @@ class AccountVerificationController(args: Bundle? = null) :
actionBar?.hide()
if (isAccountImport &&
!baseUrl!!.startsWith("http://") &&
!baseUrl!!.startsWith("https://") ||
!TextUtils.isEmpty(originalProtocol!!) &&
!baseUrl!!.startsWith(originalProtocol!!)
if (
isAccountImport &&
!UriUtils.hasHttpProtocollPrefixed(baseUrl!!) ||
isSameProtocol(baseUrl!!, originalProtocol!!)
) {
determineBaseUrlProtocol(true)
} else {
@ -124,6 +124,10 @@ class AccountVerificationController(args: Bundle? = null) :
}
}
private fun isSameProtocol(baseUrl: String, originalProtocol: String): Boolean {
return !TextUtils.isEmpty(originalProtocol) && !baseUrl.startsWith(originalProtocol)
}
private fun checkEverything() {
val credentials = ApiUtils.getCredentials(username, token)
cookieManager.cookieStore.removeAll()
@ -176,7 +180,9 @@ class AccountVerificationController(args: Bundle? = null) :
}
}
override fun onComplete() {}
override fun onComplete() {
// unused atm
}
})
}
@ -231,7 +237,9 @@ class AccountVerificationController(args: Bundle? = null) :
abortVerification()
}
override fun onComplete() {}
override fun onComplete() {
// unused atm
}
})
}
@ -275,7 +283,9 @@ class AccountVerificationController(args: Bundle? = null) :
abortVerification()
}
override fun onComplete() {}
override fun onComplete() {
// unused atm
}
})
}
@ -328,7 +338,9 @@ class AccountVerificationController(args: Bundle? = null) :
abortVerification()
}
override fun onComplete() {}
override fun onComplete() {
// unused atm
}
})
}
@ -457,12 +469,16 @@ class AccountVerificationController(args: Bundle? = null) :
if (!isAccountImport) {
if (internalAccountId != -1L) {
userUtils.deleteUserWithId(internalAccountId).subscribe(object : CompletableObserver {
override fun onSubscribe(d: Disposable) {}
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onComplete() {
activity?.runOnUiThread { Handler().postDelayed({ router.popToRoot() }, 7500) }
}
override fun onError(e: Throwable) {}
override fun onError(e: Throwable) {
// unused atm
}
})
} else {
activity?.runOnUiThread { Handler().postDelayed({ router.popToRoot() }, 7500) }

View File

@ -433,7 +433,9 @@ class ChatController(args: Bundle) :
}
}
override fun onFailureImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {}
override fun onFailureImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
// unused atm
}
},
UiThreadImmediateExecutorService.getInstance()
)
@ -630,6 +632,7 @@ class ChatController(args: Bundle) :
binding.messageInputView.inputEditText?.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
// unused atm
}
@Suppress("Detekt.TooGenericExceptionCaught")
@ -1602,12 +1605,7 @@ class ChatController(args: Bundle) :
activity?.findViewById<View>(R.id.toolbar)?.setOnClickListener(null)
}
if (conversationUser != null &&
activity != null &&
!activity?.isChangingConfigurations!! &&
!ApplicationWideCurrentRoomHolder.getInstance().isInCall &&
!ApplicationWideCurrentRoomHolder.getInstance().isDialing
) {
if (conversationUser != null && isActivityNotChangingConfigurations() && isNotInCall()) {
ApplicationWideCurrentRoomHolder.getInstance().clear()
if (inConversation && validSessionId()) {
leaveRoom()
@ -1619,6 +1617,15 @@ class ChatController(args: Bundle) :
}
}
private fun isActivityNotChangingConfigurations(): Boolean {
return activity != null && !activity?.isChangingConfigurations!!
}
private fun isNotInCall(): Boolean {
return !ApplicationWideCurrentRoomHolder.getInstance().isInCall &&
!ApplicationWideCurrentRoomHolder.getInstance().isDialing
}
override val title: String
get() =
if (currentConversation?.displayName != null) {
@ -2115,11 +2122,9 @@ class ChatController(args: Bundle) :
for (i in chatMessageList.indices) {
if (chatMessageList.size > i + 1) {
if (TextUtils.isEmpty(chatMessageList[i].systemMessage) &&
TextUtils.isEmpty(chatMessageList[i + 1].systemMessage) &&
if (isSameDayNonSystemMessages(chatMessageList[i], chatMessageList[i + 1]) &&
chatMessageList[i + 1].actorId == chatMessageList[i].actorId &&
countGroupedMessages < 4 &&
DateFormatter.isSameDay(chatMessageList[i].createdAt, chatMessageList[i + 1].createdAt)
countGroupedMessages < 4
) {
chatMessageList[i].isGrouped = true
countGroupedMessages++
@ -2251,6 +2256,12 @@ class ChatController(args: Bundle) :
}
}
private fun isSameDayNonSystemMessages(messageLeft: ChatMessage, messageRight: ChatMessage): Boolean {
return TextUtils.isEmpty(messageLeft.systemMessage) &&
TextUtils.isEmpty(messageRight.systemMessage) &&
DateFormatter.isSameDay(messageLeft.createdAt, messageRight.createdAt)
}
override fun onLoadMore(page: Int, totalItemsCount: Int) {
if (!historyRead && inConversation) {
pullChatMessages(0)

View File

@ -213,6 +213,7 @@ class LocationPickerController(args: Bundle) :
return true
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun initMap() {
binding.map.setTileSource(TileSourceFactory.MAPNIK)
binding.map.onResume()

View File

@ -48,6 +48,7 @@ import com.nextcloud.talk.utils.AccountUtils.findAccounts
import com.nextcloud.talk.utils.AccountUtils.getAppNameBasedOnPackage
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.UriUtils
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_ACCOUNT_IMPORT
import com.nextcloud.talk.utils.database.user.UserUtils
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder
@ -197,7 +198,7 @@ class ServerSelectionController : NewBaseController(R.layout.controller_server_s
url = url.substring(0, url.length - 1)
}
val queryUrl = url + ApiUtils.getUrlPostfixForStatus()
if (url.startsWith("http://") || url.startsWith("https://")) {
if (UriUtils.hasHttpProtocollPrefixed(url)) {
checkServer(queryUrl, false)
} else {
checkServer("https://$queryUrl", true)
@ -212,9 +213,7 @@ class ServerSelectionController : NewBaseController(R.layout.controller_server_s
val productName = resources!!.getString(R.string.nc_server_product_name)
val versionString: String = status.getVersion().substring(0, status.getVersion().indexOf("."))
val version: Int = versionString.toInt()
if (status.isInstalled && !status.isMaintenance &&
!status.isNeedsUpgrade && version >= 13
) {
if (isServerStatusQueryable(status) && version >= 13) {
router.pushController(
RouterTransaction.with(
WebViewLoginController(
@ -284,6 +283,10 @@ class ServerSelectionController : NewBaseController(R.layout.controller_server_s
}
}
private fun isServerStatusQueryable(status: Status): Boolean {
return status.isInstalled && !status.isMaintenance && !status.isNeedsUpgrade
}
private fun setErrorText(text: String) {
binding.errorText.text = text
binding.errorText.visibility = View.VISIBLE

View File

@ -94,7 +94,9 @@ class SwitchAccountController(args: Bundle? = null) :
null, java.lang.Boolean.TRUE, null, userEntity.id, null, null, null
)
.subscribe(object : Observer<UserEntity> {
override fun onSubscribe(d: Disposable) {}
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(userEntity: UserEntity) {
cookieManager.cookieStore.removeAll()
userUtils.disableAllUsersWithoutId(userEntity.id)
@ -103,8 +105,12 @@ class SwitchAccountController(args: Bundle? = null) :
}
}
override fun onError(e: Throwable) {}
override fun onComplete() {}
override fun onError(e: Throwable) {
// unused atm
}
override fun onComplete() {
// unused atm
}
})
}
true

View File

@ -46,10 +46,12 @@ import com.nextcloud.talk.controllers.util.viewBinding
import com.nextcloud.talk.databinding.ControllerEntryMenuBinding
import com.nextcloud.talk.models.json.conversations.Conversation
import com.nextcloud.talk.utils.ShareUtils
import com.nextcloud.talk.utils.UriUtils
import com.nextcloud.talk.utils.bundle.BundleKeys
import com.nextcloud.talk.utils.database.user.UserUtils
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder
import com.vanniktech.emoji.EmojiPopup
import okhttp3.internal.immutableListOf
import org.greenrobot.eventbus.EventBus
import org.parceler.Parcels
import org.parceler.Parcels.unwrap
@ -114,8 +116,14 @@ class EntryMenuController(args: Bundle) :
}
binding.textEdit.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
// unused atm
}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
// unused atm
}
override fun afterTextChanged(s: Editable) {
if (!TextUtils.isEmpty(s)) {
if (operation === ConversationOperationEnum.OPS_CODE_RENAME_ROOM) {
@ -139,10 +147,7 @@ class EntryMenuController(args: Bundle) :
}
binding.textInputLayout.isErrorEnabled = false
} else if (
(
binding.textEdit.text.toString().startsWith("http://") ||
binding.textEdit.text.toString().startsWith("https://")
) &&
UriUtils.hasHttpProtocollPrefixed(binding.textEdit.text.toString()) &&
binding.textEdit.text.toString().contains("/call/")
) {
if (!binding.okButton.isEnabled) {
@ -211,15 +216,12 @@ class EntryMenuController(args: Bundle) :
else -> {
}
}
if (operation === ConversationOperationEnum.OPS_CODE_JOIN_ROOM ||
operation === ConversationOperationEnum.OPS_CODE_CHANGE_PASSWORD ||
operation === ConversationOperationEnum.OPS_CODE_SET_PASSWORD ||
operation === ConversationOperationEnum.OPS_CODE_SHARE_LINK
) {
if (PASSWORD_ENTRY_OPERATIONS.contains(operation)) {
binding.textInputLayout.endIconMode = TextInputLayout.END_ICON_PASSWORD_TOGGLE
} else {
binding.textInputLayout.endIconMode = TextInputLayout.END_ICON_NONE
}
binding.textInputLayout.hint = labelText
binding.textInputLayout.requestFocus()
@ -323,4 +325,14 @@ class EntryMenuController(args: Bundle) :
packageName = args.getString(BundleKeys.KEY_APP_ITEM_PACKAGE_NAME, "")
callUrl = args.getString(BundleKeys.KEY_CALL_URL, "")
}
companion object {
private val PASSWORD_ENTRY_OPERATIONS: List<ConversationOperationEnum> =
immutableListOf(
ConversationOperationEnum.OPS_CODE_JOIN_ROOM,
ConversationOperationEnum.OPS_CODE_CHANGE_PASSWORD,
ConversationOperationEnum.OPS_CODE_SET_PASSWORD,
ConversationOperationEnum.OPS_CODE_SHARE_LINK
)
}
}

View File

@ -129,9 +129,11 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Observer<ContactsByNumberOverall> {
override fun onComplete() {
// unused atm
}
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(foundContacts: ContactsByNumberOverall) {

View File

@ -99,10 +99,18 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
checkNotNull(roomToken)
for (index in sourcefiles.indices) {
val sourcefileUri = Uri.parse(sourcefiles[index])
val filename = UriUtils.getFileName(sourcefileUri, context)
val requestBody = createRequestBody(sourcefileUri)
uploadFile(currentUser, ncTargetpath, filename, roomToken, requestBody, sourcefileUri, metaData)
val sourceFileUri = Uri.parse(sourcefiles[index])
uploadFile(
currentUser!!,
UploadItem(
sourceFileUri,
UriUtils.getFileName(sourceFileUri, context),
createRequestBody(sourceFileUri)
),
ncTargetpath,
roomToken,
metaData
)
}
} catch (e: IllegalStateException) {
Log.e(javaClass.simpleName, "Something went wrong when trying to upload file", e)
@ -114,6 +122,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
return Result.success()
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun createRequestBody(sourcefileUri: Uri): RequestBody? {
var requestBody: RequestBody? = null
try {
@ -129,34 +138,34 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
private fun uploadFile(
currentUser: UserEntity,
ncTargetpath: String?,
filename: String,
uploadItem: UploadItem,
ncTargetPath: String?,
roomToken: String?,
requestBody: RequestBody?,
sourcefileUri: Uri,
metaData: String?
) {
ncApi.uploadFile(
ApiUtils.getCredentials(currentUser.username, currentUser.token),
ApiUtils.getUrlForFileUpload(currentUser.baseUrl, currentUser.userId, ncTargetpath, filename),
requestBody
ApiUtils.getUrlForFileUpload(currentUser.baseUrl, currentUser.userId, ncTargetPath, uploadItem.fileName),
uploadItem.requestBody
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Observer<Response<GenericOverall>> {
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(t: Response<GenericOverall>) {
// unused atm
}
override fun onError(e: Throwable) {
Log.e(TAG, "failed to upload file $filename")
Log.e(TAG, "failed to upload file ${uploadItem.fileName}")
}
override fun onComplete() {
shareFile(roomToken, currentUser, ncTargetpath, filename, metaData)
copyFileToCache(sourcefileUri, filename)
shareFile(roomToken, currentUser, ncTargetPath, uploadItem.fileName, metaData)
copyFileToCache(uploadItem.uri, uploadItem.fileName)
}
})
}
@ -271,4 +280,10 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
}
}
}
private data class UploadItem(
val uri: Uri,
val fileName: String,
val requestBody: RequestBody?,
)
}

View File

@ -122,6 +122,7 @@ class SetStatusDialogFragment :
.subscribe(object : Observer<ResponseBody> {
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(responseBody: ResponseBody) {
@ -136,9 +137,12 @@ class SetStatusDialogFragment :
}
override fun onError(e: Throwable) {
// unused atm
}
override fun onComplete() {}
override fun onComplete() {
// unused atm
}
})
}
}
@ -322,8 +326,12 @@ class SetStatusDialogFragment :
ncApi.statusDeleteMessage(credentials, ApiUtils.getUrlForStatusMessage(currentUser?.baseUrl))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer<GenericOverall> {
override fun onSubscribe(d: Disposable) {}
override fun onNext(statusOverall: GenericOverall) {}
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(statusOverall: GenericOverall) {
// unused atm
}
override fun onError(e: Throwable) {
Log.e(logTag, "Failed to clear status", e)
}
@ -343,7 +351,9 @@ class SetStatusDialogFragment :
.io()
)
.observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer<GenericOverall> {
override fun onSubscribe(d: Disposable) {}
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(statusOverall: GenericOverall) {
Log.d(logTag, "statusType successfully set")
}
@ -353,7 +363,9 @@ class SetStatusDialogFragment :
clearTopStatus()
}
override fun onComplete() {}
override fun onComplete() {
// unused atm
}
})
}
@ -417,6 +429,7 @@ class SetStatusDialogFragment :
?.subscribe(object : Observer<GenericOverall> {
override fun onSubscribe(d: Disposable) {
// unused atm
}
override fun onNext(t: GenericOverall) {
@ -428,7 +441,9 @@ class SetStatusDialogFragment :
Log.e(logTag, "failed to set CustomStatusMessage", e)
}
override fun onComplete() {}
override fun onComplete() {
// unused atm
}
})
}

View File

@ -55,10 +55,7 @@ object AccountUtils {
internalUserEntity = userEntitiesList[i]
importAccount = getInformationFromAccount(account)
if (importAccount.token != null) {
if (
importAccount.baseUrl.startsWith("http://") ||
importAccount.baseUrl.startsWith("https://")
) {
if (UriUtils.hasHttpProtocollPrefixed(importAccount.baseUrl)) {
if (
internalUserEntity.username == importAccount.username &&
internalUserEntity.baseUrl == importAccount.baseUrl
@ -139,6 +136,7 @@ object AccountUtils {
return false
}
@Suppress("Detekt.TooGenericExceptionCaught")
fun getInformationFromAccount(account: Account): ImportAccount {
val lastAtPos = account.name.lastIndexOf("@")
var urlString = account.name.substring(lastAtPos + 1)

View File

@ -43,6 +43,7 @@ class ImageEmojiEditText : EmojiEditText {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
@Suppress("Detekt.TooGenericExceptionCaught")
override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection {
val ic: InputConnection = super.onCreateInputConnection(editorInfo)

View File

@ -2,6 +2,8 @@
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
@ -62,9 +64,7 @@ object NotificationUtils {
@TargetApi(Build.VERSION_CODES.O)
private fun createNotificationChannel(
context: Context,
channelId: String,
channelName: String,
channelDescription: String,
notificationChannel: Channel,
sound: Uri?,
audioAttributes: AudioAttributes
) {
@ -73,14 +73,14 @@ object NotificationUtils {
if (
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
notificationManager.getNotificationChannel(channelId) == null
notificationManager.getNotificationChannel(notificationChannel.id) == null
) {
val channel = NotificationChannel(
channelId, channelName,
notificationChannel.id, notificationChannel.name,
NotificationManager.IMPORTANCE_HIGH
)
channel.description = channelDescription
channel.description = notificationChannel.description
channel.enableLights(true)
channel.lightColor = R.color.colorPrimary
channel.setSound(sound, audioAttributes)
@ -103,9 +103,11 @@ object NotificationUtils {
createNotificationChannel(
context,
NOTIFICATION_CHANNEL_CALLS_V4,
context.resources.getString(R.string.nc_notification_channel_calls),
context.resources.getString(R.string.nc_notification_channel_calls_description),
Channel(
NOTIFICATION_CHANNEL_CALLS_V4,
context.resources.getString(R.string.nc_notification_channel_calls),
context.resources.getString(R.string.nc_notification_channel_calls_description)
),
soundUri,
audioAttributes
)
@ -124,9 +126,11 @@ object NotificationUtils {
createNotificationChannel(
context,
NOTIFICATION_CHANNEL_MESSAGES_V4,
context.resources.getString(R.string.nc_notification_channel_messages),
context.resources.getString(R.string.nc_notification_channel_messages_description),
Channel(
NOTIFICATION_CHANNEL_MESSAGES_V4,
context.resources.getString(R.string.nc_notification_channel_messages),
context.resources.getString(R.string.nc_notification_channel_messages_description)
),
soundUri,
audioAttributes
)
@ -322,4 +326,10 @@ object NotificationUtils {
appPreferences.messageRingtoneUri, DEFAULT_MESSAGE_RINGTONE_URI, NOTIFICATION_CHANNEL_MESSAGES_V4
)
}
private data class Channel(
val id: String,
val name: String,
val description: String
)
}

View File

@ -1,7 +1,9 @@
/*
* Nextcloud Talk application
*
* @author Andy Scherzinger
* @author Marcel Hibbe
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
*
* This program is free software: you can redistribute it and/or modify
@ -50,5 +52,9 @@ class UriUtils {
}
return filename
}
fun hasHttpProtocollPrefixed(uri: String): Boolean {
return uri.startsWith("http://") || uri.startsWith("https://")
}
}
}

View File

@ -1,5 +1,5 @@
build:
maxIssues: 217
maxIssues: 149
weights:
# complexity: 2
# LongParameterList: 1

View File

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 1 error and 171 warnings</span>
<span class="mdl-layout-title">Lint Report: 1 error and 172 warnings</span>