Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-20.0] Fixing remind-me-later options #4140

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f1db4d2
bump version to 20.0.0 RC1
mahibi Aug 12, 2024
03b95de
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 13, 2024
ee358d1
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 14, 2024
13f48ce
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 15, 2024
2279740
Modify string connection_gained
sowjanyakch Aug 13, 2024
b59050c
chore(i18n): Capitalization standardized
rakekniven Aug 13, 2024
374503d
Merge pull request #4084 from nextcloud/backport/4073/stable-20.0
sowjanyakch Aug 15, 2024
7e7a558
Merge pull request #4083 from nextcloud/backport/4077/stable-20.0
sowjanyakch Aug 15, 2024
472d274
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 15, 2024
08e6037
fix
rapterjet2004 Aug 14, 2024
95de278
Merge pull request #4085 from nextcloud/backport/4081/stable-20.0
sowjanyakch Aug 15, 2024
2be41e2
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 16, 2024
82b977e
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 17, 2024
b613271
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 18, 2024
45b619e
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 20, 2024
d764b1f
fix
rapterjet2004 Aug 16, 2024
7980ea8
Analysis: update lint results to reflect reduced error/warning count
invalid-email-address Aug 21, 2024
68f9ed7
Merge pull request #4103 from nextcloud/backport/4087/stable-20.0
sowjanyakch Aug 22, 2024
3633aff
Got it fixed
rapterjet2004 Aug 22, 2024
8ec675b
Merge pull request #4104 from nextcloud/backport/4086/stable-20.0
rapterjet2004 Aug 22, 2024
8f35704
Got it fixed
rapterjet2004 Aug 22, 2024
d37e21b
Merge pull request #4105 from nextcloud/backport/4095/stable-20.0
rapterjet2004 Aug 22, 2024
a3c2883
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 23, 2024
a849249
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 24, 2024
e54f3af
partial fix - now need to reset highlighting after exit
rapterjet2004 Aug 16, 2024
bfae9ed
Got the highlighting fixed - need to fix the submit button (or disabl…
rapterjet2004 Aug 21, 2024
420451e
Got it fixed
rapterjet2004 Aug 22, 2024
2063e67
Merge pull request #4116 from nextcloud/backport/4088/stable-20.0
sowjanyakch Aug 26, 2024
aab86cd
No Edit Time limit on Note to Self
sowjanyakch Aug 29, 2024
6d666fe
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 30, 2024
8de18c0
Fix(l10n): Update translations from Transifex
nextcloud-bot Sep 1, 2024
4241ab0
Fix(l10n): Update translations from Transifex
nextcloud-bot Sep 2, 2024
57e152b
Merge pull request #4123 from nextcloud/backport/4122/stable-20.0
mahibi Sep 4, 2024
739aef3
Should be fixed for good , need to test though
rapterjet2004 Sep 3, 2024
6cc1599
fixed weekendTimeStamp, added a comment for clarity
rapterjet2004 Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ android {

// mayor.minor.hotfix.increment (for increment: 01-50=Alpha / 51-89=RC / 90-99=stable)
// xx .xxx .xx .xx
versionCode 200000001
versionName "20.0.0 Alpha 01"
versionCode 200000051
versionName "20.0.0 RC1"

flavorDimensions "default"
renderscriptTargetApi 19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class ConversationItem(

val text =
if (
chatMessage?.messageType === MessageType.REGULAR_TEXT_MESSAGE.toString()
chatMessage?.getCalculateMessageType() == MessageType.REGULAR_TEXT_MESSAGE
) {
calculateRegularLastMessageText(appContext)
} else {
Expand All @@ -252,6 +252,8 @@ class ConversationItem(
appContext.getString(R.string.nc_formatted_message_you),
lastMessageDisplayText
)
} else if (model.type == ConversationEnums.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL) {
lastMessageDisplayText
} else {
val authorDisplayName =
if (!TextUtils.isEmpty(chatMessage?.actorDisplayName)) {
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM
Expand All @@ -187,7 +186,6 @@ import kotlinx.coroutines.withContext
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import retrofit2.HttpException
import retrofit2.Response
import java.io.File
import java.io.IOException
import java.net.HttpURLConnection
Expand Down Expand Up @@ -333,6 +331,8 @@ class ChatActivity :
}
}

private lateinit var messageInputFragment: MessageInputFragment

val typingParticipants = HashMap<String, TypingParticipant>()

var callStarted = false
Expand Down Expand Up @@ -399,6 +399,8 @@ class ChatActivity :
setContentView(binding.root)
setupSystemColors()

messageInputFragment = MessageInputFragment()

conversationUser = currentUserProvider.currentUser.blockingGet()

handleIntent(intent)
Expand Down Expand Up @@ -580,7 +582,7 @@ class ChatActivity :

supportFragmentManager.commit {
setReorderingAllowed(true) // optimizes out redundant replace operations
replace(R.id.fragment_container_activity_chat, MessageInputFragment())
replace(R.id.fragment_container_activity_chat, messageInputFragment)
}

joinRoomWithPassword()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ class MessageInputFragment : Fragment() {
return binding.root
}

override fun onPause() {
super.onPause()
saveState()
}

override fun onDestroyView() {
super.onDestroyView()
saveState()
if (mentionAutocomplete != null && mentionAutocomplete!!.isPopupShowing) {
mentionAutocomplete?.dismissPopup()
}
Expand Down Expand Up @@ -189,7 +193,7 @@ class MessageInputFragment : Fragment() {
animation.duration = 3000
animation.interpolator = LinearInterpolator()
binding.fragmentConnectionLost.setBackgroundColor(resources.getColor(R.color.hwSecurityGreen))
binding.fragmentConnectionLost.text = getString(R.string.connection_gained)
binding.fragmentConnectionLost.text = getString(R.string.connection_established)
binding.fragmentConnectionLost.startAnimation(animation)
binding.fragmentConnectionLost.animation.setAnimationListener(object : AnimationListener {
override fun onAnimationStart(animation: Animation?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ data class ChatMessage(
BREAKOUT_ROOMS_STARTED,
BREAKOUT_ROOMS_STOPPED,
AVATAR_SET,
AVATAR_REMOVED
AVATAR_REMOVED,
FEDERATED_USER_ADDED,
FEDERATED_USER_REMOVED
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ class ConversationsListActivity :
conversationsListViewModel.getRoomsFlow
.onEach { list ->
// Update Conversations
conversationItems.clear()
conversationItemsWithHeader.clear()
conversationItems.clear() // fixme remove this
for (conversation in list) {
addToConversationItems(conversation)
}
Expand Down Expand Up @@ -539,6 +540,12 @@ class ConversationsListActivity :
if (searchManager != null) {
searchView!!.setSearchableInfo(searchManager.getSearchableInfo(componentName))
}
initSearchDisposable()
}
}

private fun initSearchDisposable() {
if (searchViewDisposable == null || searchViewDisposable?.isDisposed == true) {
searchViewDisposable = observeSearchView(searchView!!)
.debounce { query: String? ->
if (TextUtils.isEmpty(query)) {
Expand Down Expand Up @@ -619,17 +626,31 @@ class ConversationsListActivity :
showSearchView(searchView, searchItem)
viewThemeUtils.platform.themeStatusBar(this)
}
searchView!!.setOnCloseListener {
searchView!!.findViewById<View>(R.id.search_close_btn).setOnClickListener {
if (TextUtils.isEmpty(searchView!!.query.toString())) {
searchView!!.onActionViewCollapsed()
viewThemeUtils.platform.resetStatusBar(this)
} else {
searchView!!.post { searchView!!.setQuery(TAG, true) }
resetSearchResults()
searchView!!.setQuery("", false)
}
true
}

searchView!!.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(p0: String?): Boolean {
initSearchDisposable()
return true
}

override fun onQueryTextChange(p0: String?): Boolean {
this@ConversationsListActivity.onQueryTextChange(p0)
return true
}
})

searchItem!!.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem): Boolean {
initSearchDisposable()
adapter!!.setHeadersShown(true)
if (!filterState.containsValue(true)) filterableConversationItems = searchableConversationItems
adapter!!.updateDataSet(filterableConversationItems, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.CONVERSA
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.DESCRIPTION_REMOVED
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.DESCRIPTION_SET
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.DUMMY
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.FEDERATED_USER_ADDED
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.FEDERATED_USER_REMOVED
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.FILE_SHARED
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.GROUP_ADDED
import com.nextcloud.talk.chat.data.model.ChatMessage.SystemMessageType.GROUP_REMOVED
Expand Down Expand Up @@ -136,6 +138,8 @@ class EnumSystemMessageTypeConverter : StringBasedTypeConverter<ChatMessage.Syst
"breakout_rooms_stopped" -> BREAKOUT_ROOMS_STOPPED
"avatar_set" -> AVATAR_SET
"avatar_removed" -> AVATAR_REMOVED
"federated_user_added" -> FEDERATED_USER_ADDED
"federated_user_removed" -> FEDERATED_USER_REMOVED
else -> DUMMY
}
}
Expand Down Expand Up @@ -203,6 +207,8 @@ class EnumSystemMessageTypeConverter : StringBasedTypeConverter<ChatMessage.Syst
BREAKOUT_ROOMS_STOPPED -> "breakout_rooms_stopped"
AVATAR_SET -> "avatar_set"
AVATAR_REMOVED -> "avatar_removed"
FEDERATED_USER_ADDED -> "federated_user_added"
FEDERATED_USER_REMOVED -> "federated_user_removed"
else -> ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,20 @@ class DateTimePickerFragment : DialogFragment() {
tomorrowTimeStamp = getTimeFromCalendar(
hour = HOUR_EIGHT_AM,
minute = 0,
daysToAdd = 1,
weekInYear =
currentWeekInYear + 1
daysToAdd = 1
)

binding.dateTimePickerWeekend.visibility = View.GONE // because today is the weekend
} else {
tomorrowTimeStamp = getTimeFromCalendar(hour = HOUR_EIGHT_AM, minute = 0, daysToAdd = 1)
weekendTimeStamp = getTimeFromCalendar(hour = HOUR_EIGHT_AM, day = Calendar.SATURDAY, minute = 0)
weekendTimeStamp = getTimeFromCalendar(hour = HOUR_EIGHT_AM, weekDay = Calendar.SATURDAY, minute = 0)
}
binding.dateTimePickerTomorrowTextview.text = getTimeFromTimeStamp(tomorrowTimeStamp)
binding.dateTimePickerWeekendTextview.text = getTimeFromTimeStamp(weekendTimeStamp)

nextWeekTimeStamp = getTimeFromCalendar(
hour = HOUR_EIGHT_AM,
day = Calendar.MONDAY,
weekDay = Calendar.MONDAY,
minute = 0,
weekInYear =
currentWeekInYear + 1
Expand Down Expand Up @@ -251,22 +249,25 @@ class DateTimePickerFragment : DialogFragment() {
timePicker.show(this.parentFragmentManager, TAG)
}

/**
* You can use `weekDay` or `daysToAdd` or neither but don't use both b/c it messes up the calendar
*/
@Suppress("LongParameterList")
private fun getTimeFromCalendar(
year: Int = Calendar.getInstance().get(Calendar.YEAR),
month: Int = Calendar.getInstance().get(Calendar.MONTH),
day: Int = Calendar.getInstance().get(Calendar.DAY_OF_WEEK),
day: Int = Calendar.getInstance().get(Calendar.DAY_OF_YEAR),
hour: Int = Calendar.getInstance().get(Calendar.HOUR_OF_DAY),
minute: Int = Calendar.getInstance().get(Calendar.MINUTE),
daysToAdd: Int = 0,
weekInYear: Int = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR)
weekInYear: Int = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR),
weekDay: Int = -1
): Long {
val calendar: Calendar = Calendar.getInstance().apply {
set(Calendar.YEAR, year)
set(Calendar.MONTH, month)
set(Calendar.DAY_OF_WEEK, day)
add(Calendar.DAY_OF_WEEK, daysToAdd)
set(Calendar.WEEK_OF_YEAR, weekInYear)
if (weekDay > -1) set(Calendar.DAY_OF_WEEK, weekDay) else set(Calendar.DAY_OF_YEAR, day)
if (daysToAdd > 0) add(Calendar.DAY_OF_YEAR, daysToAdd) else set(Calendar.WEEK_OF_YEAR, weekInYear)
set(Calendar.HOUR_OF_DAY, hour)
set(Calendar.MINUTE, minute)
set(Calendar.SECOND, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class FilterConversationFragment : DialogFragment() {
unreadFilterChip,
mentionedFilterChip
)
}.forEach(viewThemeUtils.material::themeChipFilter)
}.forEach(viewThemeUtils.talk::themeChipFilter)

setUpChips()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ class MessageActionsDialog(
.before(Date(System.currentTimeMillis() - AGE_THRESHOLD_FOR_EDIT_MESSAGE))

private val isUserAllowedToEdit = chatActivity.userAllowedByPrivilages(message)

private val isMessageEditable = hasSpreedFeatureCapability(
private var isNoTimeLimitOnNoteToSelf = hasSpreedFeatureCapability(
spreedCapabilities,
SpreedFeatures
.EDIT_MESSAGES_NOTE_TO_SELF
) && currentConversation?.type == ConversationEnums.ConversationType.NOTE_TO_SELF
private var messageIsEditable = hasSpreedFeatureCapability(
spreedCapabilities,
SpreedFeatures.EDIT_MESSAGES
) && messageHasRegularText && !isOlderThanTwentyFourHours && isUserAllowedToEdit

private val isMessageEditable = isNoTimeLimitOnNoteToSelf || messageIsEditable

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package com.nextcloud.talk.ui.theme

import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.content.Context
import android.content.res.ColorStateList
Expand Down Expand Up @@ -36,10 +37,12 @@ import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.ViewCompat
import com.google.android.material.button.MaterialButton
import com.google.android.material.card.MaterialCardView
import com.google.android.material.chip.Chip
import com.google.android.material.materialswitch.MaterialSwitch
import com.nextcloud.android.common.ui.theme.MaterialSchemes
import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
import com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils
import com.nextcloud.android.common.ui.util.buildColorStateList
import com.nextcloud.talk.R
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
import com.nextcloud.talk.ui.MicInputCloud
Expand All @@ -50,6 +53,7 @@ import com.nextcloud.talk.utils.DrawableUtils
import com.nextcloud.talk.utils.message.MessageUtils
import com.vanniktech.emoji.EmojiTextView
import com.wooplr.spotlight.SpotlightView
import dynamiccolor.DynamicScheme
import dynamiccolor.MaterialDynamicColors
import eu.davidea.flexibleadapter.utils.FlexibleUtils
import javax.inject.Inject
Expand Down Expand Up @@ -214,6 +218,7 @@ class TalkSpecificViewThemeUtils @Inject constructor(
return drawable
}

@SuppressLint("RestrictedApi")
fun themeSearchView(searchView: SearchView) {
withScheme(searchView) { scheme ->
// hacky as no default way is provided
Expand Down Expand Up @@ -376,6 +381,48 @@ class TalkSpecificViewThemeUtils @Inject constructor(
}
}

private fun chipOutlineFilterColorList(scheme: DynamicScheme) =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.secondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.outline().getArgb(scheme)
)

fun themeChipFilter(chip: Chip) {
withScheme(chip.context) { scheme ->
val backgroundColors =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.secondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.surface().getArgb(scheme),
android.R.attr.state_focused to dynamicColor.secondaryContainer().getArgb(scheme),
android.R.attr.state_hovered to dynamicColor.secondaryContainer().getArgb(scheme),
android.R.attr.state_pressed to dynamicColor.secondaryContainer().getArgb(scheme)
)

val iconColors =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.onSecondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.surfaceVariant().getArgb(scheme),
android.R.attr.state_focused to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_hovered to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_pressed to dynamicColor.onSecondaryContainer().getArgb(scheme)
)

val textColors =
buildColorStateList(
android.R.attr.state_checked to dynamicColor.onSecondaryContainer().getArgb(scheme),
-android.R.attr.state_checked to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_hovered to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_focused to dynamicColor.onSecondaryContainer().getArgb(scheme),
android.R.attr.state_pressed to dynamicColor.onSecondaryContainer().getArgb(scheme)
)

chip.chipBackgroundColor = backgroundColors
chip.chipStrokeColor = chipOutlineFilterColorList(scheme)
chip.setTextColor(textColors)
chip.checkedIconTint = iconColors
}
}

companion object {
private val THEMEABLE_PLACEHOLDER_IDS = listOf(
R.drawable.ic_mimetype_package_x_generic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ enum class SpreedFeatures(val value: String) {
CONVERSATION_PERMISSION("conversation-permissions"),
FEDERATION_V1("federation-v1"),
DELETE_MESSAGES_UNLIMITED("delete-messages-unlimited"),
BAN_V1("ban-v1")
BAN_V1("ban-v1"),
EDIT_MESSAGES_NOTE_TO_SELF("edit-messages-note-to-self")
}

@Suppress("TooManyFunctions")
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<string name="clear_status_message_after">إمسح رسالة الحالة فيما بعدٌ</string>
<string name="close">إغلاق</string>
<string name="close_icon">أيقونة الإغلاق</string>
<string name="connection_established">تم الاتصال</string>
<string name="connection_lost">انقطع الاتصال</string>
<string name="connection_lost_sent_messages_are_queued">انقطع الاتصال - الرسالة المطلوب إرسالها تمّ تحضيرها للإرسال في قائمة بحسب الأولوية</string>
<string name="continuous_voice_message_recording">قَفْل التسجيل للتسجيل المستمر للرسالة الصوتية</string>
<string name="conversation_is_read_only">المحادثة للقراءة فقط</string>
<string name="conversations">محادثات</string>
Expand Down Expand Up @@ -71,6 +74,7 @@
<string name="menu_item_sort_by_name_z_a">ي - أ</string>
<string name="menu_item_sort_by_size_biggest_first">الأعلى حجماً أولاً</string>
<string name="menu_item_sort_by_size_smallest_first">الأقل حجماً أولاً</string>
<string name="message_deleted_by_you">مُسحت الرسالة بواسطتك</string>
<string name="message_expiration_title">نهاية صلاحية الرسالة</string>
<string name="message_last_edited_by">تمّ التعديل من قِبَل %1$s</string>
<string name="message_poll_tap_to_open">أنقُر لفتح الاستبيان</string>
Expand Down
Loading
Loading