srctree

Robin Linden parent f6962972 96c0f8a7
Update ktlint

inlinesplit
.editorconfig added: 25, removed: 17, total 8
@@ -24,4 +24,4 @@ insert_final_newline = false
# Extensions.kt: We don't want 1 file per extension, or to rename the file when we have 1 extension.
# ToxSaveTester.kt: Named after the testToxSave-function it contains. ktlint wants it to be named after the enum it returns.
[{domain/src/main/kotlin/Extensions.kt,domain/src/main/kotlin/tox/ToxSaveTester.kt}]
disabled_rules=filename
ktlint_disabled_rules=filename
 
.github/workflows/ci.yaml added: 25, removed: 17, total 8
@@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.46.1/ktlint && chmod a+x ktlint
- run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.47.1/ktlint && chmod a+x ktlint
- run: ./ktlint --android
 
gradle-wrapper-validation:
 
atox/src/main/kotlin/ui/AvatarImageView.kt added: 25, removed: 17, total 8
@@ -38,7 +38,9 @@ class AvatarImageView @JvmOverloads constructor(context: Context, attrs: Attribu
private fun colorByContactStatus(context: Context, contact: Contact) =
if (contact.connectionStatus == ConnectionStatus.None) {
ContextCompat.getColor(context, R.color.statusOffline)
} else colorFromStatus(context, contact.status)
} else {
colorFromStatus(context, contact.status)
}
 
private var name = ""
private var publicKey = ""
 
atox/src/main/kotlin/ui/NotificationHelper.kt added: 25, removed: 17, total 8
@@ -122,7 +122,9 @@ class NotificationHelper @Inject constructor(
Log.e(TAG, "Unable to load bmp for ${contact.name} from ${contact.avatarUri}")
null
}
} else null
} else {
null
}
 
val chatPartner = Person.Builder()
.setName(contact.name.ifEmpty { context.getText(R.string.contact_default_name) })
 
atox/src/main/kotlin/ui/contactlist/ContactAdapter.kt added: 25, removed: 17, total 8
@@ -22,7 +22,7 @@ import java.text.DateFormat
 
enum class ContactListItemType {
FriendRequest,
Contact
Contact,
}
 
private val types = ContactListItemType.values()
 
atox/src/main/kotlin/ui/contactlist/ContactListFragment.kt added: 25, removed: 17, total 8
@@ -340,7 +340,9 @@ class ContactListFragment :
)
addView(passwordEdit)
}
} else null
} else {
null
}
passwordDialog = AlertDialog.Builder(requireContext())
.setTitle(getString(R.string.unlock_profile))
.setView(passwordLayout ?: passwordEdit)
 
core/src/main/kotlin/vo/Message.kt added: 25, removed: 17, total 8
@@ -16,7 +16,7 @@ enum class Sender {
enum class MessageType {
Normal,
Action,
FileTransfer
FileTransfer,
}
 
@Entity(tableName = "messages")
 
domain/src/main/kotlin/feature/ChatManager.kt added: 25, removed: 17, total 8
@@ -50,8 +50,10 @@ class ChatManager @Inject constructor(
var activeChat = ""
set(value) {
field = value
if (value.isNotEmpty()) scope.launch {
contactRepository.setHasUnreadMessages(value, false)
if (value.isNotEmpty()) {
scope.launch {
contactRepository.setHasUnreadMessages(value, false)
}
}
}