Merge pull request #2984 from element-hq/feature/bma/incomingShare
Incoming share
This commit is contained in:
commit
d06656d6bf
44 changed files with 1245 additions and 9 deletions
|
|
@ -16,10 +16,22 @@
|
|||
|
||||
package io.element.android.libraries.androidutils.compat
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.ResolveInfo
|
||||
import android.os.Build
|
||||
|
||||
fun PackageManager.queryIntentActivitiesCompat(data: Intent, flags: Int): List<ResolveInfo> {
|
||||
return when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> queryIntentActivities(
|
||||
data,
|
||||
PackageManager.ResolveInfoFlags.of(flags.toLong())
|
||||
)
|
||||
else -> @Suppress("DEPRECATION") queryIntentActivities(data, flags)
|
||||
}
|
||||
}
|
||||
|
||||
fun PackageManager.getApplicationInfoCompat(packageName: String, flags: Int): ApplicationInfo {
|
||||
return when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getApplicationInfo(
|
||||
|
|
|
|||
|
|
@ -96,4 +96,11 @@ enum class FeatureFlags(
|
|||
defaultValue = true,
|
||||
isFinished = false,
|
||||
),
|
||||
IncomingShare(
|
||||
key = "feature.incomingShare",
|
||||
title = "Incoming Share support",
|
||||
description = "Allow the application to receive data from other applications",
|
||||
defaultValue = true,
|
||||
isFinished = false,
|
||||
),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class StaticFeatureFlagProvider @Inject constructor() :
|
|||
FeatureFlags.RoomDirectorySearch -> false
|
||||
FeatureFlags.ShowBlockedUsersDetails -> false
|
||||
FeatureFlags.QrCodeLogin -> OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE
|
||||
FeatureFlags.IncomingShare -> true
|
||||
}
|
||||
} else {
|
||||
false
|
||||
|
|
|
|||
|
|
@ -18,4 +18,5 @@ package io.element.android.libraries.roomselect.api
|
|||
|
||||
enum class RoomSelectMode {
|
||||
Forward,
|
||||
Share,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,29 +31,33 @@ open class RoomSelectStateProvider : PreviewParameterProvider<RoomSelectState> {
|
|||
get() = sequenceOf(
|
||||
aRoomSelectState(),
|
||||
aRoomSelectState(query = "Test", isSearchActive = true),
|
||||
aRoomSelectState(resultState = SearchBarResultState.Results(aForwardMessagesRoomList())),
|
||||
aRoomSelectState(resultState = SearchBarResultState.Results(aRoomSelectRoomList())),
|
||||
aRoomSelectState(
|
||||
resultState = SearchBarResultState.Results(aForwardMessagesRoomList()),
|
||||
resultState = SearchBarResultState.Results(aRoomSelectRoomList()),
|
||||
query = "Test",
|
||||
isSearchActive = true,
|
||||
),
|
||||
aRoomSelectState(
|
||||
resultState = SearchBarResultState.Results(aForwardMessagesRoomList()),
|
||||
resultState = SearchBarResultState.Results(aRoomSelectRoomList()),
|
||||
query = "Test",
|
||||
isSearchActive = true,
|
||||
selectedRooms = persistentListOf(aRoomSummaryDetails(roomId = RoomId("!room2:domain")))
|
||||
),
|
||||
// Add other states here
|
||||
aRoomSelectState(
|
||||
mode = RoomSelectMode.Share,
|
||||
resultState = SearchBarResultState.Results(aRoomSelectRoomList()),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun aRoomSelectState(
|
||||
mode: RoomSelectMode = RoomSelectMode.Forward,
|
||||
resultState: SearchBarResultState<ImmutableList<RoomSummaryDetails>> = SearchBarResultState.Initial(),
|
||||
query: String = "",
|
||||
isSearchActive: Boolean = false,
|
||||
selectedRooms: ImmutableList<RoomSummaryDetails> = persistentListOf(),
|
||||
) = RoomSelectState(
|
||||
mode = RoomSelectMode.Forward,
|
||||
mode = mode,
|
||||
resultState = resultState,
|
||||
query = query,
|
||||
isSearchActive = isSearchActive,
|
||||
|
|
@ -61,7 +65,7 @@ private fun aRoomSelectState(
|
|||
eventSink = {}
|
||||
)
|
||||
|
||||
private fun aForwardMessagesRoomList() = persistentListOf(
|
||||
private fun aRoomSelectRoomList() = persistentListOf(
|
||||
aRoomSummaryDetails(),
|
||||
aRoomSummaryDetails(
|
||||
roomId = RoomId("!room2:domain"),
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ fun RoomSelectView(
|
|||
Text(
|
||||
text = when (state.mode) {
|
||||
RoomSelectMode.Forward -> stringResource(CommonStrings.common_forward_message)
|
||||
RoomSelectMode.Share -> stringResource(CommonStrings.common_send_to)
|
||||
},
|
||||
style = ElementTheme.typography.aliasScreenTitle
|
||||
)
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@
|
|||
<string name="common_search_results">"Search results"</string>
|
||||
<string name="common_security">"Security"</string>
|
||||
<string name="common_seen_by">"Seen by"</string>
|
||||
<string name="common_send_to">"Send to"</string>
|
||||
<string name="common_sending">"Sending…"</string>
|
||||
<string name="common_sending_failed">"Sending failed"</string>
|
||||
<string name="common_sent">"Sent"</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue