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