Skip to content

Commit

Permalink
Merge branch 'release/tchap_v2.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Mar 29, 2024
2 parents 92284ae + bb33cb7 commit bcbc14b
Show file tree
Hide file tree
Showing 33 changed files with 329 additions and 112 deletions.
12 changes: 12 additions & 0 deletions TCHAP_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Changes in Tchap 2.11.0 (2024-03-29)
====================================

Features ✨
----------
- Activation du partage de la localisation. ([#1020](https://github.com/tchapgouv/tchap-android/issues/1020))

Other changes
-------------
- Update labs visibility. ([#1019](https://github.com/tchapgouv/tchap-android/issues/1019))


Changes in Tchap 2.10.4 (2024-03-12)
====================================

Expand Down
2 changes: 1 addition & 1 deletion library/ui-strings/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@
<item quantity="one">%d sélectionné</item>
<item quantity="other">%d sélectionnés</item>
</plurals>
<string name="system_alerts_header">Alertes système</string>
<string name="system_alerts_header">Annonces ${app_name}</string> <!-- Tchap: Custom string -->
<string name="resource_limit_contact_admin">contacter l’administrateur de votre service</string>
<string name="resource_limit_soft_default">Ce serveur d’accueil a dépassé une de ses limites de ressources donc <b>certains utilisateurs ne pourront pas se connecter</b>.</string>
<string name="resource_limit_hard_default">Ce serveur d’accueil a dépassé une de ses limites de ressources.</string>
Expand Down
2 changes: 1 addition & 1 deletion library/ui-strings/src/main/res/values/donottranslate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
<string name="command_description_crash_application" translatable="false">Crash the application.</string>

<!-- WIP -->
<string name="location_map_view_copyright" translatable="false"MapTiler © OpenStreetMap contributors</string>
<string name="location_map_view_copyright" translatable="false"IGN</string> <!-- Tchap: Custom string -->
</resources>
2 changes: 1 addition & 1 deletion library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@
<!-- Home fragment -->
<string name="invitations_header">Invites</string>
<string name="low_priority_header">Low priority</string>
<string name="system_alerts_header">"System Alerts"</string>
<string name="system_alerts_header">${app_name} Alerts"</string> <!-- Tchap: Custom string -->
<string name="suggested_header">Suggested Rooms</string>

<!-- Space List fragment -->
Expand Down
2 changes: 1 addition & 1 deletion towncrier.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.towncrier]
version = "2.10.4"
version = "2.11.0"
directory = "changelog.d"
filename = "TCHAP_CHANGES.md"
name = "Changes in Tchap"
Expand Down
4 changes: 2 additions & 2 deletions vector-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ knit {

// Note: 2 digits max for each value
ext.versionMajor = 2
ext.versionMinor = 10
ext.versionMinor = 11
// Note: even values are reserved for regular release, odd values for hotfix release.
// When creating a hotfix, you should decrease the value, since the current value
// is the value for the next regular release.
ext.versionPatch = 4
ext.versionPatch = 0

static def getGitTimestamp() {
def cmd = 'git show -s --format=%ct'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import im.vector.app.R
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.DefaultVectorFeatures
Expand All @@ -33,7 +34,8 @@ class NewRoomRobot(
private val labsPreferences: LabFeaturesPreferences
) {
private val context = InstrumentationRegistry.getInstrumentation().targetContext
private val features: VectorFeatures = DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources))
private val features: VectorFeatures =
DefaultVectorFeatures(DefaultAppNameProvider(context), StringArrayProvider(context.resources), BooleanProvider(context.resources))

fun createNewRoom(block: CreateNewRoomRobot.() -> Unit) {
clickOn(R.string.create_new_room)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.adevinta.android.barista.interaction.BaristaClickInteractions.clickOn
import com.adevinta.android.barista.interaction.BaristaEditTextInteractions.writeTo
import im.vector.app.R
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.espresso.tools.waitUntilViewVisible
import im.vector.app.features.DefaultVectorFeatures
Expand All @@ -42,7 +43,10 @@ class OnboardingRobot {
// Tchap: Override default feature values for tests
private val context = InstrumentationRegistry.getInstrumentation().targetContext
private val defaultVectorFeatures =
DebugVectorFeatures(context, DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources))).apply {
DebugVectorFeatures(
context,
DefaultVectorFeatures(DefaultAppNameProvider(context), StringArrayProvider(context.resources), BooleanProvider(context.resources))
).apply {
override(true, DebugFeatureKeys.tchapIsKeyBackupEnabled)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.adevinta.android.barista.interaction.BaristaDrawerInteractions.openDr
import com.adevinta.android.barista.internal.viewaction.ClickChildAction
import im.vector.app.R
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.espresso.tools.waitUntilDialogVisible
import im.vector.app.espresso.tools.waitUntilViewVisible
Expand All @@ -38,7 +39,8 @@ import org.hamcrest.Matchers

class SpaceRobot(private val labsPreferences: LabFeaturesPreferences) {
private val context = InstrumentationRegistry.getInstrumentation().targetContext
private val features: VectorFeatures = DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources))
private val features: VectorFeatures =
DefaultVectorFeatures(DefaultAppNameProvider(context), StringArrayProvider(context.resources), BooleanProvider(context.resources))

fun createSpace(isFirstSpace: Boolean, block: SpaceCreateRobot.() -> Unit) {
if (labsPreferences.isNewAppLayoutEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import im.vector.app.core.resources.AppNameProvider
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.features.DefaultVectorFeatures
Expand All @@ -44,8 +45,8 @@ interface FeaturesModule {
companion object {

@Provides
fun providesDefaultVectorFeatures(stringArrayProvider: StringArrayProvider, booleanProvider: BooleanProvider): DefaultVectorFeatures {
return DefaultVectorFeatures(stringArrayProvider, booleanProvider)
fun providesDefaultVectorFeatures(appNameProvider: AppNameProvider, stringArrayProvider: StringArrayProvider, booleanProvider: BooleanProvider): DefaultVectorFeatures {
return DefaultVectorFeatures(appNameProvider, stringArrayProvider, booleanProvider)
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class DebugVectorFeatures(

override fun tchapIsThreadEnabled() = vectorFeatures.tchapIsThreadEnabled()

override fun tchapIsLabsVisible(domain: String) = vectorFeatures.tchapIsLabsVisible(domain)

override fun onboardingVariant(): OnboardingVariant {
return readPreferences().getEnum<OnboardingVariant>() ?: vectorFeatures.onboardingVariant()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import im.vector.app.core.resources.AppNameProvider
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.features.DefaultVectorFeatures
Expand All @@ -32,8 +33,8 @@ import im.vector.app.features.VectorOverrides
object FeaturesModule {

@Provides
fun providesFeatures(stringArrayProvider: StringArrayProvider, booleanProvider: BooleanProvider): VectorFeatures {
return DefaultVectorFeatures(stringArrayProvider, booleanProvider)
fun providesFeatures(appNameProvider: AppNameProvider, stringArrayProvider: StringArrayProvider, booleanProvider: BooleanProvider): VectorFeatures {
return DefaultVectorFeatures(appNameProvider, stringArrayProvider, booleanProvider)
}

@Provides
Expand Down
3 changes: 2 additions & 1 deletion vector-config/src/btchap/res/values/config-settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="tchap_settings_root_labs_visible">true</bool>
<!-- Level 0: Root -->
<bool name="settings_root_labs_visible">true</bool>
</resources>
3 changes: 3 additions & 0 deletions vector-config/src/debug/res/values/config-settings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- Level 0: Root -->
<bool name="settings_root_labs_visible">true</bool>

<!-- Level 1: Advanced settings -->
<bool name="tchap_settings_advanced_developer_mode_visible">true</bool> <!-- Tchap: Show developer mode in debug -->

Expand Down
3 changes: 2 additions & 1 deletion vector-config/src/devTchap/res/values/config-settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="tchap_settings_root_labs_visible">true</bool>
<!-- Level 0: Root -->
<bool name="settings_root_labs_visible">true</bool>
</resources>
2 changes: 1 addition & 1 deletion vector-config/src/main/java/im/vector/app/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object Config {
*/
const val ALLOW_EXTERNAL_UNIFIED_PUSH_DISTRIBUTORS = false // Tchap: Disable UnifiedPush (use Firebase/background sync)

const val ENABLE_LOCATION_SHARING = false // Tchap: Disable Location Sharing
const val ENABLE_LOCATION_SHARING = true
const val LOCATION_MAP_TILER_KEY = "" // Tchap: Disable Location Sharing

/**
Expand Down
3 changes: 1 addition & 2 deletions vector-config/src/main/res/values/config-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<!-- <bool name="settings_root_voice_video_visible">true</bool>-->

<bool name="settings_root_security_privacy_visible">true</bool>
<!-- Tchap: use gradle config -->
<!-- <bool name="settings_root_labs_visible">true</bool>-->
<bool name="settings_root_labs_visible">false</bool>
<bool name="settings_root_advanced_visible">true</bool>
<bool name="settings_root_help_about_visible">true</bool>
<bool name="settings_root_legals_visible">true</bool>
Expand Down
4 changes: 0 additions & 4 deletions vector-config/src/tchap/res/values/config-settings.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.os.Build
import androidx.test.platform.app.InstrumentationRegistry
import im.vector.app.TestBuildVersionSdkIntProvider
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.DefaultAppNameProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.features.DefaultVectorFeatures
import io.mockk.every
Expand All @@ -34,7 +35,7 @@ class VoiceRecorderProviderTests {
private val provider = spyk(
VoiceRecorderProvider(
context,
DefaultVectorFeatures(StringArrayProvider(context.resources), BooleanProvider(context.resources)),
DefaultVectorFeatures(DefaultAppNameProvider(context), StringArrayProvider(context.resources), BooleanProvider(context.resources)),
buildVersionSdkIntProvider
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ import android.widget.TextView
import androidx.core.view.isVisible
import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass
import com.bumptech.glide.request.RequestOptions
import im.vector.app.R
import im.vector.app.core.epoxy.ClickListener
import im.vector.app.core.epoxy.VectorEpoxyHolder
import im.vector.app.core.epoxy.VectorEpoxyModel
import im.vector.app.core.epoxy.onClick
import im.vector.app.core.extensions.setTextOrHide
import im.vector.app.core.glide.GlideApp
import im.vector.app.features.displayname.getBestName
import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.detail.timeline.action.LocationUiData
import im.vector.app.features.home.room.detail.timeline.item.BindingOptions
import im.vector.app.features.home.room.detail.timeline.tools.findPillsAndProcess
import im.vector.app.features.location.TchapMapRenderer
import im.vector.app.features.media.ImageContentRenderer
import im.vector.lib.core.utils.epoxy.charsequence.EpoxyCharSequence
import org.matrix.android.sdk.api.util.MatrixItem
Expand All @@ -49,6 +48,9 @@ abstract class BottomSheetMessagePreviewItem : VectorEpoxyModel<BottomSheetMessa
@EpoxyAttribute
lateinit var avatarRenderer: AvatarRenderer

@EpoxyAttribute
lateinit var tchapMapRenderer: TchapMapRenderer // Tchap: Generate and load map on device

@EpoxyAttribute
lateinit var matrixItem: MatrixItem

Expand Down Expand Up @@ -98,10 +100,8 @@ abstract class BottomSheetMessagePreviewItem : VectorEpoxyModel<BottomSheetMessa
holder.body.isVisible = locationUiData == null
holder.mapViewContainer.isVisible = locationUiData != null
locationUiData?.let { safeLocationUiData ->
GlideApp.with(holder.staticMapImageView)
.load(safeLocationUiData.locationUrl)
.apply(RequestOptions.centerCropTransform())
.into(holder.staticMapImageView)
// Tchap: Generate and load map on device
tchapMapRenderer.render(safeLocationUiData, holder.staticMapImageView)

val pinMatrixItem = matrixItem.takeIf { safeLocationUiData.locationOwnerId != null }
safeLocationUiData.locationPinProvider.create(pinMatrixItem) { pinDrawable ->
Expand All @@ -113,6 +113,8 @@ abstract class BottomSheetMessagePreviewItem : VectorEpoxyModel<BottomSheetMessa

override fun unbind(holder: Holder) {
imageContentRenderer?.clear(holder.imagePreview)
// Tchap: Generate and load map on device
tchapMapRenderer.clear(holder.staticMapImageView, holder.staticMapPinImageView)
super.unbind(holder)
}

Expand Down
5 changes: 5 additions & 0 deletions vector/src/main/java/im/vector/app/features/VectorFeatures.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package im.vector.app.features
import im.vector.app.R
import im.vector.app.config.Config
import im.vector.app.config.OnboardingVariant
import im.vector.app.core.resources.AppNameProvider
import im.vector.app.core.resources.BooleanProvider
import im.vector.app.core.resources.StringArrayProvider
import im.vector.app.features.settings.VectorPreferences
Expand All @@ -30,6 +31,7 @@ interface VectorFeatures {
fun tchapIsCrossSigningEnabled(): Boolean
fun tchapIsKeyBackupEnabled(): Boolean
fun tchapIsThreadEnabled(): Boolean
fun tchapIsLabsVisible(domain: String): Boolean
fun onboardingVariant(): OnboardingVariant
fun isOnboardingAlreadyHaveAccountSplashEnabled(): Boolean
fun isOnboardingSplashCarouselEnabled(): Boolean
Expand All @@ -56,6 +58,7 @@ interface VectorFeatures {
}

class DefaultVectorFeatures @Inject constructor(
private val appNameProvider: AppNameProvider,
private val stringArrayProvider: StringArrayProvider,
private val booleanProvider: BooleanProvider
) : VectorFeatures {
Expand All @@ -66,6 +69,8 @@ class DefaultVectorFeatures @Inject constructor(
override fun tchapIsCrossSigningEnabled() = booleanProvider.getBoolean(R.bool.tchap_is_cross_signing_enabled)
override fun tchapIsKeyBackupEnabled() = booleanProvider.getBoolean(R.bool.tchap_is_key_backup_enabled)
override fun tchapIsThreadEnabled() = booleanProvider.getBoolean(R.bool.tchap_is_thread_enabled)
override fun tchapIsLabsVisible(domain: String) = booleanProvider.getBoolean(R.bool.settings_root_labs_visible) ||
domain == appNameProvider.getAppName()
override fun onboardingVariant() = Config.ONBOARDING_VARIANT
override fun isOnboardingAlreadyHaveAccountSplashEnabled() = true
override fun isOnboardingSplashCarouselEnabled() = false // Tchap: no carousel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@

package im.vector.app.features.home.room.detail.timeline.action

import android.util.Size
import im.vector.app.features.home.room.detail.timeline.helper.LocationPinProvider
import im.vector.app.features.location.LocationData

/**
* Data used to display Location data in the message bottom sheet.
*/
data class LocationUiData(
val locationUrl: String,
// Tchap: Generate and load map on device
val locationData: LocationData,
val mapZoom: Double,
val mapSize: Size,
val locationOwnerId: String?,
val locationPinProvider: LocationPinProvider,
)
Loading

0 comments on commit bcbc14b

Please sign in to comment.