Clean some code

This commit is contained in:
ganfra 2019-10-21 18:08:42 +02:00
parent 9e436483de
commit 8e3234d188
8 changed files with 38 additions and 21 deletions

2
.gitignore vendored
View File

@ -14,3 +14,5 @@
/tmp
ktlint
.idea/copyright/New_vector.xml
.idea/copyright/profiles_settings.xml

View File

@ -8,7 +8,8 @@ Improvements:
- Persist active tab between sessions (#503)
- Do not upload file too big for the homeserver (#587)
- Handle read markers (#84)
- Attachments: start using system pickers
- Attachments: start using system pickers (#52)
- Attachments: start handling incoming share (#58)
Other changes:
- Accessibility improvements to read receipts in the room timeline and reactions emoji chooser

View File

@ -80,18 +80,18 @@
</intent-filter>
</activity>
<activity
android:name=".features.share.IncomingShareActivity"
android:screenOrientation="portrait">
<activity android:name=".features.share.IncomingShareActivity">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="*/*"/>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<data android:mimeType="*/*"/>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
</intent-filter>

View File

@ -1,3 +1,20 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package im.vector.riotx
import arrow.core.Option

View File

@ -28,10 +28,11 @@ data class ContactAttachment(
) {
fun toHumanReadable(): String {
val stringBuilder = StringBuilder(displayName)
phones.concatIn(stringBuilder)
emails.concatIn(stringBuilder)
return stringBuilder.toString()
return buildString {
append(displayName)
phones.concatIn(this)
emails.concatIn(this)
}
}
private fun List<String>.concatIn(stringBuilder: StringBuilder) {

View File

@ -1126,6 +1126,7 @@ class RoomDetailFragment :
}
override fun onContactAttachmentReady(contactAttachment: ContactAttachment) {
super.onContactAttachmentReady(contactAttachment)
val formattedContact = contactAttachment.toHumanReadable()
roomDetailViewModel.process(RoomDetailActions.SendMessage(formattedContact, false))
}

View File

@ -69,10 +69,10 @@ class IncomingShareActivity :
isShareManaged = handleTextShare(intent)
}
if (!isShareManaged) {
cannottManageShare()
cannotManageShare()
}
} else {
cannottManageShare()
cannotManageShare()
}
}
@ -83,10 +83,10 @@ class IncomingShareActivity :
}
override fun onAttachmentsProcessFailed() {
cannottManageShare()
cannotManageShare()
}
private fun cannottManageShare() {
private fun cannotManageShare() {
Toast.makeText(this, R.string.error_handling_incoming_share, Toast.LENGTH_LONG).show()
finish()
}

View File

@ -3,9 +3,4 @@
<cache-path
name="shared"
path="/" />
<external-path
name="external_files"
path="." />
</paths>