Skip to content

Commit

Permalink
Merge pull request #3496 from nextcloud/dependabot/gradle/org.jlleits…
Browse files Browse the repository at this point in the history
…chuh.gradle-ktlint-gradle-12.0.2

Build(deps): Bump org.jlleitschuh.gradle:ktlint-gradle from 11.6.1 to 12.0.2
  • Loading branch information
AndyScherzinger authored Dec 5, 2023
2 parents 5cfc7a7 + 503a4f5 commit 6ea7005
Show file tree
Hide file tree
Showing 75 changed files with 499 additions and 649 deletions.
9 changes: 8 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@ indent_size=2

[*.{kt,kts}]
# IDE does not follow this Ktlint rule strictly, but the default ordering is pretty good anyway, so let's ditch it
ktlint_disabled_rules=import-ordering
ktlint_code_style = android_studio
insert_final_newline = true
ktlint_function_signature_rule_force_multiline_when_parameter_count_greater_or_equal_than=unset
ktlint_function_signature_body_expression_wrapping=multiline
ktlint_standard_import-ordering = disabled
ktlint_standard_wrapping = enabled
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ android {

buildFeatures {
viewBinding true
buildConfig = true
}

lint {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ class ShareUtilsIT {
return DateUtils.parseDate(
dateStr, Locale.US,
HttpUtils.httpDateFormatStr,
"EEE, dd MMM yyyy HH:mm:ss zzz", // RFC 822, updated by RFC 1123 with any TZ
"EEEE, dd-MMM-yy HH:mm:ss zzz", // RFC 850, obsoleted by RFC 1036 with any TZ.
"EEE MMM d HH:mm:ss yyyy", // ANSI C's asctime() format
// RFC 822, updated by RFC 1123 with any TZ
"EEE, dd MMM yyyy HH:mm:ss zzz",
// RFC 850, obsoleted by RFC 1036 with any TZ.
"EEEE, dd-MMM-yy HH:mm:ss zzz",
// ANSI C's asctime() format
"EEE MMM d HH:mm:ss yyyy",
// Alternative formats.
"EEE, dd-MMM-yyyy HH:mm:ss z",
"EEE, dd-MMM-yyyy HH-mm-ss z",
Expand All @@ -35,7 +38,7 @@ class ShareUtilsIT {
"EEE,dd-MMM-yy HH:mm:ss z",
"EEE,dd-MMM-yyyy HH:mm:ss z",
"EEE, dd-MM-yyyy HH:mm:ss z",
/* RI bug 6641315 claims a cookie of this format was once served by www.yahoo.com */
// RI bug 6641315 claims a cookie of this format was once served by www.yahoo.com
"EEE MMM d yyyy HH:mm:ss z"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ import javax.inject.Inject
open class BaseActivity : AppCompatActivity() {

enum class AppBarLayoutType {
TOOLBAR, SEARCH_BAR, EMPTY
TOOLBAR,
SEARCH_BAR,
EMPTY
}

@Inject
Expand Down
16 changes: 3 additions & 13 deletions app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1050,10 +1050,7 @@ class CallActivity : CallBaseActivity() {
private val isConnectionEstablished: Boolean
get() = currentCallStatus === CallStatus.JOINED || currentCallStatus === CallStatus.IN_CONVERSATION

private fun onAudioManagerDevicesChanged(
currentDevice: AudioDevice,
availableDevices: Set<AudioDevice>
) {
private fun onAudioManagerDevicesChanged(currentDevice: AudioDevice, availableDevices: Set<AudioDevice>) {
Log.d(TAG, "onAudioManagerDevicesChanged: $availableDevices, currentDevice: $currentDevice")
val shouldDisableProximityLock =
currentDevice == AudioDevice.WIRED_HEADSET ||
Expand Down Expand Up @@ -1529,10 +1526,7 @@ class CallActivity : CallBaseActivity() {
})
}

private fun addIceServers(
signalingSettingsOverall: SignalingSettingsOverall,
apiVersion: Int
) {
private fun addIceServers(signalingSettingsOverall: SignalingSettingsOverall, apiVersion: Int) {
if (signalingSettingsOverall.ocs!!.settings!!.stunServers != null) {
val stunServers = signalingSettingsOverall.ocs!!.settings!!.stunServers
if (apiVersion == ApiUtils.APIv3) {
Expand Down Expand Up @@ -3035,11 +3029,7 @@ class CallActivity : CallBaseActivity() {
}
}

private fun updatePictureInPictureActions(
@DrawableRes iconId: Int,
title: String?,
requestCode: Int
) {
private fun updatePictureInPictureActions(@DrawableRes iconId: Int, title: String?, requestCode: Int) {
if (isGreaterEqualOreo && isPipModePossible) {
val actions = ArrayList<RemoteAction>()
val icon = Icon.createWithResource(this, iconId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ import kotlinx.parcelize.Parcelize

@Parcelize
enum class CallStatus : Parcelable {
CONNECTING, CALLING_TIMEOUT, JOINED, IN_CONVERSATION, RECONNECTING, OFFLINE, LEAVING, PUBLISHER_FAILED
CONNECTING,
CALLING_TIMEOUT,
JOINED,
IN_CONVERSATION,
RECONNECTING,
OFFLINE,
LEAVING,
PUBLISHER_FAILED
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ class ConversationItem(
}
}

private fun shouldLoadAvatar(
holder: ConversationItemViewHolder
): Boolean {
private fun shouldLoadAvatar(holder: ConversationItemViewHolder): Boolean {
return when (model.objectType) {
Conversation.ObjectType.SHARE_PASSWORD -> {
holder.binding.dialogAvatar.setImageDrawable(
Expand Down Expand Up @@ -237,10 +235,7 @@ class ConversationItem(
}
}

private fun setLastMessage(
holder: ConversationItemViewHolder,
appContext: Context
) {
private fun setLastMessage(holder: ConversationItemViewHolder, appContext: Context) {
if (model.lastMessage != null) {
holder.binding.dialogDate.visibility = View.VISIBLE
holder.binding.dialogDate.text = DateUtils.getRelativeTimeSpanString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ data class MessageResultItem constructor(
const val VIEW_TYPE = FlexibleItemViewType.MESSAGE_RESULT_ITEM
}

override fun getHeader(): GenericTextHeaderItem = MessagesTextHeaderItem(context, viewThemeUtils)
.apply {
isHidden = showHeader // FlexibleAdapter needs this hack for some reason
}
override fun getHeader(): GenericTextHeaderItem =
MessagesTextHeaderItem(context, viewThemeUtils)
.apply {
isHidden = showHeader // FlexibleAdapter needs this hack for some reason
}

override fun setHeader(header: GenericTextHeaderItem?) {
// nothing, header is always the same
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ class CallStartedViewHolder(incomingView: View, payload: Any) :
}

companion object {
var TAG: String? = CallStartedViewHolder::class.simpleName
val TAG: String? = CallStartedViewHolder::class.simpleName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ import io.reactivex.schedulers.Schedulers

class LinkPreview {

fun showLink(
message: ChatMessage,
ncApi: NcApi,
binding: ReferenceInsideMessageBinding,
context: Context
) {
fun showLink(message: ChatMessage, ncApi: NcApi, binding: ReferenceInsideMessageBinding, context: Context) {
binding.referenceName.text = ""
binding.referenceDescription.text = ""
binding.referenceLink.text = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
}
}

override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): ListItemViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListItemViewHolder {
val listItemView: View = parent.inflate(dialog.windowContext, R.layout.menu_item_sheet)
val viewHolder = ListItemViewHolder(
itemView = listItemView,
Expand All @@ -94,10 +91,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(

override fun getItemCount() = items.size

override fun onBindViewHolder(
holder: ListItemViewHolder,
position: Int
) {
override fun onBindViewHolder(holder: ListItemViewHolder, position: Int) {
holder.itemView.isEnabled = !disabledIndices.contains(position)
val currentItem = items[position]

Expand All @@ -120,10 +114,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
}
}

override fun replaceItems(
items: List<IT>,
listener: ListItemListener<IT>
) {
override fun replaceItems(items: List<IT>, listener: ListItemListener<IT>) {
this.items = items
if (listener != null) {
this.selection = listener
Expand Down
9 changes: 2 additions & 7 deletions app/src/main/java/com/nextcloud/talk/call/ReactionAnimator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ class ReactionAnimator(
) {
private val reactionsList: MutableList<CallReaction> = ArrayList()

fun addReaction(
emoji: String,
displayName: String
) {
fun addReaction(emoji: String, displayName: String) {
val callReaction = CallReaction(emoji, displayName)
reactionsList.add(callReaction)

Expand All @@ -58,9 +55,7 @@ class ReactionAnimator(
}
}

private fun animateReaction(
callReaction: CallReaction
) {
private fun animateReaction(callReaction: CallReaction) {
val reactionWrapper = getReactionWrapperView(callReaction)

val params = RelativeLayout.LayoutParams(
Expand Down
50 changes: 23 additions & 27 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,13 @@ class ChatActivity :

private var recorder: MediaRecorder? = null
private enum class MediaRecorderState {
INITIAL, INITIALIZED, CONFIGURED, PREPARED, RECORDING, RELEASED, ERROR
INITIAL,
INITIALIZED,
CONFIGURED,
PREPARED,
RECORDING,
RELEASED,
ERROR
}
private var mediaRecorderState: MediaRecorderState = MediaRecorderState.INITIAL

Expand Down Expand Up @@ -1708,14 +1714,17 @@ class ChatActivity :
}
}

fun isOneToOneConversation() = currentConversation != null && currentConversation?.type != null &&
currentConversation?.type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
fun isOneToOneConversation() =
currentConversation != null && currentConversation?.type != null &&
currentConversation?.type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL

private fun isGroupConversation() = currentConversation != null && currentConversation?.type != null &&
currentConversation?.type == ConversationType.ROOM_GROUP_CALL
private fun isGroupConversation() =
currentConversation != null && currentConversation?.type != null &&
currentConversation?.type == ConversationType.ROOM_GROUP_CALL

private fun isPublicConversation() = currentConversation != null && currentConversation?.type != null &&
currentConversation?.type == ConversationType.ROOM_PUBLIC_CALL
private fun isPublicConversation() =
currentConversation != null && currentConversation?.type != null &&
currentConversation?.type == ConversationType.ROOM_PUBLIC_CALL

private fun switchToRoom(token: String, startCallAfterRoomSwitch: Boolean, isVoiceOnlyCall: Boolean) {
if (conversationUser != null) {
Expand Down Expand Up @@ -2973,9 +2982,7 @@ class ChatActivity :
}
}

fun leaveRoom(
funToCallWhenLeaveSuccessful: (() -> Unit)?
) {
fun leaveRoom(funToCallWhenLeaveSuccessful: (() -> Unit)?) {
logConversationInfos("leaveRoom")

var apiVersion = 1
Expand Down Expand Up @@ -3141,11 +3148,7 @@ class ChatActivity :
signalingMessageSender = webSocketInstance?.signalingMessageSender
}

fun pullChatMessages(
lookIntoFuture: Boolean,
setReadMarker: Boolean = true,
xChatLastCommonRead: Int? = null
) {
fun pullChatMessages(lookIntoFuture: Boolean, setReadMarker: Boolean = true, xChatLastCommonRead: Int? = null) {
if (!validSessionId()) {
return
}
Expand Down Expand Up @@ -3465,10 +3468,7 @@ class ChatActivity :
}
}

private fun addMessagesToAdapter(
shouldAddNewMessagesNotice: Boolean,
chatMessageList: List<ChatMessage>
) {
private fun addMessagesToAdapter(shouldAddNewMessagesNotice: Boolean, chatMessageList: List<ChatMessage>) {
val isThereANewNotice =
shouldAddNewMessagesNotice || adapter?.getMessagePositionByIdInReverse("-1") != -1
for (chatMessage in chatMessageList) {
Expand Down Expand Up @@ -3721,19 +3721,15 @@ class ChatActivity :
chatMessageMap[currentMessage.value.parentMessage!!.id]!!.isDeleted = true
}
chatMessageIterator.remove()
}

// delete reactions system messages
else if (isReactionsMessage(currentMessage)) {
} else if (isReactionsMessage(currentMessage)) {
// delete reactions system messages
if (!chatMessageMap.containsKey(currentMessage.value.parentMessage!!.id)) {
updateAdapterForReaction(currentMessage.value.parentMessage)
}

chatMessageIterator.remove()
}

// delete poll system messages
else if (isPollVotedMessage(currentMessage)) {
} else if (isPollVotedMessage(currentMessage)) {
// delete poll system messages
chatMessageIterator.remove()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ import com.nextcloud.talk.utils.ApiUtils
import io.reactivex.Observable

class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
override fun getRoom(
user: User,
roomToken: String
): Observable<ConversationModel> {
override fun getRoom(user: User, roomToken: String): Observable<ConversationModel> {
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv3, 1))

Expand All @@ -42,11 +39,7 @@ class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
).map { ConversationModel.mapToConversationModel(it.ocs?.data!!) }
}

override fun joinRoom(
user: User,
roomToken: String,
roomPassword: String
): Observable<ConversationModel> {
override fun joinRoom(user: User, roomToken: String, roomPassword: String): Observable<ConversationModel> {
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, 1))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ import io.reactivex.Observable

interface ConversationRepository {

fun renameConversation(
roomToken: String,
roomNameNew: String
): Observable<GenericOverall>
fun renameConversation(roomToken: String, roomNameNew: String): Observable<GenericOverall>

fun createConversation(
roomName: String,
conversationType: Conversation.ConversationType?
): Observable<RoomOverall>
fun createConversation(roomName: String, conversationType: Conversation.ConversationType?): Observable<RoomOverall>
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ class ConversationRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
val currentUser: User = currentUserProvider.currentUser.blockingGet()
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)

override fun renameConversation(
roomToken: String,
roomNameNew: String
): Observable<GenericOverall> {
override fun renameConversation(roomToken: String, roomNameNew: String): Observable<GenericOverall> {
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))

return ncApi.renameRoom(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ class ConversationViewModel @Inject constructor(private val repository: Conversa
disposable?.dispose()
}

fun createConversation(
roomName: String,
conversationType: Conversation.ConversationType?
) {
fun createConversation(roomName: String, conversationType: Conversation.ConversationType?) {
_viewState.value = CreatingState

repository.createConversation(
Expand Down
Loading

0 comments on commit 6ea7005

Please sign in to comment.