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 /tmp
ktlint ktlint
.idea/copyright/New_vector.xml
.idea/copyright/profiles_settings.xml

View file

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

View file

@ -80,18 +80,18 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity android:name=".features.share.IncomingShareActivity">
android:name=".features.share.IncomingShareActivity"
android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND"/> <action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*"/> <data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" /> <category android:name="android.intent.category.OPENABLE" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE"/> <action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*"/> <data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" /> <category android:name="android.intent.category.OPENABLE" />
</intent-filter> </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 package im.vector.riotx
import arrow.core.Option import arrow.core.Option

View file

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

View file

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

View file

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

View file

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