Merge pull request #2773 from nextcloud/dependabot/gradle/org.jlleitschuh.gradle-ktlint-gradle-11.2.0

Build(deps): Bump org.jlleitschuh.gradle:ktlint-gradle from 11.1.0 to 11.2.0
This commit is contained in:
Marcel Hibbe 2023-02-16 09:58:05 +01:00 committed by GitHub
commit d1221aa435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 136 additions and 100 deletions

View File

@ -38,4 +38,4 @@ indent_size=2
[*.{kt,kts}] [*.{kt,kts}]
# IDE does not follow this Ktlint rule strictly, but the default ordering is pretty good anyway, so let's ditch it # IDE does not follow this Ktlint rule strictly, but the default ordering is pretty good anyway, so let's ditch it
disabled_rules=import-ordering ktlint_disabled_rules=import-ordering

View File

@ -109,7 +109,8 @@ class ClosedInterfaceImpl : ClosedInterface, ProviderInstaller.ProviderInstallLi
WorkManager.getInstance() WorkManager.getInstance()
.enqueueUniquePeriodicWork( .enqueueUniquePeriodicWork(
"periodicTokenRegistration", ExistingPeriodicWorkPolicy.REPLACE, "periodicTokenRegistration",
ExistingPeriodicWorkPolicy.REPLACE,
periodicTokenRegistration periodicTokenRegistration
) )
} }
@ -120,13 +121,14 @@ class ClosedInterfaceImpl : ClosedInterface, ProviderInstaller.ProviderInstallLi
MONTHLY, MONTHLY,
TimeUnit.DAYS, TimeUnit.DAYS,
FLEX_INTERVAL, FLEX_INTERVAL,
TimeUnit.DAYS, TimeUnit.DAYS
) )
.build() .build()
WorkManager.getInstance() WorkManager.getInstance()
.enqueueUniquePeriodicWork( .enqueueUniquePeriodicWork(
"periodicTokenRefreshFromFCM", ExistingPeriodicWorkPolicy.REPLACE, "periodicTokenRefreshFromFCM",
ExistingPeriodicWorkPolicy.REPLACE,
periodicTokenRefreshFromFCM periodicTokenRefreshFromFCM
) )
} }

View File

@ -40,7 +40,7 @@ data class User(
var clientCertificate: String? = null, var clientCertificate: String? = null,
var externalSignalingServer: ExternalSignalingServer? = null, var externalSignalingServer: ExternalSignalingServer? = null,
var current: Boolean = FALSE, var current: Boolean = FALSE,
var scheduledForDeletion: Boolean = FALSE, var scheduledForDeletion: Boolean = FALSE
) : Parcelable { ) : Parcelable {
fun getMaxMessageLength(): Int { fun getMaxMessageLength(): Int {

View File

@ -35,16 +35,40 @@ import java.lang.Boolean.FALSE
@Parcelize @Parcelize
@Entity(tableName = "User") @Entity(tableName = "User")
data class UserEntity( data class UserEntity(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "id") var id: Long = 0, @PrimaryKey(autoGenerate = true)
@ColumnInfo(name = "userId") var userId: String? = null, @ColumnInfo(name = "id")
@ColumnInfo(name = "username") var username: String? = null, var id: Long = 0,
@ColumnInfo(name = "baseUrl") var baseUrl: String? = null,
@ColumnInfo(name = "token") var token: String? = null, @ColumnInfo(name = "userId")
@ColumnInfo(name = "displayName") var displayName: String? = null, var userId: String? = null,
@ColumnInfo(name = "pushConfigurationState") var pushConfigurationState: PushConfigurationState? = null,
@ColumnInfo(name = "capabilities") var capabilities: Capabilities? = null, @ColumnInfo(name = "username")
@ColumnInfo(name = "clientCertificate") var clientCertificate: String? = null, var username: String? = null,
@ColumnInfo(name = "externalSignalingServer") var externalSignalingServer: ExternalSignalingServer? = null,
@ColumnInfo(name = "current") var current: Boolean = FALSE, @ColumnInfo(name = "baseUrl")
@ColumnInfo(name = "scheduledForDeletion") var scheduledForDeletion: Boolean = FALSE, var baseUrl: String? = null,
@ColumnInfo(name = "token")
var token: String? = null,
@ColumnInfo(name = "displayName")
var displayName: String? = null,
@ColumnInfo(name = "pushConfigurationState")
var pushConfigurationState: PushConfigurationState? = null,
@ColumnInfo(name = "capabilities")
var capabilities: Capabilities? = null,
@ColumnInfo(name = "clientCertificate")
var clientCertificate: String? = null,
@ColumnInfo(name = "externalSignalingServer")
var externalSignalingServer: ExternalSignalingServer? = null,
@ColumnInfo(name = "current")
var current: Boolean = FALSE,
@ColumnInfo(name = "scheduledForDeletion")
var scheduledForDeletion: Boolean = FALSE
) : Parcelable ) : Parcelable

View File

@ -53,7 +53,6 @@ fun ImageView.loadAvatar(
requestBigSize: Boolean = true requestBigSize: Boolean = true
): io.reactivex.disposables ): io.reactivex.disposables
.Disposable { .Disposable {
val imageRequestUri = ApiUtils.getUrlForAvatar( val imageRequestUri = ApiUtils.getUrlForAvatar(
user.baseUrl, user.baseUrl,
avatar, avatar,
@ -69,7 +68,6 @@ fun ImageView.replaceAvatar(
requestBigSize: Boolean = true requestBigSize: Boolean = true
): io.reactivex.disposables ): io.reactivex.disposables
.Disposable { .Disposable {
val imageRequestUri = ApiUtils.getUrlForAvatar( val imageRequestUri = ApiUtils.getUrlForAvatar(
user.baseUrl, user.baseUrl,
avatar, avatar,
@ -86,7 +84,6 @@ private fun ImageView.loadAvatarInternal(
replace: Boolean replace: Boolean
): io.reactivex.disposables ): io.reactivex.disposables
.Disposable { .Disposable {
if (replace && this.result is SuccessResult) { if (replace && this.result is SuccessResult) {
val result = this.result as SuccessResult val result = this.result as SuccessResult
val memoryCacheKey = result.memoryCacheKey val memoryCacheKey = result.memoryCacheKey
@ -227,7 +224,6 @@ fun ImageView.loadBotsAvatar(): io.reactivex.disposables.Disposable {
} }
fun ImageView.loadGroupCallAvatar(viewThemeUtils: ViewThemeUtils): io.reactivex.disposables.Disposable { fun ImageView.loadGroupCallAvatar(viewThemeUtils: ViewThemeUtils): io.reactivex.disposables.Disposable {
val data: Any = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val data: Any = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.ic_avatar_group) as Any viewThemeUtils.talk.themePlaceholderAvatar(this, R.drawable.ic_avatar_group) as Any
} else { } else {

View File

@ -520,11 +520,15 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
if ("user" == userType || "guest" == userType) { if ("user" == userType || "guest" == userType) {
val baseUrl = signatureVerification.user!!.baseUrl val baseUrl = signatureVerification.user!!.baseUrl
val avatarUrl = if ("user" == userType) ApiUtils.getUrlForAvatar( val avatarUrl = if ("user" == userType) {
baseUrl, ApiUtils.getUrlForAvatar(
notificationUser.id, baseUrl,
false notificationUser.id,
) else ApiUtils.getUrlForGuestAvatar(baseUrl, notificationUser.name, false) false
)
} else {
ApiUtils.getUrlForGuestAvatar(baseUrl, notificationUser.name, false)
}
person.setIcon(loadAvatarSync(avatarUrl, context!!)) person.setIcon(loadAvatarSync(avatarUrl, context!!))
} }
notificationBuilder.setStyle(getStyle(person.build(), style)) notificationBuilder.setStyle(getStyle(person.build(), style))

View File

@ -70,7 +70,8 @@ class ShareOperationWorker(context: Context, workerParams: WorkerParameters) : W
) )
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.blockingSubscribe( .blockingSubscribe(
{}, { e -> Log.w(TAG, "error while creating RemoteShare", e) } {},
{ e -> Log.w(TAG, "error while creating RemoteShare", e) }
) )
} }
return Result.success() return Result.success()

View File

@ -129,7 +129,7 @@ data class ChatMessage(
var voiceMessagePlayedSeconds: Int = 0, var voiceMessagePlayedSeconds: Int = 0,
var voiceMessageDownloadProgress: Int = 0, var voiceMessageDownloadProgress: Int = 0
) : Parcelable, MessageContentType, MessageContentType.Image { ) : Parcelable, MessageContentType, MessageContentType.Image {
@ -235,7 +235,9 @@ data class ChatMessage(
} }
return if (!messageTypesToIgnore.contains(getCalculateMessageType())) { return if (!messageTypesToIgnore.contains(getCalculateMessageType())) {
message!!.trim { it <= ' ' } message!!.trim { it <= ' ' }
} else null } else {
null
}
} }
fun getCalculateMessageType(): MessageType { fun getCalculateMessageType(): MessageType {
@ -418,7 +420,8 @@ data class ChatMessage(
} }
actorType == "bridged" -> { actorType == "bridged" -> {
ApiUtils.getUrlForAvatar( ApiUtils.getUrlForAvatar(
activeUser!!.baseUrl, "bridge-bot", activeUser!!.baseUrl,
"bridge-bot",
true true
) )
} }
@ -524,7 +527,7 @@ data class ChatMessage(
RECORDING_STARTED, RECORDING_STARTED,
RECORDING_STOPPED, RECORDING_STOPPED,
AUDIO_RECORDING_STARTED, AUDIO_RECORDING_STARTED,
AUDIO_RECORDING_STOPPED, AUDIO_RECORDING_STOPPED
} }
companion object { companion object {

View File

@ -194,8 +194,10 @@ data class Conversation(
return if (canDeleteConversation != null) { return if (canDeleteConversation != null) {
// Available since APIv2 // Available since APIv2
canDeleteConversation!! canDeleteConversation!!
} else canModerate(conversationUser) } else {
// Fallback for APIv1 canModerate(conversationUser)
// Fallback for APIv1
}
} }
enum class NotificationLevel { enum class NotificationLevel {

View File

@ -44,7 +44,6 @@ class EnumActorTypeConverter : StringBasedTypeConverter<Participant.ActorType>()
} }
override fun convertToString(`object`: Participant.ActorType?): String { override fun convertToString(`object`: Participant.ActorType?): String {
if (`object` == null) { if (`object` == null) {
return "" return ""
} }

View File

@ -36,7 +36,6 @@ class EnumReactionActorTypeConverter : StringBasedTypeConverter<ReactionVoter.Re
} }
override fun convertToString(`object`: ReactionVoter.ReactionActorType?): String { override fun convertToString(`object`: ReactionVoter.ReactionActorType?): String {
if (`object` == null) { if (`object` == null) {
return "" return ""
} }

View File

@ -36,8 +36,7 @@ data class OpenGraphObject(
@JsonField(name = ["thumb"]) @JsonField(name = ["thumb"])
var thumb: String? = null, var thumb: String? = null,
@JsonField(name = ["link"]) @JsonField(name = ["link"])
var link: String? = null, var link: String? = null
) : Parcelable { ) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this("", "", null, null) constructor() : this("", "", null, null)

View File

@ -34,8 +34,7 @@ data class Reference(
@JsonField(name = ["openGraphObject"]) @JsonField(name = ["openGraphObject"])
var openGraphObject: OpenGraphObject? = null, var openGraphObject: OpenGraphObject? = null,
@JsonField(name = ["accessible"]) @JsonField(name = ["accessible"])
var accessible: Boolean, var accessible: Boolean
) : Parcelable { ) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null, false) constructor() : this(null, null, null, false)

View File

@ -36,8 +36,7 @@ data class RichObject(
@JsonField(name = ["thumb"]) @JsonField(name = ["thumb"])
var thumb: String? = null, var thumb: String? = null,
@JsonField(name = ["link"]) @JsonField(name = ["link"])
var link: String? = null, var link: String? = null
) : Parcelable { ) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this("", "", null, null) constructor() : this("", "", null, null)

View File

@ -107,7 +107,9 @@ data class Participant(
} else { } else {
ActorType.GUESTS ActorType.GUESTS
} }
} else actorType!! } else {
actorType!!
}
/** /**
* actorId is only guaranteed in APIv3+ so use calculatedActorId. * actorId is only guaranteed in APIv3+ so use calculatedActorId.
@ -115,7 +117,9 @@ data class Participant(
val calculatedActorId: String? val calculatedActorId: String?
get() = if (actorId == null) { get() = if (actorId == null) {
userId userId
} else actorId } else {
actorId
}
enum class ActorType { enum class ActorType {
DUMMY, EMAILS, GROUPS, GUESTS, USERS, CIRCLES DUMMY, EMAILS, GROUPS, GUESTS, USERS, CIRCLES

View File

@ -42,7 +42,7 @@ data class UnifiedSearchEntry(
@JsonField(name = ["rounded"]) @JsonField(name = ["rounded"])
var rounded: Boolean?, var rounded: Boolean?,
@JsonField(name = ["attributes"]) @JsonField(name = ["attributes"])
var attributes: Map<String, String>?, var attributes: Map<String, String>?
) : Parcelable { ) : Parcelable {
constructor() : this(null, null, null, null, null, null, null) constructor() : this(null, null, null, null, null, null, null)
} }

View File

@ -44,7 +44,6 @@ class PollCreateOptionViewHolder(
position: Int, position: Int,
focus: Boolean focus: Boolean
) { ) {
textListener?.let { textListener?.let {
binding.pollOptionTextEdit.removeTextChangedListener(it) binding.pollOptionTextEdit.removeTextChangedListener(it)
} }

View File

@ -42,21 +42,24 @@ class PollResultsAdapter(
when (viewType) { when (viewType) {
PollResultHeaderItem.VIEW_TYPE -> { PollResultHeaderItem.VIEW_TYPE -> {
val itemBinding = PollResultHeaderItemBinding.inflate( val itemBinding = PollResultHeaderItemBinding.inflate(
LayoutInflater.from(parent.context), parent, LayoutInflater.from(parent.context),
parent,
false false
) )
viewHolder = PollResultHeaderViewHolder(itemBinding, viewThemeUtils) viewHolder = PollResultHeaderViewHolder(itemBinding, viewThemeUtils)
} }
PollResultVoterItem.VIEW_TYPE -> { PollResultVoterItem.VIEW_TYPE -> {
val itemBinding = PollResultVoterItemBinding.inflate( val itemBinding = PollResultVoterItemBinding.inflate(
LayoutInflater.from(parent.context), parent, LayoutInflater.from(parent.context),
parent,
false false
) )
viewHolder = PollResultVoterViewHolder(user, itemBinding, viewThemeUtils) viewHolder = PollResultVoterViewHolder(user, itemBinding, viewThemeUtils)
} }
PollResultVotersOverviewItem.VIEW_TYPE -> { PollResultVotersOverviewItem.VIEW_TYPE -> {
val itemBinding = PollResultVotersOverviewItemBinding.inflate( val itemBinding = PollResultVotersOverviewItemBinding.inflate(
LayoutInflater.from(parent.context), parent, LayoutInflater.from(parent.context),
parent,
false false
) )
viewHolder = PollResultVotersOverviewViewHolder(user, itemBinding) viewHolder = PollResultVotersOverviewViewHolder(user, itemBinding)

View File

@ -44,8 +44,7 @@ class PollRepositoryImpl(private val ncApi: NcApi, private val currentUserProvid
question: String, question: String,
options: List<String>, options: List<String>,
resultMode: Int, resultMode: Int,
maxVotes: maxVotes: Int
Int
): Observable<Poll> { ): Observable<Poll> {
return ncApi.createPoll( return ncApi.createPoll(
credentials, credentials,
@ -61,19 +60,17 @@ class PollRepositoryImpl(private val ncApi: NcApi, private val currentUserProvid
} }
override fun getPoll(roomToken: String, pollId: String): Observable<Poll> { override fun getPoll(roomToken: String, pollId: String): Observable<Poll> {
return ncApi.getPoll( return ncApi.getPoll(
credentials, credentials,
ApiUtils.getUrlForPoll( ApiUtils.getUrlForPoll(
currentUser.baseUrl, currentUser.baseUrl,
roomToken, roomToken,
pollId pollId
), )
).map { mapToPoll(it.ocs?.data!!) } ).map { mapToPoll(it.ocs?.data!!) }
} }
override fun vote(roomToken: String, pollId: String, options: List<Int>): Observable<Poll> { override fun vote(roomToken: String, pollId: String, options: List<Int>): Observable<Poll> {
return ncApi.votePoll( return ncApi.votePoll(
credentials, credentials,
ApiUtils.getUrlForPoll( ApiUtils.getUrlForPoll(
@ -86,14 +83,13 @@ class PollRepositoryImpl(private val ncApi: NcApi, private val currentUserProvid
} }
override fun closePoll(roomToken: String, pollId: String): Observable<Poll> { override fun closePoll(roomToken: String, pollId: String): Observable<Poll> {
return ncApi.closePoll( return ncApi.closePoll(
credentials, credentials,
ApiUtils.getUrlForPoll( ApiUtils.getUrlForPoll(
currentUser.baseUrl, currentUser.baseUrl,
roomToken, roomToken,
pollId pollId
), )
).map { mapToPoll(it.ocs?.data!!) } ).map { mapToPoll(it.ocs?.data!!) }
} }

View File

@ -37,7 +37,7 @@ data class PollDetailsResponse(
var actorDisplayName: String, var actorDisplayName: String,
@JsonField(name = ["optionId"]) @JsonField(name = ["optionId"])
var optionId: Int, var optionId: Int
) : Parcelable { ) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, "", "", 0) constructor() : this(null, "", "", 0)

View File

@ -64,7 +64,7 @@ data class PollResponse(
var numVoters: Int = 0, var numVoters: Int = 0,
@JsonField(name = ["details"]) @JsonField(name = ["details"])
var details: ArrayList<PollDetailsResponse>? = null, var details: ArrayList<PollDetailsResponse>? = null
) : Parcelable { ) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this("id", null, null, null, null, null, null, 0, 0, 0, null, 0, null) constructor() : this("id", null, null, null, null, null, null, 0, 0, 0, null, 0, null)

View File

@ -67,9 +67,8 @@ class PollLoadingFragment : Fragment() {
fun newInstance( fun newInstance(
fragmentHeight: Int fragmentHeight: Int
): PollLoadingFragment { ): PollLoadingFragment {
val args = bundleOf( val args = bundleOf(
KEY_FRAGMENT_HEIGHT to fragmentHeight, KEY_FRAGMENT_HEIGHT to fragmentHeight
) )
val fragment = PollLoadingFragment() val fragment = PollLoadingFragment()

View File

@ -182,7 +182,6 @@ class PollMainDialogFragment : DialogFragment() {
pollId: String, pollId: String,
name: String name: String
): PollMainDialogFragment { ): PollMainDialogFragment {
val args = bundleOf( val args = bundleOf(
KEY_USER_ENTITY to user, KEY_USER_ENTITY to user,
KEY_ROOM_TOKEN to roomTokenParam, KEY_ROOM_TOKEN to roomTokenParam,

View File

@ -117,7 +117,10 @@ class PollCreateViewModel @Inject constructor(private val repository: PollReposi
_viewState.value = PollCreationState(enableAddOptionButton = false, enableCreatePollButton = false) _viewState.value = PollCreationState(enableAddOptionButton = false, enableCreatePollButton = false)
repository.createPoll( repository.createPoll(
roomToken, _question, _options.value!!.map { it.pollOption }, resultMode, roomToken,
_question,
_options.value!!.map { it.pollOption },
resultMode,
maxVotes maxVotes
) )
.doOnSubscribe { disposable = it } .doOnSubscribe { disposable = it }

View File

@ -28,7 +28,6 @@ import com.nextcloud.talk.utils.NotificationUtils
class PackageReplacedReceiver : BroadcastReceiver() { class PackageReplacedReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent?) { override fun onReceive(context: Context, intent: Intent?) {
if (intent != null && intent.action != null && if (intent != null && intent.action != null &&
intent.action == "android.intent.action.MY_PACKAGE_REPLACED" intent.action == "android.intent.action.MY_PACKAGE_REPLACED"
) { ) {

View File

@ -32,7 +32,7 @@ abstract class RemoteFileBrowserItemsViewHolder(
open val binding: ViewBinding, open val binding: ViewBinding,
val mimeTypeSelectionFilter: String? = null, val mimeTypeSelectionFilter: String? = null,
val currentUser: User, val currentUser: User,
val selectionInterface: SelectionInterface, val selectionInterface: SelectionInterface
) : RecyclerView.ViewHolder(binding.root) { ) : RecyclerView.ViewHolder(binding.root) {
abstract val fileIcon: ImageView abstract val fileIcon: ImageView

View File

@ -41,7 +41,6 @@ class ConversationsRepositoryImpl(private val api: NcApi, private val userProvid
get() = ApiUtils.getCredentials(user.username, user.token) get() = ApiUtils.getCredentials(user.username, user.token)
override fun allowGuests(token: String, allow: Boolean): Observable<AllowGuestsResult> { override fun allowGuests(token: String, allow: Boolean): Observable<AllowGuestsResult> {
val url = ApiUtils.getUrlForRoomPublic( val url = ApiUtils.getUrlForRoomPublic(
apiVersion(), apiVersion(),
user.baseUrl, user.baseUrl,
@ -74,7 +73,6 @@ class ConversationsRepositoryImpl(private val api: NcApi, private val userProvid
password password
) )
return apiObservable.map { return apiObservable.map {
val passwordPolicyMessage = if (it.code() == STATUS_CODE_BAD_REQUEST) { val passwordPolicyMessage = if (it.code() == STATUS_CODE_BAD_REQUEST) {
LoganSquare.parse(it.errorBody()!!.string(), PasswordOverall::class.java).ocs!!.data!! LoganSquare.parse(it.errorBody()!!.string(), PasswordOverall::class.java).ocs!!.data!!
.message!! .message!!
@ -87,7 +85,6 @@ class ConversationsRepositoryImpl(private val api: NcApi, private val userProvid
} }
override fun resendInvitations(token: String): Observable<ResendInvitationsResult> { override fun resendInvitations(token: String): Observable<ResendInvitationsResult> {
val apiObservable = api.resendParticipantInvitations( val apiObservable = api.resendParticipantInvitations(
credentials, credentials,
ApiUtils.getUrlForParticipantsResendInvitations( ApiUtils.getUrlForParticipantsResendInvitations(

View File

@ -56,7 +56,6 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val router: Rout
private val allowedAppIds = listOf(SPREED.stringValue, PROFILE.stringValue, EMAIL.stringValue) private val allowedAppIds = listOf(SPREED.stringValue, PROFILE.stringValue, EMAIL.stringValue)
fun showFor(user: String, context: Context) { fun showFor(user: String, context: Context) {
ncApi.hoverCard( ncApi.hoverCard(
ApiUtils.getCredentials(userModel.username, userModel.token), ApiUtils.getCredentials(userModel.username, userModel.token),
ApiUtils.getUrlForHoverCard(userModel.baseUrl, user) ApiUtils.getUrlForHoverCard(userModel.baseUrl, user)
@ -87,7 +86,6 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val router: Rout
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun bottomSheet(actions: List<HoverCardAction>, displayName: String, userId: String, context: Context) { private fun bottomSheet(actions: List<HoverCardAction>, displayName: String, userId: String, context: Context) {
val filteredActions = actions.filter { allowedAppIds.contains(it.appId) } val filteredActions = actions.filter { allowedAppIds.contains(it.appId) }
val items = filteredActions.map { configureActionListItem(it) } val items = filteredActions.map { configureActionListItem(it) }
@ -109,7 +107,6 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val router: Rout
} }
private fun configureActionListItem(action: HoverCardAction): BasicListItemWithImage { private fun configureActionListItem(action: HoverCardAction): BasicListItemWithImage {
val drawable = when (AllowedAppIds.createFor(action)) { val drawable = when (AllowedAppIds.createFor(action)) {
PROFILE -> R.drawable.ic_user PROFILE -> R.drawable.ic_user
EMAIL -> R.drawable.ic_email EMAIL -> R.drawable.ic_email
@ -123,7 +120,6 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val router: Rout
} }
private fun talkTo(userId: String) { private fun talkTo(userId: String) {
val apiVersion = val apiVersion =
ApiUtils.getConversationApiVersion(userModel, intArrayOf(ApiUtils.APIv4, 1)) ApiUtils.getConversationApiVersion(userModel, intArrayOf(ApiUtils.APIv4, 1))
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom( val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
@ -137,7 +133,8 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val router: Rout
val credentials = ApiUtils.getCredentials(userModel.username, userModel.token) val credentials = ApiUtils.getCredentials(userModel.username, userModel.token)
ncApi.createRoom( ncApi.createRoom(
credentials, credentials,
retrofitBucket.url, retrofitBucket.queryMap retrofitBucket.url,
retrofitBucket.queryMap
) )
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -156,7 +153,8 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val router: Rout
ncApi.getRoom( ncApi.getRoom(
credentials, credentials,
ApiUtils.getUrlForRoom( ApiUtils.getUrlForRoom(
apiVersion, userModel.baseUrl, apiVersion,
userModel.baseUrl,
roomOverall.ocs!!.data!!.token roomOverall.ocs!!.data!!.token
) )
) )
@ -173,8 +171,11 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User, val router: Rout
Parcels.wrap(roomOverall.ocs!!.data) Parcels.wrap(roomOverall.ocs!!.data)
) )
ConductorRemapping.remapChatController( ConductorRemapping.remapChatController(
router, userModel.id!!, router,
roomOverall.ocs!!.data!!.token!!, bundle, true userModel.id!!,
roomOverall.ocs!!.data!!.token!!,
bundle,
true
) )
} }

View File

@ -66,6 +66,7 @@ class ChooseAccountShareToDialogFragment : DialogFragment() {
private var dialogView: View? = null private var dialogView: View? = null
private var adapter: FlexibleAdapter<AdvancedUserItem>? = null private var adapter: FlexibleAdapter<AdvancedUserItem>? = null
private val userItems: MutableList<AdvancedUserItem> = ArrayList() private val userItems: MutableList<AdvancedUserItem> = ArrayList()
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
binding = DialogChooseAccountShareToBinding.inflate(LayoutInflater.from(requireContext())) binding = DialogChooseAccountShareToBinding.inflate(LayoutInflater.from(requireContext()))

View File

@ -343,7 +343,9 @@ class ShowReactionsDialog(
} }
return if (obj2 == null) { return if (obj2 == null) {
1 1
} else obj1.lowercase().compareTo(obj2.lowercase()) } else {
obj1.lowercase().compareTo(obj2.lowercase())
}
} }
} }
@ -358,7 +360,9 @@ class ShowReactionsDialog(
} }
return if (obj2 == null) { return if (obj2 == null) {
1 1
} else obj1.compareTo(obj2) } else {
obj1.compareTo(obj2)
}
} }
} }
} }

View File

@ -119,7 +119,7 @@ class ChunkedFileUploader(
private fun createFolder(davResource: DavResource) { private fun createFolder(davResource: DavResource) {
try { try {
davResource.mkCol( davResource.mkCol(
xmlBody = null, xmlBody = null
) { response: Response -> ) { response: Response ->
if (!response.isSuccessful) { if (!response.isSuccessful) {
throw IOException("failed to create folder. response code: " + response.code) throw IOException("failed to create folder. response code: " + response.code)
@ -270,10 +270,12 @@ class ChunkedFileUploader(
} }
} }
} finally { } finally {
if (channel != null) try { if (channel != null) {
channel.close() try {
} catch (e: IOException) { channel.close()
Log.e(TAG, "Error closing file channel!", e) } catch (e: IOException) {
Log.e(TAG, "Error closing file channel!", e)
}
} }
if (raf != null) { if (raf != null) {
try { try {
@ -305,7 +307,6 @@ class ChunkedFileUploader(
} }
private fun assembleChunks(uploadFolderUri: String, targetPath: String) { private fun assembleChunks(uploadFolderUri: String, targetPath: String) {
val destinationUri: String = ApiUtils.getUrlForFileUpload( val destinationUri: String = ApiUtils.getUrlForFileUpload(
currentUser.baseUrl, currentUser.baseUrl,
currentUser.userId, currentUser.userId,

View File

@ -45,7 +45,7 @@ class DateUtils(val context: Context) {
} else { } else {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
context.resources.configuration.locale context.resources.configuration.locale
}, }
) )
/* date formatter in local timezone and locale */ /* date formatter in local timezone and locale */
@ -56,7 +56,7 @@ class DateUtils(val context: Context) {
} else { } else {
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
context.resources.configuration.locale context.resources.configuration.locale
}, }
) )
init { init {

View File

@ -40,7 +40,6 @@ object DoNotDisturbUtils {
@SuppressLint("NewApi") @SuppressLint("NewApi")
@JvmOverloads @JvmOverloads
fun shouldPlaySound(context: Context? = NextcloudTalkApplication.sharedApplication?.applicationContext): Boolean { fun shouldPlaySound(context: Context? = NextcloudTalkApplication.sharedApplication?.applicationContext): Boolean {
val notificationManager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val notificationManager = context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager

View File

@ -47,7 +47,7 @@ open class FileSortOrder(var name: String, var isAscending: Boolean) {
sort_old_to_new.name to sort_old_to_new, sort_old_to_new.name to sort_old_to_new,
sort_new_to_old.name to sort_new_to_old, sort_new_to_old.name to sort_new_to_old,
sort_small_to_big.name to sort_small_to_big, sort_small_to_big.name to sort_small_to_big,
sort_big_to_small.name to sort_big_to_small, sort_big_to_small.name to sort_big_to_small
) )
fun getFileSortOrder(key: String?): FileSortOrder { fun getFileSortOrder(key: String?): FileSortOrder {

View File

@ -48,7 +48,6 @@ class ImageEmojiEditText : EmojiEditText {
@Suppress("Detekt.TooGenericExceptionCaught") @Suppress("Detekt.TooGenericExceptionCaught")
override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection? { override fun onCreateInputConnection(editorInfo: EditorInfo): InputConnection? {
val ic: InputConnection? = super.onCreateInputConnection(editorInfo) val ic: InputConnection? = super.onCreateInputConnection(editorInfo)
EditorInfoCompat.setContentMimeTypes(editorInfo, arrayOf(IMAGE_GIF, IMAGE_JPEG, IMAGE_PNG)) EditorInfoCompat.setContentMimeTypes(editorInfo, arrayOf(IMAGE_GIF, IMAGE_JPEG, IMAGE_PNG))

View File

@ -74,7 +74,6 @@ object NotificationUtils {
sound: Uri?, sound: Uri?,
audioAttributes: AudioAttributes? audioAttributes: AudioAttributes?
) { ) {
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
if ( if (
@ -278,7 +277,6 @@ object NotificationUtils {
context: Context?, context: Context?,
notificationId: Int notificationId: Int
): Boolean { ): Boolean {
var isVisible = false var isVisible = false
val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
@ -326,7 +324,8 @@ object NotificationUtils {
return getRingtoneUri( return getRingtoneUri(
context, context,
appPreferences.callRingtoneUri, appPreferences.callRingtoneUri,
DEFAULT_CALL_RINGTONE_URI, NotificationChannels.NOTIFICATION_CHANNEL_CALLS_V4.name DEFAULT_CALL_RINGTONE_URI,
NotificationChannels.NOTIFICATION_CHANNEL_CALLS_V4.name
) )
} }
@ -337,7 +336,8 @@ object NotificationUtils {
return getRingtoneUri( return getRingtoneUri(
context, context,
appPreferences.messageRingtoneUri, appPreferences.messageRingtoneUri,
DEFAULT_MESSAGE_RINGTONE_URI, NotificationChannels.NOTIFICATION_CHANNEL_MESSAGES_V4.name DEFAULT_MESSAGE_RINGTONE_URI,
NotificationChannels.NOTIFICATION_CHANNEL_MESSAGES_V4.name
) )
} }

View File

@ -40,7 +40,7 @@ object RemoteFileUtils {
val fileExists = doesFileExist( val fileExists = doesFileExist(
ncApi, ncApi,
currentUser, currentUser,
remotePath, remotePath
).blockingFirst() ).blockingFirst()
if (fileExists) { if (fileExists) {

View File

@ -63,36 +63,41 @@ class SSLSocketFactoryCompat(
override fun createSocket(s: Socket, host: String, port: Int, autoClose: Boolean): Socket { override fun createSocket(s: Socket, host: String, port: Int, autoClose: Boolean): Socket {
val ssl = delegate.createSocket(s, host, port, autoClose) val ssl = delegate.createSocket(s, host, port, autoClose)
if (ssl is SSLSocket) if (ssl is SSLSocket) {
upgradeTLS(ssl) upgradeTLS(ssl)
}
return ssl return ssl
} }
override fun createSocket(host: String, port: Int): Socket { override fun createSocket(host: String, port: Int): Socket {
val ssl = delegate.createSocket(host, port) val ssl = delegate.createSocket(host, port)
if (ssl is SSLSocket) if (ssl is SSLSocket) {
upgradeTLS(ssl) upgradeTLS(ssl)
}
return ssl return ssl
} }
override fun createSocket(host: String, port: Int, localHost: InetAddress, localPort: Int): Socket { override fun createSocket(host: String, port: Int, localHost: InetAddress, localPort: Int): Socket {
val ssl = delegate.createSocket(host, port, localHost, localPort) val ssl = delegate.createSocket(host, port, localHost, localPort)
if (ssl is SSLSocket) if (ssl is SSLSocket) {
upgradeTLS(ssl) upgradeTLS(ssl)
}
return ssl return ssl
} }
override fun createSocket(host: InetAddress, port: Int): Socket { override fun createSocket(host: InetAddress, port: Int): Socket {
val ssl = delegate.createSocket(host, port) val ssl = delegate.createSocket(host, port)
if (ssl is SSLSocket) if (ssl is SSLSocket) {
upgradeTLS(ssl) upgradeTLS(ssl)
}
return ssl return ssl
} }
override fun createSocket(address: InetAddress, port: Int, localAddress: InetAddress, localPort: Int): Socket { override fun createSocket(address: InetAddress, port: Int, localAddress: InetAddress, localPort: Int): Socket {
val ssl = delegate.createSocket(address, port, localAddress, localPort) val ssl = delegate.createSocket(address, port, localAddress, localPort)
if (ssl is SSLSocket) if (ssl is SSLSocket) {
upgradeTLS(ssl) upgradeTLS(ssl)
}
return ssl return ssl
} }

View File

@ -31,7 +31,6 @@ class ParticipantPermissionsTest : TestCase() {
@Test @Test
fun test_areFlagsSet() { fun test_areFlagsSet() {
val user = User() val user = User()
val conversation = Conversation() val conversation = Conversation()
conversation.permissions = ParticipantPermissions.PUBLISH_SCREEN or conversation.permissions = ParticipantPermissions.PUBLISH_SCREEN or

View File

@ -68,7 +68,8 @@ class ShareUtilsTest {
fun stringForIntent_noPasswordGiven_correctStringWithoutPasswordReturned() { fun stringForIntent_noPasswordGiven_correctStringWithoutPasswordReturned() {
val expectedResult = String.format( val expectedResult = String.format(
"Join the conversation at %s/index.php/call/%s", "Join the conversation at %s/index.php/call/%s",
baseUrl, token baseUrl,
token
) )
Assert.assertEquals( Assert.assertEquals(
"Intent string was not as expected", "Intent string was not as expected",

View File

@ -39,7 +39,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}" classpath "org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}"
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.13' classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.13'
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0" classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0"
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.1.0" classpath "org.jlleitschuh.gradle:ktlint-gradle:11.2.0"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files