mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
ktlint: No whitespace expected between opening parenthesis and first parameter name
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
f2b86a9d86
commit
627e9d5c20
@ -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)
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -2979,9 +2979,7 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
|
||||
fun leaveRoom(
|
||||
funToCallWhenLeaveSuccessful: (() -> Unit)?
|
||||
) {
|
||||
fun leaveRoom(funToCallWhenLeaveSuccessful: (() -> Unit)?) {
|
||||
logConversationInfos("leaveRoom")
|
||||
|
||||
var apiVersion = 1
|
||||
@ -3147,11 +3145,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
|
||||
}
|
||||
@ -3471,10 +3465,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) {
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -524,11 +524,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,
|
||||
|
@ -35,10 +35,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]
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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>>
|
||||
}
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user