Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build(deps): Bump org.jlleitschuh.gradle:ktlint-gradle from 11.6.1 to 12.0.2 #3496

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
794fdb0
Build(deps): Bump org.jlleitschuh.gradle:ktlint-gradle
dependabot[bot] Dec 4, 2023
cc40db0
add new ktlint config params
AndyScherzinger Dec 4, 2023
cc559d9
adapt editorconfig to latest ktlint release
AndyScherzinger Dec 5, 2023
3a6e18c
reformat test code for latest ktlint release
AndyScherzinger Dec 5, 2023
f2b86a9
ktlint: Enum entry should start on a separate line
AndyScherzinger Dec 5, 2023
627e9d5
ktlint: No whitespace expected between opening parenthesis and first …
AndyScherzinger Dec 5, 2023
88970c5
ktlint: Newline expected before expression body
AndyScherzinger Dec 5, 2023
f2da9b9
ktlint: First line of body expression fits on same line as function s…
AndyScherzinger Dec 5, 2023
ae9c092
ktlint: A comment in a 'value_argument_list' is only allowed when pla…
AndyScherzinger Dec 5, 2023
29db97c
ktlint: Missing newline before/after '{'
AndyScherzinger Dec 5, 2023
59e8f4b
ktlint: No comment expected at this location
AndyScherzinger Dec 5, 2023
67b2752
ktlint: Expected a single space
AndyScherzinger Dec 5, 2023
9395a35
ktlint: Newline expected after opening parenthesis
AndyScherzinger Dec 5, 2023
d7f8d1e
ktlint: Single space expected between colon and return type
AndyScherzinger Dec 5, 2023
3f91196
ktlint: Property name should start with a lowercase letter and use ca…
AndyScherzinger Dec 5, 2023
565d0cf
ktlint: statement fits in a single line
AndyScherzinger Dec 5, 2023
5356edf
ktlint: Empty parentheses in function call followed by lambda are unn…
AndyScherzinger Dec 5, 2023
12a1b7e
ktlint: Property name should use the screaming snake case notation wh…
AndyScherzinger Dec 5, 2023
503a4f5
migrate to new buildConfig flag
AndyScherzinger Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading