mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-24 22:19:59 +01:00
Merge pull request #3496 from nextcloud/dependabot/gradle/org.jlleitschuh.gradle-ktlint-gradle-12.0.2
Build(deps): Bump org.jlleitschuh.gradle:ktlint-gradle from 11.6.1 to 12.0.2
This commit is contained in:
commit
6ea70058fd
@ -38,4 +38,11 @@ indent_size=2
|
|||||||
|
|
||||||
[*.{kt,kts}]
|
[*.{kt,kts}]
|
||||||
# IDE does not follow this Ktlint rule strictly, but the default ordering is pretty good anyway, so let's ditch it
|
# 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
|
||||||
|
@ -129,6 +129,7 @@ android {
|
|||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding true
|
viewBinding true
|
||||||
|
buildConfig = true
|
||||||
}
|
}
|
||||||
|
|
||||||
lint {
|
lint {
|
||||||
|
@ -20,9 +20,12 @@ class ShareUtilsIT {
|
|||||||
return DateUtils.parseDate(
|
return DateUtils.parseDate(
|
||||||
dateStr, Locale.US,
|
dateStr, Locale.US,
|
||||||
HttpUtils.httpDateFormatStr,
|
HttpUtils.httpDateFormatStr,
|
||||||
"EEE, dd MMM yyyy HH:mm:ss zzz", // RFC 822, updated by RFC 1123 with any TZ
|
// 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, dd MMM yyyy HH:mm:ss zzz",
|
||||||
"EEE MMM d HH:mm:ss yyyy", // ANSI C's asctime() format
|
// 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.
|
// Alternative formats.
|
||||||
"EEE, dd-MMM-yyyy HH:mm:ss z",
|
"EEE, dd-MMM-yyyy HH:mm:ss z",
|
||||||
"EEE, dd-MMM-yyyy HH-mm-ss z",
|
"EEE, dd-MMM-yyyy HH-mm-ss z",
|
||||||
@ -35,7 +38,7 @@ class ShareUtilsIT {
|
|||||||
"EEE,dd-MMM-yy HH:mm:ss z",
|
"EEE,dd-MMM-yy HH:mm:ss z",
|
||||||
"EEE,dd-MMM-yyyy HH:mm:ss z",
|
"EEE,dd-MMM-yyyy HH:mm:ss z",
|
||||||
"EEE, dd-MM-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"
|
"EEE MMM d yyyy HH:mm:ss z"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,9 @@ import javax.inject.Inject
|
|||||||
open class BaseActivity : AppCompatActivity() {
|
open class BaseActivity : AppCompatActivity() {
|
||||||
|
|
||||||
enum class AppBarLayoutType {
|
enum class AppBarLayoutType {
|
||||||
TOOLBAR, SEARCH_BAR, EMPTY
|
TOOLBAR,
|
||||||
|
SEARCH_BAR,
|
||||||
|
EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -1050,10 +1050,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
private val isConnectionEstablished: Boolean
|
private val isConnectionEstablished: Boolean
|
||||||
get() = currentCallStatus === CallStatus.JOINED || currentCallStatus === CallStatus.IN_CONVERSATION
|
get() = currentCallStatus === CallStatus.JOINED || currentCallStatus === CallStatus.IN_CONVERSATION
|
||||||
|
|
||||||
private fun onAudioManagerDevicesChanged(
|
private fun onAudioManagerDevicesChanged(currentDevice: AudioDevice, availableDevices: Set<AudioDevice>) {
|
||||||
currentDevice: AudioDevice,
|
|
||||||
availableDevices: Set<AudioDevice>
|
|
||||||
) {
|
|
||||||
Log.d(TAG, "onAudioManagerDevicesChanged: $availableDevices, currentDevice: $currentDevice")
|
Log.d(TAG, "onAudioManagerDevicesChanged: $availableDevices, currentDevice: $currentDevice")
|
||||||
val shouldDisableProximityLock =
|
val shouldDisableProximityLock =
|
||||||
currentDevice == AudioDevice.WIRED_HEADSET ||
|
currentDevice == AudioDevice.WIRED_HEADSET ||
|
||||||
@ -1529,10 +1526,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addIceServers(
|
private fun addIceServers(signalingSettingsOverall: SignalingSettingsOverall, apiVersion: Int) {
|
||||||
signalingSettingsOverall: SignalingSettingsOverall,
|
|
||||||
apiVersion: Int
|
|
||||||
) {
|
|
||||||
if (signalingSettingsOverall.ocs!!.settings!!.stunServers != null) {
|
if (signalingSettingsOverall.ocs!!.settings!!.stunServers != null) {
|
||||||
val stunServers = signalingSettingsOverall.ocs!!.settings!!.stunServers
|
val stunServers = signalingSettingsOverall.ocs!!.settings!!.stunServers
|
||||||
if (apiVersion == ApiUtils.APIv3) {
|
if (apiVersion == ApiUtils.APIv3) {
|
||||||
@ -3035,11 +3029,7 @@ class CallActivity : CallBaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePictureInPictureActions(
|
private fun updatePictureInPictureActions(@DrawableRes iconId: Int, title: String?, requestCode: Int) {
|
||||||
@DrawableRes iconId: Int,
|
|
||||||
title: String?,
|
|
||||||
requestCode: Int
|
|
||||||
) {
|
|
||||||
if (isGreaterEqualOreo && isPipModePossible) {
|
if (isGreaterEqualOreo && isPipModePossible) {
|
||||||
val actions = ArrayList<RemoteAction>()
|
val actions = ArrayList<RemoteAction>()
|
||||||
val icon = Icon.createWithResource(this, iconId)
|
val icon = Icon.createWithResource(this, iconId)
|
||||||
|
@ -24,5 +24,12 @@ import kotlinx.parcelize.Parcelize
|
|||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
enum class CallStatus : Parcelable {
|
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
|
||||||
}
|
}
|
||||||
|
@ -203,9 +203,7 @@ class ConversationItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldLoadAvatar(
|
private fun shouldLoadAvatar(holder: ConversationItemViewHolder): Boolean {
|
||||||
holder: ConversationItemViewHolder
|
|
||||||
): Boolean {
|
|
||||||
return when (model.objectType) {
|
return when (model.objectType) {
|
||||||
Conversation.ObjectType.SHARE_PASSWORD -> {
|
Conversation.ObjectType.SHARE_PASSWORD -> {
|
||||||
holder.binding.dialogAvatar.setImageDrawable(
|
holder.binding.dialogAvatar.setImageDrawable(
|
||||||
@ -237,10 +235,7 @@ class ConversationItem(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setLastMessage(
|
private fun setLastMessage(holder: ConversationItemViewHolder, appContext: Context) {
|
||||||
holder: ConversationItemViewHolder,
|
|
||||||
appContext: Context
|
|
||||||
) {
|
|
||||||
if (model.lastMessage != null) {
|
if (model.lastMessage != null) {
|
||||||
holder.binding.dialogDate.visibility = View.VISIBLE
|
holder.binding.dialogDate.visibility = View.VISIBLE
|
||||||
holder.binding.dialogDate.text = DateUtils.getRelativeTimeSpanString(
|
holder.binding.dialogDate.text = DateUtils.getRelativeTimeSpanString(
|
||||||
|
@ -95,7 +95,8 @@ data class MessageResultItem constructor(
|
|||||||
const val VIEW_TYPE = FlexibleItemViewType.MESSAGE_RESULT_ITEM
|
const val VIEW_TYPE = FlexibleItemViewType.MESSAGE_RESULT_ITEM
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getHeader(): GenericTextHeaderItem = MessagesTextHeaderItem(context, viewThemeUtils)
|
override fun getHeader(): GenericTextHeaderItem =
|
||||||
|
MessagesTextHeaderItem(context, viewThemeUtils)
|
||||||
.apply {
|
.apply {
|
||||||
isHidden = showHeader // FlexibleAdapter needs this hack for some reason
|
isHidden = showHeader // FlexibleAdapter needs this hack for some reason
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,6 @@ class CallStartedViewHolder(incomingView: View, payload: Any) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
var TAG: String? = CallStartedViewHolder::class.simpleName
|
val TAG: String? = CallStartedViewHolder::class.simpleName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,7 @@ import io.reactivex.schedulers.Schedulers
|
|||||||
|
|
||||||
class LinkPreview {
|
class LinkPreview {
|
||||||
|
|
||||||
fun showLink(
|
fun showLink(message: ChatMessage, ncApi: NcApi, binding: ReferenceInsideMessageBinding, context: Context) {
|
||||||
message: ChatMessage,
|
|
||||||
ncApi: NcApi,
|
|
||||||
binding: ReferenceInsideMessageBinding,
|
|
||||||
context: Context
|
|
||||||
) {
|
|
||||||
binding.referenceName.text = ""
|
binding.referenceName.text = ""
|
||||||
binding.referenceDescription.text = ""
|
binding.referenceDescription.text = ""
|
||||||
binding.referenceLink.text = ""
|
binding.referenceLink.text = ""
|
||||||
|
@ -79,10 +79,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListItemViewHolder {
|
||||||
parent: ViewGroup,
|
|
||||||
viewType: Int
|
|
||||||
): ListItemViewHolder {
|
|
||||||
val listItemView: View = parent.inflate(dialog.windowContext, R.layout.menu_item_sheet)
|
val listItemView: View = parent.inflate(dialog.windowContext, R.layout.menu_item_sheet)
|
||||||
val viewHolder = ListItemViewHolder(
|
val viewHolder = ListItemViewHolder(
|
||||||
itemView = listItemView,
|
itemView = listItemView,
|
||||||
@ -94,10 +91,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
|
|||||||
|
|
||||||
override fun getItemCount() = items.size
|
override fun getItemCount() = items.size
|
||||||
|
|
||||||
override fun onBindViewHolder(
|
override fun onBindViewHolder(holder: ListItemViewHolder, position: Int) {
|
||||||
holder: ListItemViewHolder,
|
|
||||||
position: Int
|
|
||||||
) {
|
|
||||||
holder.itemView.isEnabled = !disabledIndices.contains(position)
|
holder.itemView.isEnabled = !disabledIndices.contains(position)
|
||||||
val currentItem = items[position]
|
val currentItem = items[position]
|
||||||
|
|
||||||
@ -120,10 +114,7 @@ internal class ListIconDialogAdapter<IT : ListItemWithImage>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceItems(
|
override fun replaceItems(items: List<IT>, listener: ListItemListener<IT>) {
|
||||||
items: List<IT>,
|
|
||||||
listener: ListItemListener<IT>
|
|
||||||
) {
|
|
||||||
this.items = items
|
this.items = items
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
this.selection = listener
|
this.selection = listener
|
||||||
|
@ -46,10 +46,7 @@ class ReactionAnimator(
|
|||||||
) {
|
) {
|
||||||
private val reactionsList: MutableList<CallReaction> = ArrayList()
|
private val reactionsList: MutableList<CallReaction> = ArrayList()
|
||||||
|
|
||||||
fun addReaction(
|
fun addReaction(emoji: String, displayName: String) {
|
||||||
emoji: String,
|
|
||||||
displayName: String
|
|
||||||
) {
|
|
||||||
val callReaction = CallReaction(emoji, displayName)
|
val callReaction = CallReaction(emoji, displayName)
|
||||||
reactionsList.add(callReaction)
|
reactionsList.add(callReaction)
|
||||||
|
|
||||||
@ -58,9 +55,7 @@ class ReactionAnimator(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun animateReaction(
|
private fun animateReaction(callReaction: CallReaction) {
|
||||||
callReaction: CallReaction
|
|
||||||
) {
|
|
||||||
val reactionWrapper = getReactionWrapperView(callReaction)
|
val reactionWrapper = getReactionWrapperView(callReaction)
|
||||||
|
|
||||||
val params = RelativeLayout.LayoutParams(
|
val params = RelativeLayout.LayoutParams(
|
||||||
|
@ -348,7 +348,13 @@ class ChatActivity :
|
|||||||
|
|
||||||
private var recorder: MediaRecorder? = null
|
private var recorder: MediaRecorder? = null
|
||||||
private enum class MediaRecorderState {
|
private enum class MediaRecorderState {
|
||||||
INITIAL, INITIALIZED, CONFIGURED, PREPARED, RECORDING, RELEASED, ERROR
|
INITIAL,
|
||||||
|
INITIALIZED,
|
||||||
|
CONFIGURED,
|
||||||
|
PREPARED,
|
||||||
|
RECORDING,
|
||||||
|
RELEASED,
|
||||||
|
ERROR
|
||||||
}
|
}
|
||||||
private var mediaRecorderState: MediaRecorderState = MediaRecorderState.INITIAL
|
private var mediaRecorderState: MediaRecorderState = MediaRecorderState.INITIAL
|
||||||
|
|
||||||
@ -1708,13 +1714,16 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isOneToOneConversation() = currentConversation != null && currentConversation?.type != null &&
|
fun isOneToOneConversation() =
|
||||||
|
currentConversation != null && currentConversation?.type != null &&
|
||||||
currentConversation?.type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
currentConversation?.type == ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||||
|
|
||||||
private fun isGroupConversation() = currentConversation != null && currentConversation?.type != null &&
|
private fun isGroupConversation() =
|
||||||
|
currentConversation != null && currentConversation?.type != null &&
|
||||||
currentConversation?.type == ConversationType.ROOM_GROUP_CALL
|
currentConversation?.type == ConversationType.ROOM_GROUP_CALL
|
||||||
|
|
||||||
private fun isPublicConversation() = currentConversation != null && currentConversation?.type != null &&
|
private fun isPublicConversation() =
|
||||||
|
currentConversation != null && currentConversation?.type != null &&
|
||||||
currentConversation?.type == ConversationType.ROOM_PUBLIC_CALL
|
currentConversation?.type == ConversationType.ROOM_PUBLIC_CALL
|
||||||
|
|
||||||
private fun switchToRoom(token: String, startCallAfterRoomSwitch: Boolean, isVoiceOnlyCall: Boolean) {
|
private fun switchToRoom(token: String, startCallAfterRoomSwitch: Boolean, isVoiceOnlyCall: Boolean) {
|
||||||
@ -2973,9 +2982,7 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun leaveRoom(
|
fun leaveRoom(funToCallWhenLeaveSuccessful: (() -> Unit)?) {
|
||||||
funToCallWhenLeaveSuccessful: (() -> Unit)?
|
|
||||||
) {
|
|
||||||
logConversationInfos("leaveRoom")
|
logConversationInfos("leaveRoom")
|
||||||
|
|
||||||
var apiVersion = 1
|
var apiVersion = 1
|
||||||
@ -3141,11 +3148,7 @@ class ChatActivity :
|
|||||||
signalingMessageSender = webSocketInstance?.signalingMessageSender
|
signalingMessageSender = webSocketInstance?.signalingMessageSender
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pullChatMessages(
|
fun pullChatMessages(lookIntoFuture: Boolean, setReadMarker: Boolean = true, xChatLastCommonRead: Int? = null) {
|
||||||
lookIntoFuture: Boolean,
|
|
||||||
setReadMarker: Boolean = true,
|
|
||||||
xChatLastCommonRead: Int? = null
|
|
||||||
) {
|
|
||||||
if (!validSessionId()) {
|
if (!validSessionId()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -3465,10 +3468,7 @@ class ChatActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addMessagesToAdapter(
|
private fun addMessagesToAdapter(shouldAddNewMessagesNotice: Boolean, chatMessageList: List<ChatMessage>) {
|
||||||
shouldAddNewMessagesNotice: Boolean,
|
|
||||||
chatMessageList: List<ChatMessage>
|
|
||||||
) {
|
|
||||||
val isThereANewNotice =
|
val isThereANewNotice =
|
||||||
shouldAddNewMessagesNotice || adapter?.getMessagePositionByIdInReverse("-1") != -1
|
shouldAddNewMessagesNotice || adapter?.getMessagePositionByIdInReverse("-1") != -1
|
||||||
for (chatMessage in chatMessageList) {
|
for (chatMessage in chatMessageList) {
|
||||||
@ -3721,19 +3721,15 @@ class ChatActivity :
|
|||||||
chatMessageMap[currentMessage.value.parentMessage!!.id]!!.isDeleted = true
|
chatMessageMap[currentMessage.value.parentMessage!!.id]!!.isDeleted = true
|
||||||
}
|
}
|
||||||
chatMessageIterator.remove()
|
chatMessageIterator.remove()
|
||||||
}
|
} else if (isReactionsMessage(currentMessage)) {
|
||||||
|
|
||||||
// delete reactions system messages
|
// delete reactions system messages
|
||||||
else if (isReactionsMessage(currentMessage)) {
|
|
||||||
if (!chatMessageMap.containsKey(currentMessage.value.parentMessage!!.id)) {
|
if (!chatMessageMap.containsKey(currentMessage.value.parentMessage!!.id)) {
|
||||||
updateAdapterForReaction(currentMessage.value.parentMessage)
|
updateAdapterForReaction(currentMessage.value.parentMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
chatMessageIterator.remove()
|
chatMessageIterator.remove()
|
||||||
}
|
} else if (isPollVotedMessage(currentMessage)) {
|
||||||
|
|
||||||
// delete poll system messages
|
// delete poll system messages
|
||||||
else if (isPollVotedMessage(currentMessage)) {
|
|
||||||
chatMessageIterator.remove()
|
chatMessageIterator.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,10 +29,7 @@ import com.nextcloud.talk.utils.ApiUtils
|
|||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
|
|
||||||
class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
|
class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
|
||||||
override fun getRoom(
|
override fun getRoom(user: User, roomToken: String): Observable<ConversationModel> {
|
||||||
user: User,
|
|
||||||
roomToken: String
|
|
||||||
): Observable<ConversationModel> {
|
|
||||||
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv3, 1))
|
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv3, 1))
|
||||||
|
|
||||||
@ -42,11 +39,7 @@ class ChatRepositoryImpl(private val ncApi: NcApi) : ChatRepository {
|
|||||||
).map { ConversationModel.mapToConversationModel(it.ocs?.data!!) }
|
).map { ConversationModel.mapToConversationModel(it.ocs?.data!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun joinRoom(
|
override fun joinRoom(user: User, roomToken: String, roomPassword: String): Observable<ConversationModel> {
|
||||||
user: User,
|
|
||||||
roomToken: String,
|
|
||||||
roomPassword: String
|
|
||||||
): Observable<ConversationModel> {
|
|
||||||
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
val credentials: String = ApiUtils.getCredentials(user.username, user.token)
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, 1))
|
val apiVersion = ApiUtils.getConversationApiVersion(user, intArrayOf(ApiUtils.APIv4, 1))
|
||||||
|
|
||||||
|
@ -27,13 +27,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface ConversationRepository {
|
interface ConversationRepository {
|
||||||
|
|
||||||
fun renameConversation(
|
fun renameConversation(roomToken: String, roomNameNew: String): Observable<GenericOverall>
|
||||||
roomToken: String,
|
|
||||||
roomNameNew: String
|
|
||||||
): Observable<GenericOverall>
|
|
||||||
|
|
||||||
fun createConversation(
|
fun createConversation(roomName: String, conversationType: Conversation.ConversationType?): Observable<RoomOverall>
|
||||||
roomName: String,
|
|
||||||
conversationType: Conversation.ConversationType?
|
|
||||||
): Observable<RoomOverall>
|
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,7 @@ class ConversationRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
||||||
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
||||||
|
|
||||||
override fun renameConversation(
|
override fun renameConversation(roomToken: String, roomNameNew: String): Observable<GenericOverall> {
|
||||||
roomToken: String,
|
|
||||||
roomNameNew: String
|
|
||||||
): Observable<GenericOverall> {
|
|
||||||
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))
|
val apiVersion = ApiUtils.getConversationApiVersion(currentUser, intArrayOf(ApiUtils.APIv4, ApiUtils.APIv1))
|
||||||
|
|
||||||
return ncApi.renameRoom(
|
return ncApi.renameRoom(
|
||||||
|
@ -54,10 +54,7 @@ class ConversationViewModel @Inject constructor(private val repository: Conversa
|
|||||||
disposable?.dispose()
|
disposable?.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createConversation(
|
fun createConversation(roomName: String, conversationType: Conversation.ConversationType?) {
|
||||||
roomName: String,
|
|
||||||
conversationType: Conversation.ConversationType?
|
|
||||||
) {
|
|
||||||
_viewState.value = CreatingState
|
_viewState.value = CreatingState
|
||||||
|
|
||||||
repository.createConversation(
|
repository.createConversation(
|
||||||
|
@ -352,9 +352,7 @@ class ConversationsListActivity :
|
|||||||
viewThemeUtils.material.themeToolbar(binding.conversationListToolbar)
|
viewThemeUtils.material.themeToolbar(binding.conversationListToolbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadUserAvatar(
|
private fun loadUserAvatar(target: Target) {
|
||||||
target: Target
|
|
||||||
) {
|
|
||||||
if (currentUser != null) {
|
if (currentUser != null) {
|
||||||
val url = ApiUtils.getUrlForAvatar(
|
val url = ApiUtils.getUrlForAvatar(
|
||||||
currentUser!!.baseUrl,
|
currentUser!!.baseUrl,
|
||||||
|
@ -87,8 +87,10 @@ class RepositoryModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun provideRemoteFileBrowserItemsRepository(okHttpClient: OkHttpClient, userProvider: CurrentUserProviderNew):
|
fun provideRemoteFileBrowserItemsRepository(
|
||||||
RemoteFileBrowserItemsRepository {
|
okHttpClient: OkHttpClient,
|
||||||
|
userProvider: CurrentUserProviderNew
|
||||||
|
): RemoteFileBrowserItemsRepository {
|
||||||
return RemoteFileBrowserItemsRepositoryImpl(okHttpClient, userProvider)
|
return RemoteFileBrowserItemsRepositoryImpl(okHttpClient, userProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,38 +115,41 @@ class RepositoryModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun provideRequestAssistanceRepository(ncApi: NcApi, userProvider: CurrentUserProviderNew):
|
fun provideRequestAssistanceRepository(
|
||||||
RequestAssistanceRepository {
|
ncApi: NcApi,
|
||||||
|
userProvider: CurrentUserProviderNew
|
||||||
|
): RequestAssistanceRepository {
|
||||||
return RequestAssistanceRepositoryImpl(ncApi, userProvider)
|
return RequestAssistanceRepositoryImpl(ncApi, userProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun provideOpenConversationsRepository(ncApi: NcApi, userProvider: CurrentUserProviderNew):
|
fun provideOpenConversationsRepository(
|
||||||
OpenConversationsRepository {
|
ncApi: NcApi,
|
||||||
|
userProvider: CurrentUserProviderNew
|
||||||
|
): OpenConversationsRepository {
|
||||||
return OpenConversationsRepositoryImpl(ncApi, userProvider)
|
return OpenConversationsRepositoryImpl(ncApi, userProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun translateRepository(ncApi: NcApi):
|
fun translateRepository(ncApi: NcApi): TranslateRepository {
|
||||||
TranslateRepository {
|
|
||||||
return TranslateRepositoryImpl(ncApi)
|
return TranslateRepositoryImpl(ncApi)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun provideChatRepository(ncApi: NcApi):
|
fun provideChatRepository(ncApi: NcApi): ChatRepository {
|
||||||
ChatRepository {
|
|
||||||
return ChatRepositoryImpl(ncApi)
|
return ChatRepositoryImpl(ncApi)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun provideConversationInfoEditRepository(ncApi: NcApi, userProvider: CurrentUserProviderNew):
|
fun provideConversationInfoEditRepository(
|
||||||
ConversationInfoEditRepository {
|
ncApi: NcApi,
|
||||||
|
userProvider: CurrentUserProviderNew
|
||||||
|
): ConversationInfoEditRepository {
|
||||||
return ConversationInfoEditRepositoryImpl(ncApi, userProvider)
|
return ConversationInfoEditRepositoryImpl(ncApi, userProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
fun provideConversationRepository(ncApi: NcApi, userProvider: CurrentUserProviderNew):
|
fun provideConversationRepository(ncApi: NcApi, userProvider: CurrentUserProviderNew): ConversationRepository {
|
||||||
ConversationRepository {
|
|
||||||
return ConversationRepositoryImpl(ncApi, userProvider)
|
return ConversationRepositoryImpl(ncApi, userProvider)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,12 +64,12 @@ abstract class TalkDatabase : RoomDatabase() {
|
|||||||
const val TAG = "TalkDatabase"
|
const val TAG = "TalkDatabase"
|
||||||
|
|
||||||
@Volatile
|
@Volatile
|
||||||
private var INSTANCE: TalkDatabase? = null
|
private var instance: TalkDatabase? = null
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getInstance(context: Context, appPreferences: AppPreferences): TalkDatabase =
|
fun getInstance(context: Context, appPreferences: AppPreferences): TalkDatabase =
|
||||||
INSTANCE ?: synchronized(this) {
|
instance ?: synchronized(this) {
|
||||||
INSTANCE ?: build(context, appPreferences).also { INSTANCE = it }
|
instance ?: build(context, appPreferences).also { instance = it }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun build(context: Context, appPreferences: AppPreferences): TalkDatabase {
|
private fun build(context: Context, appPreferences: AppPreferences): TalkDatabase {
|
||||||
|
@ -93,12 +93,7 @@ class ShareOperationWorker(context: Context, workerParams: WorkerParameters) : W
|
|||||||
companion object {
|
companion object {
|
||||||
private val TAG = ShareOperationWorker::class.simpleName
|
private val TAG = ShareOperationWorker::class.simpleName
|
||||||
|
|
||||||
fun shareFile(
|
fun shareFile(roomToken: String?, currentUser: User, remotePath: String, metaData: String?) {
|
||||||
roomToken: String?,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String,
|
|
||||||
metaData: String?
|
|
||||||
) {
|
|
||||||
val paths: MutableList<String> = ArrayList()
|
val paths: MutableList<String> = ArrayList()
|
||||||
paths.add(remotePath)
|
paths.add(remotePath)
|
||||||
|
|
||||||
|
@ -186,9 +186,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
|
|||||||
return remotePath
|
return remotePath
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransferProgress(
|
override fun onTransferProgress(percentage: Int) {
|
||||||
percentage: Int
|
|
||||||
) {
|
|
||||||
notification = mBuilder!!
|
notification = mBuilder!!
|
||||||
.setProgress(HUNDRED_PERCENT, percentage, false)
|
.setProgress(HUNDRED_PERCENT, percentage, false)
|
||||||
.setContentText(getNotificationContentText(percentage))
|
.setContentText(getNotificationContentText(percentage))
|
||||||
@ -322,12 +320,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun upload(
|
fun upload(fileUri: String, roomToken: String, conversationName: String, metaData: String?) {
|
||||||
fileUri: String,
|
|
||||||
roomToken: String,
|
|
||||||
conversationName: String,
|
|
||||||
metaData: String?
|
|
||||||
) {
|
|
||||||
val data: Data = Data.Builder()
|
val data: Data = Data.Builder()
|
||||||
.putString(DEVICE_SOURCE_FILE, fileUri)
|
.putString(DEVICE_SOURCE_FILE, fileUri)
|
||||||
.putString(ROOM_TOKEN, roomToken)
|
.putString(ROOM_TOKEN, roomToken)
|
||||||
|
@ -335,7 +335,8 @@ class LocationPickerActivity :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun delayedMapListener() = DelayedMapListener(
|
private fun delayedMapListener() =
|
||||||
|
DelayedMapListener(
|
||||||
object : MapListener {
|
object : MapListener {
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
|
override fun onScroll(paramScrollEvent: ScrollEvent): Boolean {
|
||||||
@ -524,11 +525,7 @@ class LocationPickerActivity :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(
|
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||||
requestCode: Int,
|
|
||||||
permissions: Array<out String>,
|
|
||||||
grantResults: IntArray
|
|
||||||
) {
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||||
|
|
||||||
fun areAllGranted(grantResults: IntArray): Boolean {
|
fun areAllGranted(grantResults: IntArray): Boolean {
|
||||||
|
@ -46,9 +46,7 @@ class ConversationModel(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun mapToConversationModel(
|
fun mapToConversationModel(conversation: Conversation): ConversationModel {
|
||||||
conversation: Conversation
|
|
||||||
): ConversationModel {
|
|
||||||
return ConversationModel(
|
return ConversationModel(
|
||||||
roomId = conversation.roomId,
|
roomId = conversation.roomId,
|
||||||
token = conversation.token,
|
token = conversation.token,
|
||||||
@ -113,7 +111,13 @@ enum class ConversationType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class ParticipantType {
|
enum class ParticipantType {
|
||||||
DUMMY, OWNER, MODERATOR, USER, GUEST, USER_FOLLOWING_LINK, GUEST_MODERATOR
|
DUMMY,
|
||||||
|
OWNER,
|
||||||
|
MODERATOR,
|
||||||
|
USER,
|
||||||
|
GUEST,
|
||||||
|
USER_FOLLOWING_LINK,
|
||||||
|
GUEST_MODERATOR
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ObjectType {
|
enum class ObjectType {
|
||||||
@ -124,13 +128,18 @@ enum class ObjectType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class NotificationLevel {
|
enum class NotificationLevel {
|
||||||
DEFAULT, ALWAYS, MENTION, NEVER
|
DEFAULT,
|
||||||
|
ALWAYS,
|
||||||
|
MENTION,
|
||||||
|
NEVER
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ConversationReadOnlyState {
|
enum class ConversationReadOnlyState {
|
||||||
CONVERSATION_READ_WRITE, CONVERSATION_READ_ONLY
|
CONVERSATION_READ_WRITE,
|
||||||
|
CONVERSATION_READ_ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class LobbyState {
|
enum class LobbyState {
|
||||||
LOBBY_STATE_ALL_PARTICIPANTS, LOBBY_STATE_MODERATORS_ONLY
|
LOBBY_STATE_ALL_PARTICIPANTS,
|
||||||
|
LOBBY_STATE_MODERATORS_ONLY
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,8 @@ data class ChatMessage(
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getNullsafeActorDisplayName() = if (!TextUtils.isEmpty(actorDisplayName)) {
|
private fun getNullsafeActorDisplayName() =
|
||||||
|
if (!TextUtils.isEmpty(actorDisplayName)) {
|
||||||
actorDisplayName
|
actorDisplayName
|
||||||
} else {
|
} else {
|
||||||
sharedApplication!!.getString(R.string.nc_guest)
|
sharedApplication!!.getString(R.string.nc_guest)
|
||||||
@ -471,7 +472,8 @@ data class ChatMessage(
|
|||||||
* see https://nextcloud-talk.readthedocs.io/en/latest/chat/#system-messages
|
* see https://nextcloud-talk.readthedocs.io/en/latest/chat/#system-messages
|
||||||
*/
|
*/
|
||||||
enum class SystemMessageType {
|
enum class SystemMessageType {
|
||||||
DUMMY, CONVERSATION_CREATED,
|
DUMMY,
|
||||||
|
CONVERSATION_CREATED,
|
||||||
CONVERSATION_RENAMED,
|
CONVERSATION_RENAMED,
|
||||||
DESCRIPTION_REMOVED,
|
DESCRIPTION_REMOVED,
|
||||||
DESCRIPTION_SET,
|
DESCRIPTION_SET,
|
||||||
@ -505,7 +507,8 @@ data class ChatMessage(
|
|||||||
GUEST_MODERATOR_PROMOTED,
|
GUEST_MODERATOR_PROMOTED,
|
||||||
GUEST_MODERATOR_DEMOTED,
|
GUEST_MODERATOR_DEMOTED,
|
||||||
MESSAGE_DELETED,
|
MESSAGE_DELETED,
|
||||||
FILE_SHARED, OBJECT_SHARED,
|
FILE_SHARED,
|
||||||
|
OBJECT_SHARED,
|
||||||
MATTERBRIDGE_CONFIG_ADDED,
|
MATTERBRIDGE_CONFIG_ADDED,
|
||||||
MATTERBRIDGE_CONFIG_EDITED,
|
MATTERBRIDGE_CONFIG_EDITED,
|
||||||
MATTERBRIDGE_CONFIG_REMOVED,
|
MATTERBRIDGE_CONFIG_REMOVED,
|
||||||
|
@ -26,8 +26,10 @@ package com.nextcloud.talk.models.json.chat
|
|||||||
|
|
||||||
class ChatUtils {
|
class ChatUtils {
|
||||||
companion object {
|
companion object {
|
||||||
fun getParsedMessage(message: String?, messageParameters: HashMap<String?, HashMap<String?, String?>>?):
|
fun getParsedMessage(
|
||||||
String? {
|
message: String?,
|
||||||
|
messageParameters: HashMap<String?, HashMap<String?, String?>>?
|
||||||
|
): String? {
|
||||||
if (messageParameters != null && messageParameters.size > 0) {
|
if (messageParameters != null && messageParameters.size > 0) {
|
||||||
return parse(messageParameters, message)
|
return parse(messageParameters, message)
|
||||||
}
|
}
|
||||||
@ -35,10 +37,7 @@ class ChatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.ComplexMethod")
|
@Suppress("Detekt.ComplexMethod")
|
||||||
private fun parse(
|
private fun parse(messageParameters: HashMap<String?, HashMap<String?, String?>>, message: String?): String? {
|
||||||
messageParameters: HashMap<String?, HashMap<String?, String?>>,
|
|
||||||
message: String?
|
|
||||||
): String? {
|
|
||||||
var resultMessage = message
|
var resultMessage = message
|
||||||
for (key in messageParameters.keys) {
|
for (key in messageParameters.keys) {
|
||||||
val individualHashMap = messageParameters[key]
|
val individualHashMap = messageParameters[key]
|
||||||
|
@ -20,5 +20,7 @@
|
|||||||
package com.nextcloud.talk.models.json.chat
|
package com.nextcloud.talk.models.json.chat
|
||||||
|
|
||||||
enum class ReadStatus {
|
enum class ReadStatus {
|
||||||
NONE, SENT, READ
|
NONE,
|
||||||
|
SENT,
|
||||||
|
READ
|
||||||
}
|
}
|
||||||
|
@ -229,15 +229,20 @@ data class Conversation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class NotificationLevel {
|
enum class NotificationLevel {
|
||||||
DEFAULT, ALWAYS, MENTION, NEVER
|
DEFAULT,
|
||||||
|
ALWAYS,
|
||||||
|
MENTION,
|
||||||
|
NEVER
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class LobbyState {
|
enum class LobbyState {
|
||||||
LOBBY_STATE_ALL_PARTICIPANTS, LOBBY_STATE_MODERATORS_ONLY
|
LOBBY_STATE_ALL_PARTICIPANTS,
|
||||||
|
LOBBY_STATE_MODERATORS_ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ConversationReadOnlyState {
|
enum class ConversationReadOnlyState {
|
||||||
CONVERSATION_READ_WRITE, CONVERSATION_READ_ONLY
|
CONVERSATION_READ_WRITE,
|
||||||
|
CONVERSATION_READ_ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
|
@ -124,11 +124,22 @@ data class Participant(
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class ActorType {
|
enum class ActorType {
|
||||||
DUMMY, EMAILS, GROUPS, GUESTS, USERS, CIRCLES
|
DUMMY,
|
||||||
|
EMAILS,
|
||||||
|
GROUPS,
|
||||||
|
GUESTS,
|
||||||
|
USERS,
|
||||||
|
CIRCLES
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ParticipantType {
|
enum class ParticipantType {
|
||||||
DUMMY, OWNER, MODERATOR, USER, GUEST, USER_FOLLOWING_LINK, GUEST_MODERATOR
|
DUMMY,
|
||||||
|
OWNER,
|
||||||
|
MODERATOR,
|
||||||
|
USER,
|
||||||
|
GUEST,
|
||||||
|
USER_FOLLOWING_LINK,
|
||||||
|
GUEST_MODERATOR
|
||||||
}
|
}
|
||||||
|
|
||||||
object InCallFlags {
|
object InCallFlags {
|
||||||
|
@ -41,6 +41,8 @@ data class ReactionVoter(
|
|||||||
constructor() : this(null, null, null, 0)
|
constructor() : this(null, null, null, 0)
|
||||||
|
|
||||||
enum class ReactionActorType {
|
enum class ReactionActorType {
|
||||||
DUMMY, GUESTS, USERS
|
DUMMY,
|
||||||
|
GUESTS,
|
||||||
|
USERS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,7 @@ class OpenConversationsRepositoryImpl(private val ncApi: NcApi, currentUserProvi
|
|||||||
).map { mapToOpenConversationsModel(it.ocs?.data!!) }
|
).map { mapToOpenConversationsModel(it.ocs?.data!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToOpenConversationsModel(
|
private fun mapToOpenConversationsModel(conversations: List<Conversation>): OpenConversationsModel {
|
||||||
conversations: List<Conversation>
|
|
||||||
): OpenConversationsModel {
|
|
||||||
return OpenConversationsModel(
|
return OpenConversationsModel(
|
||||||
conversations.map { conversation ->
|
conversations.map { conversation ->
|
||||||
OpenConversation(
|
OpenConversation(
|
||||||
|
@ -75,8 +75,7 @@ class PollCreateOptionViewHolder(
|
|||||||
private fun getTextWatcher(
|
private fun getTextWatcher(
|
||||||
pollCreateOptionItem: PollCreateOptionItem,
|
pollCreateOptionItem: PollCreateOptionItem,
|
||||||
itemsListener: PollCreateOptionsItemListener
|
itemsListener: PollCreateOptionsItemListener
|
||||||
) =
|
) = object : TextWatcher {
|
||||||
object : TextWatcher {
|
|
||||||
override fun afterTextChanged(s: Editable) {
|
override fun afterTextChanged(s: Editable) {
|
||||||
// unused atm
|
// unused atm
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,7 @@ class PollLoadingFragment : Fragment() {
|
|||||||
fragmentHeight = arguments?.getInt(KEY_FRAGMENT_HEIGHT)!!
|
fragmentHeight = arguments?.getInt(KEY_FRAGMENT_HEIGHT)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
||||||
binding.root.layoutParams.height = fragmentHeight
|
binding.root.layoutParams.height = fragmentHeight
|
||||||
viewThemeUtils.platform.colorCircularProgressBar(binding.pollLoadingProgressbar, ColorRole.PRIMARY)
|
viewThemeUtils.platform.colorCircularProgressBar(binding.pollLoadingProgressbar, ColorRole.PRIMARY)
|
||||||
@ -65,9 +61,7 @@ class PollLoadingFragment : Fragment() {
|
|||||||
private const val KEY_FRAGMENT_HEIGHT = "keyFragmentHeight"
|
private const val KEY_FRAGMENT_HEIGHT = "keyFragmentHeight"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(
|
fun newInstance(fragmentHeight: Int): PollLoadingFragment {
|
||||||
fragmentHeight: Int
|
|
||||||
): PollLoadingFragment {
|
|
||||||
val args = bundleOf(
|
val args = bundleOf(
|
||||||
KEY_FRAGMENT_HEIGHT to fragmentHeight
|
KEY_FRAGMENT_HEIGHT to fragmentHeight
|
||||||
)
|
)
|
||||||
|
@ -121,7 +121,7 @@ class PollMainDialogFragment : DialogFragment() {
|
|||||||
|
|
||||||
private fun showLoadingScreen() {
|
private fun showLoadingScreen() {
|
||||||
binding.root.post {
|
binding.root.post {
|
||||||
run() {
|
run {
|
||||||
val fragmentHeight = binding.messagePollContentFragment.measuredHeight
|
val fragmentHeight = binding.messagePollContentFragment.measuredHeight
|
||||||
|
|
||||||
val contentFragment = PollLoadingFragment.newInstance(fragmentHeight)
|
val contentFragment = PollLoadingFragment.newInstance(fragmentHeight)
|
||||||
|
@ -65,11 +65,7 @@ class PollResultsFragment : Fragment(), PollResultItemClickListener {
|
|||||||
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
binding = DialogPollResultsBinding.inflate(inflater, container, false)
|
binding = DialogPollResultsBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
@ -69,11 +69,7 @@ class PollVoteFragment : Fragment() {
|
|||||||
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
parentViewModel = ViewModelProvider(requireParentFragment(), viewModelFactory)[PollMainViewModel::class.java]
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
binding = DialogPollVoteBinding.inflate(inflater, container, false)
|
binding = DialogPollVoteBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,8 @@ class PollResultsViewModel @Inject constructor() : ViewModel() {
|
|||||||
val poll: Poll?
|
val poll: Poll?
|
||||||
get() = _poll
|
get() = _poll
|
||||||
|
|
||||||
private var _itemsOverviewList: ArrayList<PollResultItem> = ArrayList()
|
private var itemsOverviewList: ArrayList<PollResultItem> = ArrayList()
|
||||||
private var _itemsDetailsList: ArrayList<PollResultItem> = ArrayList()
|
private var itemsDetailsList: ArrayList<PollResultItem> = ArrayList()
|
||||||
|
|
||||||
private var _items: MutableLiveData<ArrayList<PollResultItem>?> = MutableLiveData<ArrayList<PollResultItem>?>()
|
private var _items: MutableLiveData<ArrayList<PollResultItem>?> = MutableLiveData<ArrayList<PollResultItem>?>()
|
||||||
val items: MutableLiveData<ArrayList<PollResultItem>?>
|
val items: MutableLiveData<ArrayList<PollResultItem>?>
|
||||||
@ -77,23 +77,23 @@ class PollResultsViewModel @Inject constructor() : ViewModel() {
|
|||||||
optionsPercent,
|
optionsPercent,
|
||||||
isOptionSelfVoted(poll, index)
|
isOptionSelfVoted(poll, index)
|
||||||
)
|
)
|
||||||
_itemsOverviewList.add(pollResultHeaderItem)
|
itemsOverviewList.add(pollResultHeaderItem)
|
||||||
_itemsDetailsList.add(pollResultHeaderItem)
|
itemsDetailsList.add(pollResultHeaderItem)
|
||||||
|
|
||||||
val voters = poll.details?.filter { it.optionId == index }
|
val voters = poll.details?.filter { it.optionId == index }
|
||||||
|
|
||||||
if (!voters.isNullOrEmpty()) {
|
if (!voters.isNullOrEmpty()) {
|
||||||
_itemsOverviewList.add(PollResultVotersOverviewItem(voters))
|
itemsOverviewList.add(PollResultVotersOverviewItem(voters))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!voters.isNullOrEmpty()) {
|
if (!voters.isNullOrEmpty()) {
|
||||||
voters.forEach {
|
voters.forEach {
|
||||||
_itemsDetailsList.add(PollResultVoterItem(it))
|
itemsDetailsList.add(PollResultVoterItem(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_items.value = _itemsOverviewList
|
_items.value = itemsOverviewList
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getVotersAmountForOption(poll: Poll, index: Int): Int {
|
private fun getVotersAmountForOption(poll: Poll, index: Int): Int {
|
||||||
@ -114,10 +114,10 @@ class PollResultsViewModel @Inject constructor() : ViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun toggleDetails() {
|
fun toggleDetails() {
|
||||||
if (_items.value?.containsAll(_itemsDetailsList) == true) {
|
if (_items.value?.containsAll(itemsDetailsList) == true) {
|
||||||
_items.value = _itemsOverviewList
|
_items.value = itemsOverviewList
|
||||||
} else {
|
} else {
|
||||||
_items.value = _itemsDetailsList
|
_items.value = itemsDetailsList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,10 +688,7 @@ class ProfileActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initUserInfoEditText(
|
private fun initUserInfoEditText(holder: ViewHolder, item: UserInfoDetailsItem) {
|
||||||
holder: ViewHolder,
|
|
||||||
item: UserInfoDetailsItem
|
|
||||||
) {
|
|
||||||
holder.binding.userInfoEditTextEdit.setText(item.text)
|
holder.binding.userInfoEditTextEdit.setText(item.text)
|
||||||
holder.binding.userInfoInputLayout.hint = item.hint
|
holder.binding.userInfoInputLayout.hint = item.hint
|
||||||
holder.binding.userInfoEditTextEdit.addTextChangedListener(object : TextWatcher {
|
holder.binding.userInfoEditTextEdit.addTextChangedListener(object : TextWatcher {
|
||||||
@ -714,10 +711,7 @@ class ProfileActivity : BaseActivity() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initScopeElements(
|
private fun initScopeElements(item: UserInfoDetailsItem, holder: ViewHolder) {
|
||||||
item: UserInfoDetailsItem,
|
|
||||||
holder: ViewHolder
|
|
||||||
) {
|
|
||||||
if (item.scope == null) {
|
if (item.scope == null) {
|
||||||
holder.binding.scope.visibility = View.GONE
|
holder.binding.scope.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,11 +24,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface RequestAssistanceRepository {
|
interface RequestAssistanceRepository {
|
||||||
|
|
||||||
fun requestAssistance(
|
fun requestAssistance(roomToken: String): Observable<RequestAssistanceModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<RequestAssistanceModel>
|
|
||||||
|
|
||||||
fun withdrawRequestAssistance(
|
fun withdrawRequestAssistance(roomToken: String): Observable<WithdrawRequestAssistanceModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<WithdrawRequestAssistanceModel>
|
|
||||||
}
|
}
|
||||||
|
@ -57,18 +57,14 @@ class RequestAssistanceRepositoryImpl(private val ncApi: NcApi, currentUserProvi
|
|||||||
).map { mapToWithdrawRequestAssistanceModel(it.ocs?.meta!!) }
|
).map { mapToWithdrawRequestAssistanceModel(it.ocs?.meta!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToRequestAssistanceModel(
|
private fun mapToRequestAssistanceModel(response: GenericMeta): RequestAssistanceModel {
|
||||||
response: GenericMeta
|
|
||||||
): RequestAssistanceModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return RequestAssistanceModel(
|
return RequestAssistanceModel(
|
||||||
success
|
success
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToWithdrawRequestAssistanceModel(
|
private fun mapToWithdrawRequestAssistanceModel(response: GenericMeta): WithdrawRequestAssistanceModel {
|
||||||
response: GenericMeta
|
|
||||||
): WithdrawRequestAssistanceModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return WithdrawRequestAssistanceModel(
|
return WithdrawRequestAssistanceModel(
|
||||||
success
|
success
|
||||||
|
@ -160,10 +160,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadList(
|
private fun loadList(state: RemoteFileBrowserItemsViewModel.LoadedState, mimeTypeSelectionFilter: String?) {
|
||||||
state: RemoteFileBrowserItemsViewModel.LoadedState,
|
|
||||||
mimeTypeSelectionFilter: String?
|
|
||||||
) {
|
|
||||||
val remoteFileBrowserItems = state.items
|
val remoteFileBrowserItems = state.items
|
||||||
Log.d(TAG, "Items received: $remoteFileBrowserItems")
|
Log.d(TAG, "Items received: $remoteFileBrowserItems")
|
||||||
|
|
||||||
|
@ -36,8 +36,7 @@ class RemoteFileBrowserItemsRepositoryImpl @Inject constructor(
|
|||||||
private val user: User
|
private val user: User
|
||||||
get() = userProvider.currentUser.blockingGet()
|
get() = userProvider.currentUser.blockingGet()
|
||||||
|
|
||||||
override fun listFolder(path: String):
|
override fun listFolder(path: String): Observable<List<RemoteFileBrowserItem>> {
|
||||||
Observable<List<RemoteFileBrowserItem>> {
|
|
||||||
return Observable.fromCallable {
|
return Observable.fromCallable {
|
||||||
val operation =
|
val operation =
|
||||||
ReadFolderListingOperation(
|
ReadFolderListingOperation(
|
||||||
|
@ -26,11 +26,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface CallRecordingRepository {
|
interface CallRecordingRepository {
|
||||||
|
|
||||||
fun startRecording(
|
fun startRecording(roomToken: String): Observable<StartCallRecordingModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<StartCallRecordingModel>
|
|
||||||
|
|
||||||
fun stopRecording(
|
fun stopRecording(roomToken: String): Observable<StopCallRecordingModel>
|
||||||
roomToken: String
|
|
||||||
): Observable<StopCallRecordingModel>
|
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,7 @@ class CallRecordingRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
|
|
||||||
var apiVersion = 1
|
var apiVersion = 1
|
||||||
|
|
||||||
override fun startRecording(
|
override fun startRecording(roomToken: String): Observable<StartCallRecordingModel> {
|
||||||
roomToken: String
|
|
||||||
): Observable<StartCallRecordingModel> {
|
|
||||||
return ncApi.startRecording(
|
return ncApi.startRecording(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForRecording(
|
ApiUtils.getUrlForRecording(
|
||||||
@ -51,9 +49,7 @@ class CallRecordingRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
).map { mapToStartCallRecordingModel(it.ocs?.meta!!) }
|
).map { mapToStartCallRecordingModel(it.ocs?.meta!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stopRecording(
|
override fun stopRecording(roomToken: String): Observable<StopCallRecordingModel> {
|
||||||
roomToken: String
|
|
||||||
): Observable<StopCallRecordingModel> {
|
|
||||||
return ncApi.stopRecording(
|
return ncApi.stopRecording(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForRecording(
|
ApiUtils.getUrlForRecording(
|
||||||
@ -64,18 +60,14 @@ class CallRecordingRepositoryImpl(private val ncApi: NcApi, currentUserProvider:
|
|||||||
).map { mapToStopCallRecordingModel(it.ocs?.meta!!) }
|
).map { mapToStopCallRecordingModel(it.ocs?.meta!!) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToStartCallRecordingModel(
|
private fun mapToStartCallRecordingModel(response: GenericMeta): StartCallRecordingModel {
|
||||||
response: GenericMeta
|
|
||||||
): StartCallRecordingModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return StartCallRecordingModel(
|
return StartCallRecordingModel(
|
||||||
success
|
success
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun mapToStopCallRecordingModel(
|
private fun mapToStopCallRecordingModel(response: GenericMeta): StopCallRecordingModel {
|
||||||
response: GenericMeta
|
|
||||||
): StopCallRecordingModel {
|
|
||||||
val success = response.statusCode == HTTP_OK
|
val success = response.statusCode == HTTP_OK
|
||||||
return StopCallRecordingModel(
|
return StopCallRecordingModel(
|
||||||
success
|
success
|
||||||
|
@ -27,15 +27,7 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface ReactionsRepository {
|
interface ReactionsRepository {
|
||||||
|
|
||||||
fun addReaction(
|
fun addReaction(roomToken: String, message: ChatMessage, emoji: String): Observable<ReactionAddedModel>
|
||||||
roomToken: String,
|
|
||||||
message: ChatMessage,
|
|
||||||
emoji: String
|
|
||||||
): Observable<ReactionAddedModel>
|
|
||||||
|
|
||||||
fun deleteReaction(
|
fun deleteReaction(roomToken: String, message: ChatMessage, emoji: String): Observable<ReactionDeletedModel>
|
||||||
roomToken: String,
|
|
||||||
message: ChatMessage,
|
|
||||||
emoji: String
|
|
||||||
): Observable<ReactionDeletedModel>
|
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,7 @@ class ReactionsRepositoryImpl(private val ncApi: NcApi, currentUserProvider: Cur
|
|||||||
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
val currentUser: User = currentUserProvider.currentUser.blockingGet()
|
||||||
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
||||||
|
|
||||||
override fun addReaction(
|
override fun addReaction(roomToken: String, message: ChatMessage, emoji: String): Observable<ReactionAddedModel> {
|
||||||
roomToken: String,
|
|
||||||
message: ChatMessage,
|
|
||||||
emoji: String
|
|
||||||
): Observable<ReactionAddedModel> {
|
|
||||||
return ncApi.sendReaction(
|
return ncApi.sendReaction(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlForMessageReaction(
|
ApiUtils.getUrlForMessageReaction(
|
||||||
|
@ -81,8 +81,11 @@ class UnifiedSearchRepositoryImpl(private val api: NcApi, private val userProvid
|
|||||||
private const val ATTRIBUTE_CONVERSATION = "conversation"
|
private const val ATTRIBUTE_CONVERSATION = "conversation"
|
||||||
private const val ATTRIBUTE_MESSAGE_ID = "messageId"
|
private const val ATTRIBUTE_MESSAGE_ID = "messageId"
|
||||||
|
|
||||||
private fun mapToMessageResults(data: UnifiedSearchResponseData, searchTerm: String, limit: Int):
|
private fun mapToMessageResults(
|
||||||
UnifiedSearchRepository.UnifiedSearchResults<SearchMessageEntry> {
|
data: UnifiedSearchResponseData,
|
||||||
|
searchTerm: String,
|
||||||
|
limit: Int
|
||||||
|
): UnifiedSearchRepository.UnifiedSearchResults<SearchMessageEntry> {
|
||||||
val entries = data.entries?.map { it -> mapToMessage(it, searchTerm) }
|
val entries = data.entries?.map { it -> mapToMessage(it, searchTerm) }
|
||||||
val cursor = data.cursor ?: 0
|
val cursor = data.cursor ?: 0
|
||||||
val hasMore = entries?.size == limit
|
val hasMore = entries?.size == limit
|
||||||
|
@ -28,16 +28,9 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
interface SharedItemsRepository {
|
interface SharedItemsRepository {
|
||||||
|
|
||||||
fun media(
|
fun media(parameters: Parameters, type: SharedItemType): Observable<SharedItems>?
|
||||||
parameters: Parameters,
|
|
||||||
type: SharedItemType
|
|
||||||
): Observable<SharedItems>?
|
|
||||||
|
|
||||||
fun media(
|
fun media(parameters: Parameters, type: SharedItemType, lastKnownMessageId: Int?): Observable<SharedItems>?
|
||||||
parameters: Parameters,
|
|
||||||
type: SharedItemType,
|
|
||||||
lastKnownMessageId: Int?
|
|
||||||
): Observable<SharedItems>?
|
|
||||||
|
|
||||||
fun availableTypes(parameters: Parameters): Observable<Set<SharedItemType>>
|
fun availableTypes(parameters: Parameters): Observable<Set<SharedItemType>>
|
||||||
|
|
||||||
|
@ -48,10 +48,7 @@ import javax.inject.Inject
|
|||||||
class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi, private val dateUtils: DateUtils) :
|
class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi, private val dateUtils: DateUtils) :
|
||||||
SharedItemsRepository {
|
SharedItemsRepository {
|
||||||
|
|
||||||
override fun media(
|
override fun media(parameters: SharedItemsRepository.Parameters, type: SharedItemType): Observable<SharedItems>? {
|
||||||
parameters: SharedItemsRepository.Parameters,
|
|
||||||
type: SharedItemType
|
|
||||||
): Observable<SharedItems>? {
|
|
||||||
return media(parameters, type, null)
|
return media(parameters, type, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,8 @@ class SharedItemsViewModel @Inject constructor(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun chooseInitialType(newTypes: Set<SharedItemType>): SharedItemType = when {
|
private fun chooseInitialType(newTypes: Set<SharedItemType>): SharedItemType =
|
||||||
|
when {
|
||||||
newTypes.contains(SharedItemType.MEDIA) -> SharedItemType.MEDIA
|
newTypes.contains(SharedItemType.MEDIA) -> SharedItemType.MEDIA
|
||||||
else -> newTypes.toList().first()
|
else -> newTypes.toList().first()
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,5 @@ interface TranslateRepository {
|
|||||||
fromLanguage: String?
|
fromLanguage: String?
|
||||||
): Observable<String>
|
): Observable<String>
|
||||||
|
|
||||||
fun getLanguages(
|
fun getLanguages(authorization: String, url: String): Observable<List<Language>>
|
||||||
authorization: String,
|
|
||||||
url: String
|
|
||||||
): Observable<List<Language>>
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,12 @@ class TranslateViewModel @Inject constructor(
|
|||||||
val currentUser: User = userManager.currentUser.blockingGet()
|
val currentUser: User = userManager.currentUser.blockingGet()
|
||||||
val authorization: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
val authorization: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)
|
||||||
val url: String = ApiUtils.getUrlForTranslation(currentUser.baseUrl)
|
val url: String = ApiUtils.getUrlForTranslation(currentUser.baseUrl)
|
||||||
val calculatedFromLanguage = if (fromLanguage == null || fromLanguage == "") { null } else { fromLanguage }
|
val calculatedFromLanguage =
|
||||||
|
if (fromLanguage == null || fromLanguage == "") {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
fromLanguage
|
||||||
|
}
|
||||||
Log.i(TAG, "translateMessage Called")
|
Log.i(TAG, "translateMessage Called")
|
||||||
repository.translateMessage(
|
repository.translateMessage(
|
||||||
authorization,
|
authorization,
|
||||||
|
@ -299,11 +299,8 @@ class DateTimePickerFragment(
|
|||||||
private const val HOUR_SIX_PM = 18
|
private const val HOUR_SIX_PM = 18
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(
|
fun newInstance(token: String, id: String, chatViewModel: ChatViewModel) =
|
||||||
token: String,
|
DateTimePickerFragment(
|
||||||
id: String,
|
|
||||||
chatViewModel: ChatViewModel
|
|
||||||
) = DateTimePickerFragment(
|
|
||||||
token,
|
token,
|
||||||
id,
|
id,
|
||||||
chatViewModel
|
chatViewModel
|
||||||
|
@ -93,8 +93,7 @@ class FileAttachmentPreviewFragment(
|
|||||||
filenames: String,
|
filenames: String,
|
||||||
filesToUpload: MutableList<String>,
|
filesToUpload: MutableList<String>,
|
||||||
functionToCall: (files: MutableList<String>, caption: String) -> Unit
|
functionToCall: (files: MutableList<String>, caption: String) -> Unit
|
||||||
) =
|
) = FileAttachmentPreviewFragment(filenames, filesToUpload, functionToCall)
|
||||||
FileAttachmentPreviewFragment(filenames, filesToUpload, functionToCall)
|
|
||||||
val TAG: String = FilterConversationFragment::class.java.simpleName
|
val TAG: String = FilterConversationFragment::class.java.simpleName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,7 @@ class FilterConversationFragment(
|
|||||||
return MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create()
|
return MaterialAlertDialogBuilder(requireContext()).setView(dialogView).create()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View? {
|
|
||||||
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
||||||
setUpColors()
|
setUpColors()
|
||||||
setUpListeners()
|
setUpListeners()
|
||||||
|
@ -83,9 +83,7 @@ class SaveToStorageDialogFragment : DialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("LongLogTag")
|
@SuppressLint("LongLogTag")
|
||||||
private fun saveImageToStorage(
|
private fun saveImageToStorage(fileName: String) {
|
||||||
fileName: String
|
|
||||||
) {
|
|
||||||
val sourceFilePath = requireContext().cacheDir.path
|
val sourceFilePath = requireContext().cacheDir.path
|
||||||
val workerTag = SAVE_TO_STORAGE_WORKER_PREFIX + fileName
|
val workerTag = SAVE_TO_STORAGE_WORKER_PREFIX + fileName
|
||||||
|
|
||||||
|
@ -350,9 +350,7 @@ class SetStatusDialogFragment :
|
|||||||
return returnValue
|
return returnValue
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun clearAtToUnixTimeTypeEndOf(
|
private fun clearAtToUnixTimeTypeEndOf(clearAt: ClearAt): Long {
|
||||||
clearAt: ClearAt
|
|
||||||
): Long {
|
|
||||||
var returnValue = -1L
|
var returnValue = -1L
|
||||||
if (clearAt.time == "day") {
|
if (clearAt.time == "day") {
|
||||||
val date = Calendar.getInstance().apply {
|
val date = Calendar.getInstance().apply {
|
||||||
|
@ -295,11 +295,7 @@ class TalkSpecificViewThemeUtils @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun themeAndHighlightText(
|
fun themeAndHighlightText(textView: TextView, originalText: String?, c: String?) {
|
||||||
textView: TextView,
|
|
||||||
originalText: String?,
|
|
||||||
c: String?
|
|
||||||
) {
|
|
||||||
withScheme(textView) { scheme ->
|
withScheme(textView) { scheme ->
|
||||||
var constraint = c
|
var constraint = c
|
||||||
constraint = FlexibleUtils.toLowerCase(constraint)
|
constraint = FlexibleUtils.toLowerCase(constraint)
|
||||||
@ -374,11 +370,7 @@ class TalkSpecificViewThemeUtils @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTextColor(
|
fun getTextColor(isOutgoingMessage: Boolean, isSelfReaction: Boolean, binding: ReactionsInsideMessageBinding): Int {
|
||||||
isOutgoingMessage: Boolean,
|
|
||||||
isSelfReaction: Boolean,
|
|
||||||
binding: ReactionsInsideMessageBinding
|
|
||||||
): Int {
|
|
||||||
return withScheme(binding.root) { scheme ->
|
return withScheme(binding.root) { scheme ->
|
||||||
return@withScheme if (!isOutgoingMessage || isSelfReaction) {
|
return@withScheme if (!isOutgoingMessage || isSelfReaction) {
|
||||||
ContextCompat.getColor(binding.root.context, R.color.high_emphasis_text)
|
ContextCompat.getColor(binding.root.context, R.color.high_emphasis_text)
|
||||||
|
@ -83,11 +83,7 @@ class ChunkedFileUploader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.TooGenericExceptionCaught")
|
@Suppress("Detekt.TooGenericExceptionCaught")
|
||||||
fun upload(
|
fun upload(localFile: File, mimeType: MediaType?, targetPath: String): Boolean {
|
||||||
localFile: File,
|
|
||||||
mimeType: MediaType?,
|
|
||||||
targetPath: String
|
|
||||||
): Boolean {
|
|
||||||
try {
|
try {
|
||||||
val uploadFolderUri: String = remoteChunkUrl + "/" + FileUtils.md5Sum(localFile)
|
val uploadFolderUri: String = remoteChunkUrl + "/" + FileUtils.md5Sum(localFile)
|
||||||
val davResource = DavResource(
|
val davResource = DavResource(
|
||||||
@ -137,10 +133,7 @@ class ChunkedFileUploader(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Detekt.ComplexMethod")
|
@Suppress("Detekt.ComplexMethod")
|
||||||
private fun getUploadedChunks(
|
private fun getUploadedChunks(davResource: DavResource, uploadFolderUri: String): MutableList<Chunk> {
|
||||||
davResource: DavResource,
|
|
||||||
uploadFolderUri: String
|
|
||||||
): MutableList<Chunk> {
|
|
||||||
val davResponse = DavResponse()
|
val davResponse = DavResponse()
|
||||||
val memberElements: MutableList<at.bitfire.dav4jvm.Response> = ArrayList()
|
val memberElements: MutableList<at.bitfire.dav4jvm.Response> = ArrayList()
|
||||||
val rootElement = arrayOfNulls<at.bitfire.dav4jvm.Response>(1)
|
val rootElement = arrayOfNulls<at.bitfire.dav4jvm.Response>(1)
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
package com.nextcloud.talk.upload.chunked
|
package com.nextcloud.talk.upload.chunked
|
||||||
|
|
||||||
interface OnDataTransferProgressListener {
|
interface OnDataTransferProgressListener {
|
||||||
fun onTransferProgress(
|
fun onTransferProgress(percentage: Int)
|
||||||
percentage: Int
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,7 @@ class FileUploader(
|
|||||||
val roomToken: String,
|
val roomToken: String,
|
||||||
val ncApi: NcApi
|
val ncApi: NcApi
|
||||||
) {
|
) {
|
||||||
fun upload(
|
fun upload(sourceFileUri: Uri, fileName: String, remotePath: String, metaData: String?): Observable<Boolean> {
|
||||||
sourceFileUri: Uri,
|
|
||||||
fileName: String,
|
|
||||||
remotePath: String,
|
|
||||||
metaData: String?
|
|
||||||
): Observable<Boolean> {
|
|
||||||
return ncApi.uploadFile(
|
return ncApi.uploadFile(
|
||||||
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
||||||
ApiUtils.getUrlForFileUpload(currentUser.baseUrl, currentUser.userId, remotePath),
|
ApiUtils.getUrlForFileUpload(currentUser.baseUrl, currentUser.userId, remotePath),
|
||||||
|
@ -35,21 +35,13 @@ object BitmapShrinker {
|
|||||||
private const val DEGREES_270 = 270f
|
private const val DEGREES_270 = 270f
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun shrinkBitmap(
|
fun shrinkBitmap(path: String, reqWidth: Int, reqHeight: Int): Bitmap {
|
||||||
path: String,
|
|
||||||
reqWidth: Int,
|
|
||||||
reqHeight: Int
|
|
||||||
): Bitmap {
|
|
||||||
val bitmap = decodeBitmap(path, reqWidth, reqHeight)
|
val bitmap = decodeBitmap(path, reqWidth, reqHeight)
|
||||||
return rotateBitmap(path, bitmap)
|
return rotateBitmap(path, bitmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
||||||
private fun decodeBitmap(
|
private fun decodeBitmap(path: String, requestedWidth: Int, requestedHeight: Int): Bitmap {
|
||||||
path: String,
|
|
||||||
requestedWidth: Int,
|
|
||||||
requestedHeight: Int
|
|
||||||
): Bitmap {
|
|
||||||
return BitmapFactory.Options().run {
|
return BitmapFactory.Options().run {
|
||||||
inJustDecodeBounds = true
|
inJustDecodeBounds = true
|
||||||
BitmapFactory.decodeFile(path, this)
|
BitmapFactory.decodeFile(path, this)
|
||||||
@ -60,11 +52,7 @@ object BitmapShrinker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
// solution inspired by https://developer.android.com/topic/performance/graphics/load-bitmap
|
||||||
private fun getInSampleSize(
|
private fun getInSampleSize(options: BitmapFactory.Options, requestedWidth: Int, requestedHeight: Int): Int {
|
||||||
options: BitmapFactory.Options,
|
|
||||||
requestedWidth: Int,
|
|
||||||
requestedHeight: Int
|
|
||||||
): Int {
|
|
||||||
val (height: Int, width: Int) = options.run { outHeight to outWidth }
|
val (height: Int, width: Int) = options.run { outHeight to outWidth }
|
||||||
var inSampleSize = 1
|
var inSampleSize = 1
|
||||||
if (height > requestedHeight || width > requestedWidth) {
|
if (height > requestedHeight || width > requestedWidth) {
|
||||||
|
@ -37,14 +37,17 @@ class DateUtils(val context: Context) {
|
|||||||
|
|
||||||
/* date formatter in local timezone and locale */
|
/* date formatter in local timezone and locale */
|
||||||
private var format: DateFormat = DateFormat.getDateTimeInstance(
|
private var format: DateFormat = DateFormat.getDateTimeInstance(
|
||||||
DateFormat.DEFAULT, // dateStyle
|
// dateStyle
|
||||||
DateFormat.SHORT, // timeStyle
|
DateFormat.DEFAULT,
|
||||||
|
// timeStyle
|
||||||
|
DateFormat.SHORT,
|
||||||
context.resources.configuration.locales[0]
|
context.resources.configuration.locales[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
/* date formatter in local timezone and locale */
|
/* date formatter in local timezone and locale */
|
||||||
private var formatTime: DateFormat = DateFormat.getTimeInstance(
|
private var formatTime: DateFormat = DateFormat.getTimeInstance(
|
||||||
DateFormat.SHORT, // timeStyle
|
// timeStyle
|
||||||
|
DateFormat.SHORT,
|
||||||
context.resources.configuration.locales[0]
|
context.resources.configuration.locales[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ import coil.target.Target;
|
|||||||
import coil.transform.CircleCropTransformation;
|
import coil.transform.CircleCropTransformation;
|
||||||
import third.parties.fresco.BetterImageSpan;
|
import third.parties.fresco.BetterImageSpan;
|
||||||
|
|
||||||
import static com.nextcloud.talk.utils.FileSortOrder.sort_a_to_z_id;
|
import static com.nextcloud.talk.utils.FileSortOrder.SORT_A_TO_Z_ID;
|
||||||
import static com.nextcloud.talk.utils.FileSortOrder.sort_big_to_small_id;
|
import static com.nextcloud.talk.utils.FileSortOrder.SORT_BIG_TO_SMALL_ID;
|
||||||
import static com.nextcloud.talk.utils.FileSortOrder.sort_new_to_old_id;
|
import static com.nextcloud.talk.utils.FileSortOrder.SORT_NEW_TO_OLD_ID;
|
||||||
import static com.nextcloud.talk.utils.FileSortOrder.sort_old_to_new_id;
|
import static com.nextcloud.talk.utils.FileSortOrder.SORT_OLD_TO_NEW_ID;
|
||||||
import static com.nextcloud.talk.utils.FileSortOrder.sort_small_to_big_id;
|
import static com.nextcloud.talk.utils.FileSortOrder.SORT_SMALL_TO_BIG_ID;
|
||||||
import static com.nextcloud.talk.utils.FileSortOrder.sort_z_to_a_id;
|
import static com.nextcloud.talk.utils.FileSortOrder.SORT_Z_TO_A_ID;
|
||||||
|
|
||||||
public class DisplayUtils {
|
public class DisplayUtils {
|
||||||
private static final String TAG = DisplayUtils.class.getSimpleName();
|
private static final String TAG = DisplayUtils.class.getSimpleName();
|
||||||
@ -476,17 +476,17 @@ public class DisplayUtils {
|
|||||||
public static @StringRes
|
public static @StringRes
|
||||||
int getSortOrderStringId(FileSortOrder sortOrder) {
|
int getSortOrderStringId(FileSortOrder sortOrder) {
|
||||||
switch (sortOrder.getName()) {
|
switch (sortOrder.getName()) {
|
||||||
case sort_z_to_a_id:
|
case SORT_Z_TO_A_ID:
|
||||||
return R.string.menu_item_sort_by_name_z_a;
|
return R.string.menu_item_sort_by_name_z_a;
|
||||||
case sort_new_to_old_id:
|
case SORT_NEW_TO_OLD_ID:
|
||||||
return R.string.menu_item_sort_by_date_newest_first;
|
return R.string.menu_item_sort_by_date_newest_first;
|
||||||
case sort_old_to_new_id:
|
case SORT_OLD_TO_NEW_ID:
|
||||||
return R.string.menu_item_sort_by_date_oldest_first;
|
return R.string.menu_item_sort_by_date_oldest_first;
|
||||||
case sort_big_to_small_id:
|
case SORT_BIG_TO_SMALL_ID:
|
||||||
return R.string.menu_item_sort_by_size_biggest_first;
|
return R.string.menu_item_sort_by_size_biggest_first;
|
||||||
case sort_small_to_big_id:
|
case SORT_SMALL_TO_BIG_ID:
|
||||||
return R.string.menu_item_sort_by_size_smallest_first;
|
return R.string.menu_item_sort_by_size_smallest_first;
|
||||||
case sort_a_to_z_id:
|
case SORT_A_TO_Z_ID:
|
||||||
default:
|
default:
|
||||||
return R.string.menu_item_sort_by_name_a_z;
|
return R.string.menu_item_sort_by_name_a_z;
|
||||||
}
|
}
|
||||||
|
@ -27,19 +27,19 @@ import java.util.Collections
|
|||||||
|
|
||||||
open class FileSortOrder(var name: String, var isAscending: Boolean) {
|
open class FileSortOrder(var name: String, var isAscending: Boolean) {
|
||||||
companion object {
|
companion object {
|
||||||
const val sort_a_to_z_id = "sort_a_to_z"
|
const val SORT_A_TO_Z_ID = "sort_a_to_z"
|
||||||
const val sort_z_to_a_id = "sort_z_to_a"
|
const val SORT_Z_TO_A_ID = "sort_z_to_a"
|
||||||
const val sort_old_to_new_id = "sort_old_to_new"
|
const val SORT_OLD_TO_NEW_ID = "sort_old_to_new"
|
||||||
const val sort_new_to_old_id = "sort_new_to_old"
|
const val SORT_NEW_TO_OLD_ID = "sort_new_to_old"
|
||||||
const val sort_small_to_big_id = "sort_small_to_big"
|
const val SORT_SMALL_TO_BIG_ID = "sort_small_to_big"
|
||||||
const val sort_big_to_small_id = "sort_big_to_small"
|
const val SORT_BIG_TO_SMALL_ID = "sort_big_to_small"
|
||||||
|
|
||||||
val sort_a_to_z: FileSortOrder = FileSortOrderByName(sort_a_to_z_id, true)
|
val sort_a_to_z: FileSortOrder = FileSortOrderByName(SORT_A_TO_Z_ID, true)
|
||||||
val sort_z_to_a: FileSortOrder = FileSortOrderByName(sort_z_to_a_id, false)
|
val sort_z_to_a: FileSortOrder = FileSortOrderByName(SORT_Z_TO_A_ID, false)
|
||||||
val sort_old_to_new: FileSortOrder = FileSortOrderByDate(sort_old_to_new_id, true)
|
val sort_old_to_new: FileSortOrder = FileSortOrderByDate(SORT_OLD_TO_NEW_ID, true)
|
||||||
val sort_new_to_old: FileSortOrder = FileSortOrderByDate(sort_new_to_old_id, false)
|
val sort_new_to_old: FileSortOrder = FileSortOrderByDate(SORT_NEW_TO_OLD_ID, false)
|
||||||
val sort_small_to_big: FileSortOrder = FileSortOrderBySize(sort_small_to_big_id, true)
|
val sort_small_to_big: FileSortOrder = FileSortOrderBySize(SORT_SMALL_TO_BIG_ID, true)
|
||||||
val sort_big_to_small: FileSortOrder = FileSortOrderBySize(sort_big_to_small_id, false)
|
val sort_big_to_small: FileSortOrder = FileSortOrderBySize(SORT_BIG_TO_SMALL_ID, false)
|
||||||
|
|
||||||
val sortOrders: Map<String, FileSortOrder> = mapOf(
|
val sortOrders: Map<String, FileSortOrder> = mapOf(
|
||||||
sort_a_to_z.name to sort_a_to_z,
|
sort_a_to_z.name to sort_a_to_z,
|
||||||
|
@ -73,10 +73,7 @@ import java.util.concurrent.ExecutionException
|
|||||||
*/
|
*/
|
||||||
class FileViewerUtils(private val context: Context, private val user: User) {
|
class FileViewerUtils(private val context: Context, private val user: User) {
|
||||||
|
|
||||||
fun openFile(
|
fun openFile(message: ChatMessage, progressUi: ProgressUi) {
|
||||||
message: ChatMessage,
|
|
||||||
progressUi: ProgressUi
|
|
||||||
) {
|
|
||||||
val fileName = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_NAME]!!
|
val fileName = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_NAME]!!
|
||||||
val mimetype = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_MIMETYPE]!!
|
val mimetype = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_MIMETYPE]!!
|
||||||
val link = message.selectedIndividualHashMap!!["link"]!!
|
val link = message.selectedIndividualHashMap!!["link"]!!
|
||||||
|
@ -102,10 +102,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createCallsNotificationChannel(
|
private fun createCallsNotificationChannel(context: Context, appPreferences: AppPreferences) {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
) {
|
|
||||||
val audioAttributes =
|
val audioAttributes =
|
||||||
AudioAttributes.Builder()
|
AudioAttributes.Builder()
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||||
@ -126,10 +123,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createMessagesNotificationChannel(
|
private fun createMessagesNotificationChannel(context: Context, appPreferences: AppPreferences) {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
) {
|
|
||||||
val audioAttributes =
|
val audioAttributes =
|
||||||
AudioAttributes.Builder()
|
AudioAttributes.Builder()
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||||
@ -150,9 +144,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createUploadsNotificationChannel(
|
private fun createUploadsNotificationChannel(context: Context) {
|
||||||
context: Context
|
|
||||||
) {
|
|
||||||
createNotificationChannel(
|
createNotificationChannel(
|
||||||
context,
|
context,
|
||||||
Channel(
|
Channel(
|
||||||
@ -166,10 +158,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun registerNotificationChannels(
|
fun registerNotificationChannels(context: Context, appPreferences: AppPreferences) {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
) {
|
|
||||||
createCallsNotificationChannel(context, appPreferences)
|
createCallsNotificationChannel(context, appPreferences)
|
||||||
createMessagesNotificationChannel(context, appPreferences)
|
createMessagesNotificationChannel(context, appPreferences)
|
||||||
createUploadsNotificationChannel(context)
|
createUploadsNotificationChannel(context)
|
||||||
@ -197,10 +186,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.O)
|
@TargetApi(Build.VERSION_CODES.O)
|
||||||
private fun getNotificationChannel(
|
private fun getNotificationChannel(context: Context, channelId: String): NotificationChannel? {
|
||||||
context: Context,
|
|
||||||
channelId: String
|
|
||||||
): NotificationChannel? {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
return notificationManager.getNotificationChannel(channelId)
|
return notificationManager.getNotificationChannel(channelId)
|
||||||
@ -275,10 +261,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isNotificationVisible(
|
fun isNotificationVisible(context: Context?, notificationId: Int): Boolean {
|
||||||
context: Context?,
|
|
||||||
notificationId: Int
|
|
||||||
): Boolean {
|
|
||||||
var isVisible = false
|
var isVisible = false
|
||||||
|
|
||||||
val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = context!!.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
@ -319,10 +302,7 @@ object NotificationUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCallRingtoneUri(
|
fun getCallRingtoneUri(context: Context, appPreferences: AppPreferences): Uri? {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
): Uri? {
|
|
||||||
return getRingtoneUri(
|
return getRingtoneUri(
|
||||||
context,
|
context,
|
||||||
appPreferences.callRingtoneUri,
|
appPreferences.callRingtoneUri,
|
||||||
@ -331,10 +311,7 @@ object NotificationUtils {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMessageRingtoneUri(
|
fun getMessageRingtoneUri(context: Context, appPreferences: AppPreferences): Uri? {
|
||||||
context: Context,
|
|
||||||
appPreferences: AppPreferences
|
|
||||||
): Uri? {
|
|
||||||
return getRingtoneUri(
|
return getRingtoneUri(
|
||||||
context,
|
context,
|
||||||
appPreferences.messageRingtoneUri,
|
appPreferences.messageRingtoneUri,
|
||||||
|
@ -31,11 +31,7 @@ import io.reactivex.schedulers.Schedulers
|
|||||||
object RemoteFileUtils {
|
object RemoteFileUtils {
|
||||||
private val TAG = RemoteFileUtils::class.java.simpleName
|
private val TAG = RemoteFileUtils::class.java.simpleName
|
||||||
|
|
||||||
fun getNewPathIfFileExists(
|
fun getNewPathIfFileExists(ncApi: NcApi, currentUser: User, remotePath: String): String {
|
||||||
ncApi: NcApi,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String
|
|
||||||
): String {
|
|
||||||
var finalPath = remotePath
|
var finalPath = remotePath
|
||||||
val fileExists = doesFileExist(
|
val fileExists = doesFileExist(
|
||||||
ncApi,
|
ncApi,
|
||||||
@ -53,11 +49,7 @@ object RemoteFileUtils {
|
|||||||
return finalPath
|
return finalPath
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doesFileExist(
|
private fun doesFileExist(ncApi: NcApi, currentUser: User, remotePath: String): Observable<Boolean> {
|
||||||
ncApi: NcApi,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String
|
|
||||||
): Observable<Boolean> {
|
|
||||||
return ncApi.checkIfFileExists(
|
return ncApi.checkIfFileExists(
|
||||||
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
ApiUtils.getCredentials(currentUser.username, currentUser.token),
|
||||||
ApiUtils.getUrlForFileUpload(
|
ApiUtils.getUrlForFileUpload(
|
||||||
@ -72,11 +64,7 @@ object RemoteFileUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFileNameWithoutCollision(
|
private fun getFileNameWithoutCollision(ncApi: NcApi, currentUser: User, remotePath: String): String {
|
||||||
ncApi: NcApi,
|
|
||||||
currentUser: User,
|
|
||||||
remotePath: String
|
|
||||||
): String {
|
|
||||||
val extPos = remotePath.lastIndexOf('.')
|
val extPos = remotePath.lastIndexOf('.')
|
||||||
var suffix: String
|
var suffix: String
|
||||||
var extension = ""
|
var extension = ""
|
||||||
|
@ -25,11 +25,7 @@ import com.nextcloud.talk.data.user.model.User
|
|||||||
import com.nextcloud.talk.models.json.conversations.Conversation
|
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||||
|
|
||||||
object ShareUtils {
|
object ShareUtils {
|
||||||
fun getStringForIntent(
|
fun getStringForIntent(context: Context, user: User, conversation: Conversation?): String {
|
||||||
context: Context,
|
|
||||||
user: User,
|
|
||||||
conversation: Conversation?
|
|
||||||
): String {
|
|
||||||
return String.format(
|
return String.format(
|
||||||
context.resources.getString(R.string.nc_share_text),
|
context.resources.getString(R.string.nc_share_text),
|
||||||
user.baseUrl,
|
user.baseUrl,
|
||||||
|
@ -46,7 +46,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
}.getCompleted()
|
}.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyType(proxyType: String?) = runBlocking<Unit> {
|
override fun setProxyType(proxyType: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyType != null) {
|
if (proxyType != null) {
|
||||||
writeString(PROXY_TYPE, proxyType)
|
writeString(PROXY_TYPE, proxyType)
|
||||||
@ -62,7 +63,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_HOST).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_HOST).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyHost(proxyHost: String?) = runBlocking<Unit> {
|
override fun setProxyHost(proxyHost: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyHost != null) {
|
if (proxyHost != null) {
|
||||||
writeString(PROXY_HOST, proxyHost)
|
writeString(PROXY_HOST, proxyHost)
|
||||||
@ -78,7 +80,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_PORT).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_PORT).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyPort(proxyPort: String?) = runBlocking<Unit> {
|
override fun setProxyPort(proxyPort: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyPort != null) {
|
if (proxyPort != null) {
|
||||||
writeString(PROXY_PORT, proxyPort)
|
writeString(PROXY_PORT, proxyPort)
|
||||||
@ -94,7 +97,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(PROXY_CRED).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(PROXY_CRED).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyNeedsCredentials(proxyNeedsCredentials: Boolean) = runBlocking<Unit> {
|
override fun setProxyNeedsCredentials(proxyNeedsCredentials: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(PROXY_CRED, proxyNeedsCredentials)
|
writeBoolean(PROXY_CRED, proxyNeedsCredentials)
|
||||||
}
|
}
|
||||||
@ -108,7 +112,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_USERNAME).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_USERNAME).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyUsername(proxyUsername: String?) = runBlocking<Unit> {
|
override fun setProxyUsername(proxyUsername: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyUsername != null) {
|
if (proxyUsername != null) {
|
||||||
writeString(PROXY_USERNAME, proxyUsername)
|
writeString(PROXY_USERNAME, proxyUsername)
|
||||||
@ -124,7 +129,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PROXY_PASSWORD).first() } }.getCompleted()
|
return runBlocking { async { readString(PROXY_PASSWORD).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setProxyPassword(proxyPassword: String?) = runBlocking<Unit> {
|
override fun setProxyPassword(proxyPassword: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (proxyPassword != null) {
|
if (proxyPassword != null) {
|
||||||
writeString(PROXY_PASSWORD, proxyPassword)
|
writeString(PROXY_PASSWORD, proxyPassword)
|
||||||
@ -140,7 +146,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(PUSH_TOKEN).first() } }.getCompleted()
|
return runBlocking { async { readString(PUSH_TOKEN).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPushToken(pushToken: String?) = runBlocking<Unit> {
|
override fun setPushToken(pushToken: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (pushToken != null) {
|
if (pushToken != null) {
|
||||||
writeString(PUSH_TOKEN, pushToken)
|
writeString(PUSH_TOKEN, pushToken)
|
||||||
@ -156,7 +163,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(TEMP_CLIENT_CERT_ALIAS).first() } }.getCompleted()
|
return runBlocking { async { readString(TEMP_CLIENT_CERT_ALIAS).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setTemporaryClientCertAlias(alias: String?) = runBlocking<Unit> {
|
override fun setTemporaryClientCertAlias(alias: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (alias != null) {
|
if (alias != null) {
|
||||||
writeString(TEMP_CLIENT_CERT_ALIAS, alias)
|
writeString(TEMP_CLIENT_CERT_ALIAS, alias)
|
||||||
@ -172,7 +180,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(PUSH_TO_TALK_INTRO_SHOWN).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(PUSH_TO_TALK_INTRO_SHOWN).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPushToTalkIntroShown(shown: Boolean) = runBlocking<Unit> {
|
override fun setPushToTalkIntroShown(shown: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(PUSH_TO_TALK_INTRO_SHOWN, shown)
|
writeBoolean(PUSH_TO_TALK_INTRO_SHOWN, shown)
|
||||||
}
|
}
|
||||||
@ -186,7 +195,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(CALL_RINGTONE).first() } }.getCompleted()
|
return runBlocking { async { readString(CALL_RINGTONE).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setCallRingtoneUri(value: String?) = runBlocking<Unit> {
|
override fun setCallRingtoneUri(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
writeString(CALL_RINGTONE, value)
|
writeString(CALL_RINGTONE, value)
|
||||||
@ -202,7 +212,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readString(MESSAGE_RINGTONE).first() } }.getCompleted()
|
return runBlocking { async { readString(MESSAGE_RINGTONE).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setMessageRingtoneUri(value: String?) = runBlocking<Unit> {
|
override fun setMessageRingtoneUri(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
writeString(MESSAGE_RINGTONE, value)
|
writeString(MESSAGE_RINGTONE, value)
|
||||||
@ -218,7 +229,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V2).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V2).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setNotificationChannelIsUpgradedToV2(value: Boolean) = runBlocking<Unit> {
|
override fun setNotificationChannelIsUpgradedToV2(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(NOTIFY_UPGRADE_V2, value)
|
writeBoolean(NOTIFY_UPGRADE_V2, value)
|
||||||
}
|
}
|
||||||
@ -232,7 +244,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V3).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(NOTIFY_UPGRADE_V3).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setNotificationChannelIsUpgradedToV3(value: Boolean) = runBlocking<Unit> {
|
override fun setNotificationChannelIsUpgradedToV3(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(NOTIFY_UPGRADE_V3, value)
|
writeBoolean(NOTIFY_UPGRADE_V3, value)
|
||||||
}
|
}
|
||||||
@ -246,7 +259,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(SCREEN_SECURITY).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(SCREEN_SECURITY).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setScreenSecurity(value: Boolean) = runBlocking<Unit> {
|
override fun setScreenSecurity(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(SCREEN_SECURITY, value)
|
writeBoolean(SCREEN_SECURITY, value)
|
||||||
}
|
}
|
||||||
@ -260,7 +274,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(SCREEN_LOCK).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(SCREEN_LOCK).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setScreenLock(value: Boolean) = runBlocking<Unit> {
|
override fun setScreenLock(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(SCREEN_LOCK, value)
|
writeBoolean(SCREEN_LOCK, value)
|
||||||
}
|
}
|
||||||
@ -275,7 +290,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read
|
return read
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setIncognitoKeyboard(value: Boolean) = runBlocking<Unit> {
|
override fun setIncognitoKeyboard(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(INCOGNITO_KEYBOARD, value)
|
writeBoolean(INCOGNITO_KEYBOARD, value)
|
||||||
}
|
}
|
||||||
@ -289,13 +305,15 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(PHONE_BOOK_INTEGRATION).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(PHONE_BOOK_INTEGRATION).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPhoneBookIntegration(value: Boolean) = runBlocking<Unit> {
|
override fun setPhoneBookIntegration(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(PHONE_BOOK_INTEGRATION, value)
|
writeBoolean(PHONE_BOOK_INTEGRATION, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun removeLinkPreviews() = runBlocking<Unit> {
|
override fun removeLinkPreviews() =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(LINK_PREVIEWS, false)
|
writeBoolean(LINK_PREVIEWS, false)
|
||||||
}
|
}
|
||||||
@ -307,7 +325,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read.ifEmpty { default }
|
return read.ifEmpty { default }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setScreenLockTimeout(value: String?) = runBlocking<Unit> {
|
override fun setScreenLockTimeout(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
writeString(SCREEN_LOCK_TIMEOUT, value)
|
writeString(SCREEN_LOCK_TIMEOUT, value)
|
||||||
@ -326,7 +345,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read.ifEmpty { default }
|
return read.ifEmpty { default }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setTheme(value: String?) = runBlocking<Unit> {
|
override fun setTheme(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
val key = context.resources.getString(R.string.nc_settings_theme_key)
|
val key = context.resources.getString(R.string.nc_settings_theme_key)
|
||||||
@ -344,7 +364,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read
|
return read
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDbCypherToUpgrade(value: Boolean) = runBlocking<Unit> {
|
override fun setDbCypherToUpgrade(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(DB_CYPHER_V4_UPGRADE, value)
|
writeBoolean(DB_CYPHER_V4_UPGRADE, value)
|
||||||
}
|
}
|
||||||
@ -354,13 +375,15 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(DB_ROOM_MIGRATED).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(DB_ROOM_MIGRATED).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setIsDbRoomMigrated(value: Boolean) = runBlocking<Unit> {
|
override fun setIsDbRoomMigrated(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(DB_ROOM_MIGRATED, value)
|
writeBoolean(DB_ROOM_MIGRATED, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setPhoneBookIntegrationLastRun(currentTimeMillis: Long) = runBlocking<Unit> {
|
override fun setPhoneBookIntegrationLastRun(currentTimeMillis: Long) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeLong(PHONE_BOOK_INTEGRATION_LAST_RUN, currentTimeMillis)
|
writeLong(PHONE_BOOK_INTEGRATION_LAST_RUN, currentTimeMillis)
|
||||||
}
|
}
|
||||||
@ -376,7 +399,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setReadPrivacy(value: Boolean) = runBlocking<Unit> {
|
override fun setReadPrivacy(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
val key = context.resources.getString(R.string.nc_settings_read_privacy_key)
|
val key = context.resources.getString(R.string.nc_settings_read_privacy_key)
|
||||||
async {
|
async {
|
||||||
writeBoolean(key, value)
|
writeBoolean(key, value)
|
||||||
@ -388,7 +412,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(key).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(key).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setTypingStatus(value: Boolean) = runBlocking<Unit> {
|
override fun setTypingStatus(value: Boolean) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeBoolean(TYPING_STATUS, value)
|
writeBoolean(TYPING_STATUS, value)
|
||||||
}
|
}
|
||||||
@ -398,7 +423,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return runBlocking { async { readBoolean(TYPING_STATUS).first() } }.getCompleted()
|
return runBlocking { async { readBoolean(TYPING_STATUS).first() } }.getCompleted()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setSorting(value: String?) = runBlocking<Unit> {
|
override fun setSorting(value: String?) =
|
||||||
|
runBlocking<Unit> {
|
||||||
val key = context.resources.getString(R.string.nc_file_browser_sort_by_key)
|
val key = context.resources.getString(R.string.nc_file_browser_sort_by_key)
|
||||||
async {
|
async {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@ -414,7 +440,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
return read.ifEmpty { default }
|
return read.ifEmpty { default }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun saveWaveFormForFile(filename: String, array: Array<Float>) = runBlocking<Unit> {
|
override fun saveWaveFormForFile(filename: String, array: Array<Float>) =
|
||||||
|
runBlocking<Unit> {
|
||||||
async {
|
async {
|
||||||
writeString(filename, array.contentToString())
|
writeString(filename, array.contentToString())
|
||||||
}
|
}
|
||||||
@ -427,7 +454,8 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
|
|
||||||
override fun clear() {}
|
override fun clear() {}
|
||||||
|
|
||||||
private suspend fun writeString(key: String, value: String) = context.dataStore.edit { settings ->
|
private suspend fun writeString(key: String, value: String) =
|
||||||
|
context.dataStore.edit { settings ->
|
||||||
settings[
|
settings[
|
||||||
stringPreferencesKey(
|
stringPreferencesKey(
|
||||||
key
|
key
|
||||||
@ -439,11 +467,13 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
* Returns a Flow of type String
|
* Returns a Flow of type String
|
||||||
* @param key the key of the persisted data to be observed
|
* @param key the key of the persisted data to be observed
|
||||||
*/
|
*/
|
||||||
fun readString(key: String, defaultValue: String = ""): Flow<String> = context.dataStore.data.map { preferences ->
|
fun readString(key: String, defaultValue: String = ""): Flow<String> =
|
||||||
|
context.dataStore.data.map { preferences ->
|
||||||
preferences[stringPreferencesKey(key)] ?: defaultValue
|
preferences[stringPreferencesKey(key)] ?: defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun writeBoolean(key: String, value: Boolean) = context.dataStore.edit { settings ->
|
private suspend fun writeBoolean(key: String, value: Boolean) =
|
||||||
|
context.dataStore.edit { settings ->
|
||||||
settings[
|
settings[
|
||||||
booleanPreferencesKey(
|
booleanPreferencesKey(
|
||||||
key
|
key
|
||||||
@ -460,15 +490,13 @@ class AppPreferencesImpl(val context: Context) : AppPreferences {
|
|||||||
preferences[booleanPreferencesKey(key)] ?: defaultValue
|
preferences[booleanPreferencesKey(key)] ?: defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun writeLong(key: String, value: Long) = context.dataStore.edit { settings ->
|
private suspend fun writeLong(key: String, value: Long) =
|
||||||
settings[
|
context.dataStore.edit { settings ->
|
||||||
longPreferencesKey(
|
settings[longPreferencesKey(key)] = value
|
||||||
key
|
|
||||||
)
|
|
||||||
] = value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readLong(key: String, defaultValue: Long = 0): Flow<Long> = context.dataStore.data.map { preferences ->
|
private fun readLong(key: String, defaultValue: Long = 0): Flow<Long> =
|
||||||
|
context.dataStore.data.map { preferences ->
|
||||||
preferences[longPreferencesKey(key)] ?: defaultValue
|
preferences[longPreferencesKey(key)] ?: defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +55,9 @@ class SSLSocketFactoryCompat(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getDefaultCipherSuites(): Array<String>? = cipherSuites
|
override fun getDefaultCipherSuites(): Array<String>? = cipherSuites ?: delegate.defaultCipherSuites
|
||||||
?: delegate.defaultCipherSuites
|
|
||||||
|
|
||||||
override fun getSupportedCipherSuites(): Array<String>? = cipherSuites
|
override fun getSupportedCipherSuites(): Array<String>? = cipherSuites ?: delegate.supportedCipherSuites
|
||||||
?: delegate.supportedCipherSuites
|
|
||||||
|
|
||||||
override fun createSocket(s: Socket, host: String, port: Int, autoClose: Boolean): Socket {
|
override fun createSocket(s: Socket, host: String, port: Int, autoClose: Boolean): Socket {
|
||||||
val ssl = delegate.createSocket(s, host, port, autoClose)
|
val ssl = delegate.createSocket(s, host, port, autoClose)
|
||||||
|
@ -65,13 +65,7 @@ open class BetterImageSpan @JvmOverloads constructor(
|
|||||||
/**
|
/**
|
||||||
* Returns the width of the image span and increases the height if font metrics are available.
|
* Returns the width of the image span and increases the height if font metrics are available.
|
||||||
*/
|
*/
|
||||||
override fun getSize(
|
override fun getSize(paint: Paint, text: CharSequence, start: Int, end: Int, fontMetrics: FontMetricsInt?): Int {
|
||||||
paint: Paint,
|
|
||||||
text: CharSequence,
|
|
||||||
start: Int,
|
|
||||||
end: Int,
|
|
||||||
fontMetrics: FontMetricsInt?
|
|
||||||
): Int {
|
|
||||||
updateBounds()
|
updateBounds()
|
||||||
if (fontMetrics == null) {
|
if (fontMetrics == null) {
|
||||||
return mWidth
|
return mWidth
|
||||||
|
@ -28,15 +28,11 @@ import io.reactivex.Observable
|
|||||||
|
|
||||||
class FakeCallRecordingRepository : CallRecordingRepository {
|
class FakeCallRecordingRepository : CallRecordingRepository {
|
||||||
|
|
||||||
override fun startRecording(
|
override fun startRecording(roomToken: String): Observable<StartCallRecordingModel> {
|
||||||
roomToken: String
|
|
||||||
): Observable<StartCallRecordingModel> {
|
|
||||||
return Observable.just(StartCallRecordingModel(true))
|
return Observable.just(StartCallRecordingModel(true))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stopRecording(
|
override fun stopRecording(roomToken: String): Observable<StopCallRecordingModel> {
|
||||||
roomToken: String
|
|
||||||
): Observable<StopCallRecordingModel> {
|
|
||||||
return Observable.just(StopCallRecordingModel(true))
|
return Observable.just(StopCallRecordingModel(true))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ buildscript {
|
|||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}"
|
classpath "org.jetbrains.kotlin:kotlin-serialization:${kotlinVersion}"
|
||||||
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:6.0.2'
|
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:6.0.2'
|
||||||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.4"
|
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.4"
|
||||||
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.6.1"
|
classpath "org.jlleitschuh.gradle:ktlint-gradle:12.0.2"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
@ -35,7 +35,6 @@ org.gradle.jvmargs=-XX:MaxHeapSize\=2048m -Xmx2048m
|
|||||||
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
|
||||||
android.nonTransitiveRClass=false
|
android.nonTransitiveRClass=false
|
||||||
android.nonFinalResIds=false
|
android.nonFinalResIds=false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user