Browse Source

Merge branch 'develop' into feature/bma/sxcludePreviewFromCodeCoverage

pull/2193/head
Benoit Marty 8 months ago committed by GitHub
parent
commit
92d8e4f55b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      .editorconfig
  2. 1
      anvilcodegen/src/main/kotlin/io/element/android/anvilcodegen/ContributesNodeCodeGenerator.kt
  3. 1
      app/src/main/kotlin/io/element/android/x/ElementXApplication.kt
  4. 1
      app/src/main/kotlin/io/element/android/x/MainActivity.kt
  5. 2
      app/src/main/kotlin/io/element/android/x/MainNode.kt
  6. 4
      app/src/main/kotlin/io/element/android/x/di/AppBindings.kt
  7. 6
      app/src/main/kotlin/io/element/android/x/di/AppComponent.kt
  8. 19
      app/src/main/kotlin/io/element/android/x/di/AppModule.kt
  9. 1
      app/src/main/kotlin/io/element/android/x/di/DefaultRoomComponentFactory.kt
  10. 1
      app/src/main/kotlin/io/element/android/x/di/DefaultSessionComponentFactory.kt
  11. 1
      app/src/main/kotlin/io/element/android/x/di/RoomComponent.kt
  12. 1
      app/src/main/kotlin/io/element/android/x/di/SessionComponent.kt
  13. 1
      app/src/main/kotlin/io/element/android/x/initializer/CrashInitializer.kt
  14. 1
      app/src/main/kotlin/io/element/android/x/initializer/TracingInitializer.kt
  15. 1
      app/src/test/kotlin/io/element/android/x/intent/IntentProviderImplTest.kt
  16. 35
      appconfig/src/main/kotlin/io/element/android/appconfig/LockScreenConfig.kt
  17. 2
      appconfig/src/main/kotlin/io/element/android/appconfig/MatrixConfiguration.kt
  18. 4
      appconfig/src/main/kotlin/io/element/android/appconfig/NotificationConfig.kt
  19. 2
      appconfig/src/main/kotlin/io/element/android/appconfig/PushConfig.kt
  20. 6
      appconfig/src/main/kotlin/io/element/android/appconfig/RoomListConfig.kt
  21. 2
      appconfig/src/main/kotlin/io/element/android/appconfig/SecureBackupConfig.kt
  22. 2
      appconfig/src/main/kotlin/io/element/android/appconfig/TimelineConfig.kt
  23. 1
      appnav/src/main/kotlin/io/element/android/appnav/BackstackExt.kt
  24. 1
      appnav/src/main/kotlin/io/element/android/appnav/LoggedInEventProcessor.kt
  25. 3
      appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt
  26. 4
      appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt
  27. 4
      appnav/src/main/kotlin/io/element/android/appnav/di/MatrixClientsHolder.kt
  28. 21
      appnav/src/main/kotlin/io/element/android/appnav/loggedin/LoggedInEvents.kt
  29. 1
      appnav/src/main/kotlin/io/element/android/appnav/loggedin/LoggedInNode.kt
  30. 1
      appnav/src/main/kotlin/io/element/android/appnav/loggedin/LoggedInPresenter.kt
  31. 8
      appnav/src/main/kotlin/io/element/android/appnav/loggedin/SyncStateView.kt
  32. 1
      appnav/src/main/kotlin/io/element/android/appnav/room/LoadingRoomState.kt
  33. 2
      appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt
  34. 1
      appnav/src/main/kotlin/io/element/android/appnav/room/RoomLoadedFlowNode.kt
  35. 1
      appnav/src/main/kotlin/io/element/android/appnav/root/RootNavStateFlowFactory.kt
  36. 1
      appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt
  37. 4
      appnav/src/test/kotlin/io/element/android/appnav/RoomFlowNodeTest.kt
  38. 1
      appnav/src/test/kotlin/io/element/android/appnav/loggedin/LoggedInPresenterTest.kt
  39. 13
      appnav/src/test/kotlin/io/element/android/appnav/room/LoadingRoomStateFlowFactoryTest.kt
  40. 14
      build.gradle.kts
  41. 1
      changelog.d/2156.bugfix
  42. 2
      features/analytics/api/src/main/kotlin/io/element/android/features/analytics/api/preferences/AnalyticsPreferencesView.kt
  43. 1
      features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInNode.kt
  44. 1
      features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInPresenter.kt
  45. 3
      features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInStateProvider.kt
  46. 1
      features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/preferences/DefaultAnalyticsPreferencesPresenter.kt
  47. 2
      features/analytics/impl/src/test/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInPresenterTest.kt
  48. 2
      features/analytics/impl/src/test/kotlin/io/element/android/features/analytics/impl/preferences/AnalyticsPreferencesPresenterTest.kt
  49. 1
      features/call/src/main/kotlin/io/element/android/features/call/CallForegroundService.kt
  50. 3
      features/call/src/main/kotlin/io/element/android/features/call/data/WidgetMessage.kt
  51. 3
      features/call/src/main/kotlin/io/element/android/features/call/ui/CallScreenPresenter.kt
  52. 1
      features/call/src/main/kotlin/io/element/android/features/call/utils/CallIntentDataParser.kt
  53. 3
      features/call/src/main/kotlin/io/element/android/features/call/utils/WebViewWidgetMessageInterceptor.kt
  54. 1
      features/call/src/main/kotlin/io/element/android/features/call/utils/WidgetMessageSerializer.kt
  55. 1
      features/call/src/test/kotlin/io/element/android/features/call/MapWebkitPermissionsTest.kt
  56. 3
      features/call/src/test/kotlin/io/element/android/features/call/ui/CallScreenPresenterTest.kt
  57. 10
      features/call/src/test/kotlin/io/element/android/features/call/ui/FakeCallScreenNavigator.kt
  58. 23
      features/call/src/test/kotlin/io/element/android/features/call/utils/CallIntentDataParserTest.kt
  59. 1
      features/call/src/test/kotlin/io/element/android/features/call/utils/DefaultCallWidgetProviderTest.kt
  60. 27
      features/call/src/test/kotlin/io/element/android/features/call/utils/FakeCallWidgetProvider.kt
  61. 16
      features/call/src/test/kotlin/io/element/android/features/call/utils/FakeWidgetMessageInterceptor.kt
  62. 1
      features/createroom/api/src/main/kotlin/io/element/android/features/createroom/api/CreateRoomEntryPoint.kt
  63. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/ConfigureRoomFlowNode.kt
  64. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/CreateRoomDataStore.kt
  65. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/CreateRoomFlowNode.kt
  66. 3
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/DefaultCreateRoomEntryPoint.kt
  67. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/DefaultStartDMAction.kt
  68. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeopleNode.kt
  69. 2
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeoplePresenter.kt
  70. 12
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeopleUserListStateProvider.kt
  71. 7
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/components/RoomPrivacyOption.kt
  72. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/ConfigureRoomNode.kt
  73. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/ConfigureRoomPresenter.kt
  74. 2
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/RoomPrivacyItem.kt
  75. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/di/CreateRoomComponent.kt
  76. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootNode.kt
  77. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootPresenter.kt
  78. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootStateProvider.kt
  79. 2
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootView.kt
  80. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/userlist/DefaultUserListPresenter.kt
  81. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/userlist/UserListDataStore.kt
  82. 1
      features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/userlist/UserListPresenter.kt
  83. 1
      features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/DefaultStartDMActionTests.kt
  84. 2
      features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeoplePresenterTests.kt
  85. 2
      features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/configureroom/ConfigureRoomPresenterTests.kt
  86. 2
      features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootPresenterTests.kt
  87. 1
      features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/userlist/DefaultUserListPresenterTests.kt
  88. 1
      features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/userlist/FakeUserListPresenter.kt
  89. 1
      features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/userlist/FakeUserListPresenterFactory.kt
  90. 1
      features/createroom/test/src/main/kotlin/io/element/android/features/createroom/test/FakeStartDMAction.kt
  91. 1
      features/ftue/api/src/main/kotlin/io/element/android/features/ftue/api/FtueEntryPoint.kt
  92. 2
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/DefaultFtueEntryPoint.kt
  93. 1
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/FtueFlowNode.kt
  94. 1
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/migration/MigrationScreenNode.kt
  95. 3
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/migration/MigrationScreenView.kt
  96. 2
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/migration/SharedPrefsMigrationScreenStore.kt
  97. 1
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/notifications/NotificationsOptInNode.kt
  98. 5
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/notifications/NotificationsOptInPresenter.kt
  99. 37
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/state/DefaultFtueState.kt
  100. 2
      features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/welcome/WelcomeNode.kt
  101. Some files were not shown because too many files have changed in this diff Show More

13
.editorconfig

@ -14,10 +14,19 @@ ij_smart_tabs = false @@ -14,10 +14,19 @@ ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
# Ktlint rule, for more information see https://pinterest.github.io/ktlint/faq/#why-is-editorconfig-property-disabled_rules-deprecated-and-how-do-i-resolve-this
# Ktlint rule, for more information see https://pinterest.github.io/ktlint/1.1.1/faq/#how-do-i-enable-or-disable-a-rule
ktlint_standard_wrapping = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_spacing-between-declarations-with-annotations = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_annotation = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_indent = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_function_naming_ignore_when_annotated_with=Composable
[*.java]
ij_java_align_consecutive_assignments = false

1
anvilcodegen/src/main/kotlin/io/element/android/anvilcodegen/ContributesNodeCodeGenerator.kt

@ -58,7 +58,6 @@ import java.io.File @@ -58,7 +58,6 @@ import java.io.File
*/
@AutoService(CodeGenerator::class)
class ContributesNodeCodeGenerator : CodeGenerator {
override fun isApplicable(context: AnvilContext): Boolean = true
override fun generateCode(codeGenDir: File, module: ModuleDescriptor, projectFiles: Collection<KtFile>): Collection<GeneratedFile> {

1
app/src/main/kotlin/io/element/android/x/ElementXApplication.kt

@ -27,7 +27,6 @@ import io.element.android.x.initializer.CrashInitializer @@ -27,7 +27,6 @@ import io.element.android.x.initializer.CrashInitializer
import io.element.android.x.initializer.TracingInitializer
class ElementXApplication : Application(), DaggerComponentOwner {
override val daggerComponent: AppComponent = DaggerAppComponent.factory().create(this)
override fun onCreate() {

1
app/src/main/kotlin/io/element/android/x/MainActivity.kt

@ -51,7 +51,6 @@ import timber.log.Timber @@ -51,7 +51,6 @@ import timber.log.Timber
private val loggerTag = LoggerTag("MainActivity")
class MainActivity : NodeActivity() {
private lateinit var mainNode: MainNode
private lateinit var appBindings: AppBindings

2
app/src/main/kotlin/io/element/android/x/MainNode.kt

@ -48,7 +48,6 @@ class MainNode( @@ -48,7 +48,6 @@ class MainNode(
plugins = plugins,
),
DaggerComponentOwner {
override val daggerComponent = (context as DaggerComponentOwner).daggerComponent
override fun resolve(navTarget: RootNavTarget, buildContext: BuildContext): Node {
@ -68,5 +67,4 @@ class MainNode( @@ -68,5 +67,4 @@ class MainNode(
@Parcelize
object RootNavTarget : Parcelable
}

4
app/src/main/kotlin/io/element/android/x/di/AppBindings.kt

@ -27,8 +27,12 @@ import io.element.android.libraries.matrix.api.tracing.TracingService @@ -27,8 +27,12 @@ import io.element.android.libraries.matrix.api.tracing.TracingService
@ContributesTo(AppScope::class)
interface AppBindings {
fun snackbarDispatcher(): SnackbarDispatcher
fun tracingService(): TracingService
fun bugReporter(): BugReporter
fun lockScreenService(): LockScreenService
fun preferencesStore(): PreferencesStore
}

6
app/src/main/kotlin/io/element/android/x/di/AppComponent.kt

@ -28,9 +28,11 @@ import io.element.android.libraries.di.SingleIn @@ -28,9 +28,11 @@ import io.element.android.libraries.di.SingleIn
@SingleIn(AppScope::class)
@MergeComponent(AppScope::class)
interface AppComponent : NodeFactoriesBindings {
@Component.Factory
interface Factory {
fun create(@ApplicationContext @BindsInstance context: Context): AppComponent
fun create(
@ApplicationContext @BindsInstance
context: Context
): AppComponent
}
}

19
app/src/main/kotlin/io/element/android/x/di/AppModule.kt

@ -46,7 +46,6 @@ import java.io.File @@ -46,7 +46,6 @@ import java.io.File
@Module
@ContributesTo(AppScope::class)
object AppModule {
@Provides
fun providesBaseDirectory(@ApplicationContext context: Context): File {
return File(context.filesDir, "sessions")
@ -82,14 +81,20 @@ object AppModule { @@ -82,14 +81,20 @@ object AppModule {
buildType = buildType,
applicationName = context.getString(R.string.app_name),
applicationId = BuildConfig.APPLICATION_ID,
lowPrivacyLoggingEnabled = false, // TODO EAx Config.LOW_PRIVACY_LOG_ENABLE,
// TODO EAx Config.LOW_PRIVACY_LOG_ENABLE,
lowPrivacyLoggingEnabled = false,
versionName = BuildConfig.VERSION_NAME,
versionCode = BuildConfig.VERSION_CODE,
gitRevision = "TODO", // BuildConfig.GIT_REVISION,
gitRevisionDate = "TODO", // BuildConfig.GIT_REVISION_DATE,
gitBranchName = "TODO", // BuildConfig.GIT_BRANCH_NAME,
flavorDescription = "TODO", // BuildConfig.FLAVOR_DESCRIPTION,
flavorShortDescription = "TODO", // BuildConfig.SHORT_FLAVOR_DESCRIPTION,
// BuildConfig.GIT_REVISION,
gitRevision = "TODO",
// BuildConfig.GIT_REVISION_DATE,
gitRevisionDate = "TODO",
// BuildConfig.GIT_BRANCH_NAME,
gitBranchName = "TODO",
// BuildConfig.FLAVOR_DESCRIPTION,
flavorDescription = "TODO",
// BuildConfig.SHORT_FLAVOR_DESCRIPTION,
flavorShortDescription = "TODO",
)
@Provides

1
app/src/main/kotlin/io/element/android/x/di/DefaultRoomComponentFactory.kt

@ -26,7 +26,6 @@ import javax.inject.Inject @@ -26,7 +26,6 @@ import javax.inject.Inject
class DefaultRoomComponentFactory @Inject constructor(
private val roomComponentBuilder: RoomComponent.Builder
) : RoomComponentFactory {
override fun create(room: MatrixRoom): Any {
return roomComponentBuilder.room(room).build()
}

1
app/src/main/kotlin/io/element/android/x/di/DefaultSessionComponentFactory.kt

@ -26,7 +26,6 @@ import javax.inject.Inject @@ -26,7 +26,6 @@ import javax.inject.Inject
class DefaultSessionComponentFactory @Inject constructor(
private val sessionComponentBuilder: SessionComponent.Builder
) : SessionComponentFactory {
override fun create(client: MatrixClient): Any {
return sessionComponentBuilder.client(client).build()
}

1
app/src/main/kotlin/io/element/android/x/di/RoomComponent.kt

@ -29,7 +29,6 @@ import io.element.android.libraries.matrix.api.room.MatrixRoom @@ -29,7 +29,6 @@ import io.element.android.libraries.matrix.api.room.MatrixRoom
@SingleIn(RoomScope::class)
@MergeSubcomponent(RoomScope::class)
interface RoomComponent : NodeFactoriesBindings {
@Subcomponent.Builder
interface Builder {
@BindsInstance

1
app/src/main/kotlin/io/element/android/x/di/SessionComponent.kt

@ -29,7 +29,6 @@ import io.element.android.libraries.matrix.api.MatrixClient @@ -29,7 +29,6 @@ import io.element.android.libraries.matrix.api.MatrixClient
@SingleIn(SessionScope::class)
@MergeSubcomponent(SessionScope::class)
interface SessionComponent : NodeFactoriesBindings {
@Subcomponent.Builder
interface Builder {
@BindsInstance

1
app/src/main/kotlin/io/element/android/x/initializer/CrashInitializer.kt

@ -21,7 +21,6 @@ import androidx.startup.Initializer @@ -21,7 +21,6 @@ import androidx.startup.Initializer
import io.element.android.features.rageshake.impl.crash.VectorUncaughtExceptionHandler
class CrashInitializer : Initializer<Unit> {
override fun create(context: Context) {
VectorUncaughtExceptionHandler(context).activate()
}

1
app/src/main/kotlin/io/element/android/x/initializer/TracingInitializer.kt

@ -31,7 +31,6 @@ import io.element.android.x.di.AppBindings @@ -31,7 +31,6 @@ import io.element.android.x.di.AppBindings
import timber.log.Timber
class TracingInitializer : Initializer<Unit> {
override fun create(context: Context) {
val appBindings = context.bindings<AppBindings>()
val tracingService = appBindings.tracingService()

1
app/src/test/kotlin/io/element/android/x/intent/IntentProviderImplTest.kt

@ -31,7 +31,6 @@ import org.robolectric.RuntimeEnvironment @@ -31,7 +31,6 @@ import org.robolectric.RuntimeEnvironment
@RunWith(RobolectricTestRunner::class)
class IntentProviderImplTest {
@Test
fun `test getViewRoomIntent with Session`() {
val sut = createIntentProviderImpl()

35
appconfig/src/main/kotlin/io/element/android/appconfig/LockScreenConfig.kt

@ -25,48 +25,27 @@ import kotlin.time.Duration.Companion.seconds @@ -25,48 +25,27 @@ import kotlin.time.Duration.Companion.seconds
/**
* Configuration for the lock screen feature.
* @property isPinMandatory Whether the PIN is mandatory or not.
* @property pinBlacklist Some PINs are forbidden.
* @property pinSize The size of the PIN.
* @property maxPinCodeAttemptsBeforeLogout Number of attempts before the user is logged out.
* @property gracePeriod Time period before locking the app once backgrounded.
* @property isStrongBiometricsEnabled Authentication with strong methods (fingerprint, some face/iris unlock implementations) is supported.
* @property isWeakBiometricsEnabled Authentication with weak methods (most face/iris unlock implementations) is supported.
*/
data class LockScreenConfig(
/**
* Whether the PIN is mandatory or not.
*/
val isPinMandatory: Boolean,
/**
* Some PINs are forbidden.
*/
val pinBlacklist: Set<String>,
/**
* The size of the PIN.
*/
val pinSize: Int,
/**
* Number of attempts before the user is logged out.
*/
val maxPinCodeAttemptsBeforeLogout: Int,
/**
* Time period before locking the app once backgrounded.
*/
val gracePeriod: Duration,
/**
* Authentication with strong methods (fingerprint, some face/iris unlock implementations) is supported.
*/
val isStrongBiometricsEnabled: Boolean,
/**
* Authentication with weak methods (most face/iris unlock implementations) is supported.
*/
val isWeakBiometricsEnabled: Boolean,
)
@ContributesTo(AppScope::class)
@Module
object LockScreenConfigModule {
@Provides
fun providesLockScreenConfig(): LockScreenConfig = LockScreenConfig(
isPinMandatory = false,

2
appconfig/src/main/kotlin/io/element/android/appconfig/MatrixConfiguration.kt

@ -17,6 +17,6 @@ @@ -17,6 +17,6 @@
package io.element.android.appconfig
object MatrixConfiguration {
const val matrixToPermalinkBaseUrl: String = "https://matrix.to/#/"
const val MATRIX_TO_PERMALINK_BASE_URL: String = "https://matrix.to/#/"
val clientPermalinkBaseUrl: String? = null
}

4
appconfig/src/main/kotlin/io/element/android/appconfig/NotificationConfig.kt

@ -18,8 +18,8 @@ package io.element.android.appconfig @@ -18,8 +18,8 @@ package io.element.android.appconfig
object NotificationConfig {
// TODO EAx Implement and set to true at some point
const val supportMarkAsReadAction = false
const val SUPPORT_MARK_AS_READ_ACTION = false
// TODO EAx Implement and set to true at some point
const val supportQuickReplyAction = false
const val SUPPORT_QUICK_REPLY_ACTION = false
}

2
appconfig/src/main/kotlin/io/element/android/appconfig/PushConfig.kt

@ -20,5 +20,5 @@ object PushConfig { @@ -20,5 +20,5 @@ object PushConfig {
/**
* Note: pusher_app_id cannot exceed 64 chars.
*/
const val pusher_app_id: String = "im.vector.app.android"
const val PUSHER_APP_ID: String = "im.vector.app.android"
}

6
appconfig/src/main/kotlin/io/element/android/appconfig/RoomListConfig.kt

@ -17,8 +17,8 @@ @@ -17,8 +17,8 @@
package io.element.android.appconfig
object RoomListConfig {
const val showInviteMenuItem = false
const val showReportProblemMenuItem = false
const val SHOW_INVITE_MENU_ITEM = false
const val SHOW_REPORT_PROBLEM_MENU_ITEM = false
const val hasDropdownMenu = showInviteMenuItem || showReportProblemMenuItem
const val HAS_DROP_DOWN_MENU = SHOW_INVITE_MENU_ITEM || SHOW_REPORT_PROBLEM_MENU_ITEM
}

2
appconfig/src/main/kotlin/io/element/android/appconfig/SecureBackupConfig.kt

@ -17,5 +17,5 @@ @@ -17,5 +17,5 @@
package io.element.android.appconfig
object SecureBackupConfig {
const val LearnMoreUrl: String = "https://element.io/help#encryption5"
const val LEARN_MORE_URL: String = "https://element.io/help#encryption5"
}

2
appconfig/src/main/kotlin/io/element/android/appconfig/TimelineConfig.kt

@ -17,5 +17,5 @@ @@ -17,5 +17,5 @@
package io.element.android.appconfig
object TimelineConfig {
const val maxReadReceiptToDisplay = 3
const val MAX_READ_RECEIPT_TO_DISPLAY = 3
}

1
appnav/src/main/kotlin/io/element/android/appnav/BackstackExt.kt

@ -40,4 +40,3 @@ fun <T : Any> BackStack<T>.removeLast(element: T) { @@ -40,4 +40,3 @@ fun <T : Any> BackStack<T>.removeLast(element: T) {
} ?: return
accept(Remove(lastExpectedNavElement.key))
}

1
appnav/src/main/kotlin/io/element/android/appnav/LoggedInEventProcessor.kt

@ -36,7 +36,6 @@ class LoggedInEventProcessor @Inject constructor( @@ -36,7 +36,6 @@ class LoggedInEventProcessor @Inject constructor(
roomMembershipObserver: RoomMembershipObserver,
sessionVerificationService: SessionVerificationService,
) {
private var observingJob: Job? = null
private val displayLeftRoomMessage = roomMembershipObserver.updates

3
appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt

@ -111,7 +111,6 @@ class LoggedInFlowNode @AssistedInject constructor( @@ -111,7 +111,6 @@ class LoggedInFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
interface Callback : Plugin {
fun onOpenBugReport()
}
@ -138,7 +137,7 @@ class LoggedInFlowNode @AssistedInject constructor( @@ -138,7 +137,7 @@ class LoggedInFlowNode @AssistedInject constructor(
},
onStop = {
coroutineScope.launch {
//Counterpart startSync is done in observeSyncStateAndNetworkStatus method.
// Counterpart startSync is done in observeSyncStateAndNetworkStatus method.
syncService.stopSync()
}
},

4
appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt

@ -81,7 +81,6 @@ class RootFlowNode @AssistedInject constructor( @@ -81,7 +81,6 @@ class RootFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
override fun onBuilt() {
matrixClientsHolder.restoreWithSavedState(buildContext.savedStateMap)
super.onBuilt()
@ -268,10 +267,9 @@ class RootFlowNode @AssistedInject constructor( @@ -268,10 +267,9 @@ class RootFlowNode @AssistedInject constructor(
}
private suspend fun attachSession(sessionId: SessionId): LoggedInAppScopeFlowNode {
//TODO handle multi-session
// TODO handle multi-session
return waitForChildAttached { navTarget ->
navTarget is NavTarget.LoggedInFlow && navTarget.sessionId == sessionId
}
}
}

4
appnav/src/main/kotlin/io/element/android/appnav/di/MatrixClientsHolder.kt

@ -37,7 +37,6 @@ private const val SAVE_INSTANCE_KEY = "io.element.android.x.di.MatrixClientsHold @@ -37,7 +37,6 @@ private const val SAVE_INSTANCE_KEY = "io.element.android.x.di.MatrixClientsHold
@SingleIn(AppScope::class)
@ContributesBinding(AppScope::class)
class MatrixClientsHolder @Inject constructor(private val authenticationService: MatrixAuthenticationService) : MatrixClientProvider {
private val sessionIdsToMatrixClient = ConcurrentHashMap<SessionId, MatrixClient>()
private val restoreMutex = Mutex()
@ -65,8 +64,9 @@ class MatrixClientsHolder @Inject constructor(private val authenticationService: @@ -65,8 +64,9 @@ class MatrixClientsHolder @Inject constructor(private val authenticationService:
@Suppress("UNCHECKED_CAST")
fun restoreWithSavedState(state: SavedStateMap?) {
Timber.d("Restore state")
if (state == null || sessionIdsToMatrixClient.isNotEmpty()) return Unit.also {
if (state == null || sessionIdsToMatrixClient.isNotEmpty()) {
Timber.w("Restore with non-empty map")
return
}
val sessionIds = state[SAVE_INSTANCE_KEY] as? Array<SessionId>
Timber.d("Restore matrix session keys = ${sessionIds?.map { it.value }}")

21
appnav/src/main/kotlin/io/element/android/appnav/loggedin/LoggedInEvents.kt

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
/*
* Copyright (c) 2023 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.appnav.loggedin
// sealed interface LoggedInEvents {
// data object MyEvent : LoggedInEvents
// }

1
appnav/src/main/kotlin/io/element/android/appnav/loggedin/LoggedInNode.kt

@ -35,7 +35,6 @@ class LoggedInNode @AssistedInject constructor( @@ -35,7 +35,6 @@ class LoggedInNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
@Composable
override fun View(modifier: Modifier) {
val loggedInState = loggedInPresenter.present()

1
appnav/src/main/kotlin/io/element/android/appnav/loggedin/LoggedInPresenter.kt

@ -35,7 +35,6 @@ class LoggedInPresenter @Inject constructor( @@ -35,7 +35,6 @@ class LoggedInPresenter @Inject constructor(
private val networkMonitor: NetworkMonitor,
private val pushService: PushService,
) : Presenter<LoggedInState> {
@Composable
override fun present(): LoggedInState {
LaunchedEffect(Unit) {

8
appnav/src/main/kotlin/io/element/android/appnav/loggedin/SyncStateView.kt

@ -59,15 +59,15 @@ fun SyncStateView( @@ -59,15 +59,15 @@ fun SyncStateView(
) {
Row(
modifier = Modifier
.background(color = ElementTheme.colors.bgSubtleSecondary)
.padding(horizontal = 24.dp, vertical = 10.dp),
.background(color = ElementTheme.colors.bgSubtleSecondary)
.padding(horizontal = 24.dp, vertical = 10.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {
CircularProgressIndicator(
modifier = Modifier
.progressSemantics()
.size(12.dp),
.progressSemantics()
.size(12.dp),
color = ElementTheme.colors.textPrimary,
strokeWidth = 1.5.dp,
)

1
appnav/src/main/kotlin/io/element/android/appnav/room/LoadingRoomState.kt

@ -47,7 +47,6 @@ open class LoadingRoomStateProvider : PreviewParameterProvider<LoadingRoomState> @@ -47,7 +47,6 @@ open class LoadingRoomStateProvider : PreviewParameterProvider<LoadingRoomState>
@SingleIn(SessionScope::class)
class LoadingRoomStateFlowFactory @Inject constructor(private val matrixClient: MatrixClient) {
fun create(lifecycleScope: CoroutineScope, roomId: RoomId): StateFlow<LoadingRoomState> =
getRoomFlow(roomId)
.map { room ->

2
appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt

@ -66,7 +66,6 @@ class RoomFlowNode @AssistedInject constructor( @@ -66,7 +66,6 @@ class RoomFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
data class Inputs(
val roomId: RoomId,
val initialElement: RoomLoadedFlowNode.NavTarget = RoomLoadedFlowNode.NavTarget.Messages,
@ -136,4 +135,3 @@ class RoomFlowNode @AssistedInject constructor( @@ -136,4 +135,3 @@ class RoomFlowNode @AssistedInject constructor(
)
}
}

1
appnav/src/main/kotlin/io/element/android/appnav/room/RoomLoadedFlowNode.kt

@ -71,7 +71,6 @@ class RoomLoadedFlowNode @AssistedInject constructor( @@ -71,7 +71,6 @@ class RoomLoadedFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins,
), DaggerComponentOwner {
interface Callback : Plugin {
fun onOpenRoom(roomId: RoomId)
fun onForwardedToSingleRoom(roomId: RoomId)

1
appnav/src/main/kotlin/io/element/android/appnav/root/RootNavStateFlowFactory.kt

@ -41,7 +41,6 @@ class RootNavStateFlowFactory @Inject constructor( @@ -41,7 +41,6 @@ class RootNavStateFlowFactory @Inject constructor(
private val matrixClientsHolder: MatrixClientsHolder,
private val loginUserStory: LoginUserStory,
) {
private var currentCacheIndex = 0
fun create(savedStateMap: SavedStateMap?): Flow<RootNavState> {

1
appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt

@ -30,7 +30,6 @@ class RootPresenter @Inject constructor( @@ -30,7 +30,6 @@ class RootPresenter @Inject constructor(
private val rageshakeDetectionPresenter: RageshakeDetectionPresenter,
private val appErrorStateService: AppErrorStateService,
) : Presenter<RootState> {
@Composable
override fun present(): RootState {
val rageshakeDetectionState = rageshakeDetectionPresenter.present()

4
appnav/src/test/kotlin/io/element/android/appnav/RoomFlowNodeTest.kt

@ -41,7 +41,6 @@ import org.junit.Rule @@ -41,7 +41,6 @@ import org.junit.Rule
import org.junit.Test
class RoomFlowNodeTest {
@get:Rule
val instantTaskExecutorRule = InstantTaskExecutorRule()
@ -49,7 +48,6 @@ class RoomFlowNodeTest { @@ -49,7 +48,6 @@ class RoomFlowNodeTest {
val mainDispatcherRule = MainDispatcherRule()
private class FakeMessagesEntryPoint : MessagesEntryPoint {
var nodeId: String? = null
var callback: MessagesEntryPoint.Callback? = null
@ -68,12 +66,10 @@ class RoomFlowNodeTest { @@ -68,12 +66,10 @@ class RoomFlowNodeTest {
}
private class FakeRoomDetailsEntryPoint : RoomDetailsEntryPoint {
var nodeId: String? = null
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): RoomDetailsEntryPoint.NodeBuilder {
return object : RoomDetailsEntryPoint.NodeBuilder {
override fun params(params: RoomDetailsEntryPoint.Params): RoomDetailsEntryPoint.NodeBuilder {
return this
}

1
appnav/src/test/kotlin/io/element/android/appnav/loggedin/LoggedInPresenterTest.kt

@ -36,7 +36,6 @@ import org.junit.Rule @@ -36,7 +36,6 @@ import org.junit.Rule
import org.junit.Test
class LoggedInPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()

13
appnav/src/test/kotlin/io/element/android/appnav/room/LoadingRoomStateFlowFactoryTest.kt

@ -28,25 +28,24 @@ import kotlinx.coroutines.test.runTest @@ -28,25 +28,24 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
class LoadingRoomStateFlowFactoryTest {
@Test
fun `flow should emit Loading and then Loaded when there is a room in cache`() = runTest {
val room = FakeMatrixRoom(sessionId= A_SESSION_ID, roomId = A_ROOM_ID)
val room = FakeMatrixRoom(sessionId = A_SESSION_ID, roomId = A_ROOM_ID)
val matrixClient = FakeMatrixClient(A_SESSION_ID).apply {
givenGetRoomResult(A_ROOM_ID, room)
}
val flowFactory = LoadingRoomStateFlowFactory(matrixClient)
flowFactory
.create(this, A_ROOM_ID)
.test {
assertThat(awaitItem()).isEqualTo(LoadingRoomState.Loading)
assertThat(awaitItem()).isEqualTo(LoadingRoomState.Loaded(room))
}
.test {
assertThat(awaitItem()).isEqualTo(LoadingRoomState.Loading)
assertThat(awaitItem()).isEqualTo(LoadingRoomState.Loaded(room))
}
}
@Test
fun `flow should emit Loading and then Loaded when there is a room in cache after SS is loaded`() = runTest {
val room = FakeMatrixRoom(sessionId= A_SESSION_ID, roomId = A_ROOM_ID)
val room = FakeMatrixRoom(sessionId = A_SESSION_ID, roomId = A_ROOM_ID)
val roomListService = FakeRoomListService()
val matrixClient = FakeMatrixClient(A_SESSION_ID, roomListService = roomListService)
val flowFactory = LoadingRoomStateFlowFactory(matrixClient)

14
build.gradle.kts

@ -60,7 +60,7 @@ allprojects { @@ -60,7 +60,7 @@ allprojects {
config.from(files("$rootDir/tools/detekt/detekt.yml"))
}
dependencies {
detektPlugins("io.nlopez.compose.rules:detekt:0.3.8")
detektPlugins("io.nlopez.compose.rules:detekt:0.3.9")
}
// KtLint
@ -72,7 +72,7 @@ allprojects { @@ -72,7 +72,7 @@ allprojects {
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
// See https://github.com/pinterest/ktlint/releases/
// TODO Regularly check for new version here ^
version.set("0.48.2")
version.set("1.1.1")
android.set(true)
ignoreFailures.set(false)
enableExperimentalRules.set(true)
@ -100,8 +100,8 @@ allprojects { @@ -100,8 +100,8 @@ allprojects {
kotlinOptions.allWarningsAsErrors = project.properties["allWarningsAsErrors"] == "true"
kotlinOptions {
// Uncomment to suppress Compose Kotlin compiler compatibility warning
/*
// Uncomment to suppress Compose Kotlin compiler compatibility warning
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true"
@ -194,7 +194,7 @@ subprojects { @@ -194,7 +194,7 @@ subprojects {
// Workaround for https://github.com/airbnb/Showkase/issues/335
subprojects {
tasks.withType<KspTask>() {
tasks.withType<KspTask> {
doLast {
fileTree(layout.buildDirectory).apply { include("**/*ShowkaseExtension*.kt") }.files.forEach { file ->
ReplaceRegExp().apply {
@ -216,13 +216,15 @@ subprojects { @@ -216,13 +216,15 @@ subprojects {
if (project.findProperty("composeCompilerReports") == "true") {
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=${project.layout.buildDirectory.asFile.get().absolutePath}/compose_compiler"
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
"${project.layout.buildDirectory.asFile.get().absolutePath}/compose_compiler"
)
}
if (project.findProperty("composeCompilerMetrics") == "true") {
freeCompilerArgs += listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=${project.layout.buildDirectory.asFile.get().absolutePath}/compose_compiler"
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
"${project.layout.buildDirectory.asFile.get().absolutePath}/compose_compiler"
)
}
}

1
changelog.d/2156.bugfix

@ -0,0 +1 @@ @@ -0,0 +1 @@
Improve rendering of voice messages in the timeline in large displays

2
features/analytics/api/src/main/kotlin/io/element/android/features/analytics/api/preferences/AnalyticsPreferencesView.kt

@ -25,8 +25,8 @@ import io.element.android.features.analytics.api.AnalyticsOptInEvents @@ -25,8 +25,8 @@ import io.element.android.features.analytics.api.AnalyticsOptInEvents
import io.element.android.features.analytics.api.R
import io.element.android.libraries.designsystem.components.LINK_TAG
import io.element.android.libraries.designsystem.components.list.ListItemContent
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.text.buildAnnotatedStringWithStyledPart
import io.element.android.libraries.designsystem.theme.components.ListItem
import io.element.android.libraries.designsystem.theme.components.ListSupportingText

1
features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInNode.kt

@ -37,7 +37,6 @@ class AnalyticsOptInNode @AssistedInject constructor( @@ -37,7 +37,6 @@ class AnalyticsOptInNode @AssistedInject constructor(
@Assisted plugins: List<Plugin>,
private val presenter: AnalyticsOptInPresenter,
) : Node(buildContext, plugins = plugins) {
private fun onClickTerms(activity: Activity, darkTheme: Boolean) {
activity.openUrlInChromeCustomTab(null, darkTheme, AnalyticsConfig.POLICY_LINK)
}

1
features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInPresenter.kt

@ -30,7 +30,6 @@ class AnalyticsOptInPresenter @Inject constructor( @@ -30,7 +30,6 @@ class AnalyticsOptInPresenter @Inject constructor(
private val buildMeta: BuildMeta,
private val analyticsService: AnalyticsService,
) : Presenter<AnalyticsOptInState> {
@Composable
override fun present(): AnalyticsOptInState {
val localCoroutineScope = rememberCoroutineScope()

3
features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInStateProvider.kt

@ -19,8 +19,7 @@ package io.element.android.features.analytics.impl @@ -19,8 +19,7 @@ package io.element.android.features.analytics.impl
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import javax.inject.Inject
open class AnalyticsOptInStateProvider @Inject constructor(
) : PreviewParameterProvider<AnalyticsOptInState> {
open class AnalyticsOptInStateProvider @Inject constructor() : PreviewParameterProvider<AnalyticsOptInState> {
override val values: Sequence<AnalyticsOptInState>
get() = sequenceOf(
aAnalyticsOptInState(),

1
features/analytics/impl/src/main/kotlin/io/element/android/features/analytics/impl/preferences/DefaultAnalyticsPreferencesPresenter.kt

@ -36,7 +36,6 @@ class DefaultAnalyticsPreferencesPresenter @Inject constructor( @@ -36,7 +36,6 @@ class DefaultAnalyticsPreferencesPresenter @Inject constructor(
private val analyticsService: AnalyticsService,
private val buildMeta: BuildMeta,
) : AnalyticsPreferencesPresenter {
@Composable
override fun present(): AnalyticsPreferencesState {
val localCoroutineScope = rememberCoroutineScope()

2
features/analytics/impl/src/test/kotlin/io/element/android/features/analytics/impl/AnalyticsOptInPresenterTest.kt

@ -30,7 +30,6 @@ import org.junit.Rule @@ -30,7 +30,6 @@ import org.junit.Rule
import org.junit.Test
class AnalyticsOptInPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@ -70,4 +69,3 @@ class AnalyticsOptInPresenterTest { @@ -70,4 +69,3 @@ class AnalyticsOptInPresenterTest {
}
}
}

2
features/analytics/impl/src/test/kotlin/io/element/android/features/analytics/impl/preferences/AnalyticsPreferencesPresenterTest.kt

@ -29,7 +29,6 @@ import org.junit.Rule @@ -29,7 +29,6 @@ import org.junit.Rule
import org.junit.Test
class AnalyticsPreferencesPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@ -82,4 +81,3 @@ class AnalyticsPreferencesPresenterTest { @@ -82,4 +81,3 @@ class AnalyticsPreferencesPresenterTest {
}
}
}

1
features/call/src/main/kotlin/io/element/android/features/call/CallForegroundService.kt

@ -30,7 +30,6 @@ import io.element.android.features.call.ui.ElementCallActivity @@ -30,7 +30,6 @@ import io.element.android.features.call.ui.ElementCallActivity
import io.element.android.libraries.designsystem.utils.CommonDrawables
class CallForegroundService : Service() {
companion object {
fun start(context: Context) {
val intent = Intent(context, CallForegroundService::class.java)

3
features/call/src/main/kotlin/io/element/android/features/call/data/WidgetMessage.kt

@ -28,11 +28,11 @@ data class WidgetMessage( @@ -28,11 +28,11 @@ data class WidgetMessage(
@SerialName("action") val action: Action,
@SerialName("data") val data: JsonElement? = null,
) {
@Serializable
enum class Direction {
@SerialName("fromWidget")
FromWidget,
@SerialName("toWidget")
ToWidget
}
@ -41,6 +41,7 @@ data class WidgetMessage( @@ -41,6 +41,7 @@ data class WidgetMessage(
enum class Action {
@SerialName("im.vector.hangup")
HangUp,
@SerialName("send_event")
SendEvent,
}

3
features/call/src/main/kotlin/io/element/android/features/call/ui/CallScreenPresenter.kt

@ -63,7 +63,6 @@ class CallScreenPresenter @AssistedInject constructor( @@ -63,7 +63,6 @@ class CallScreenPresenter @AssistedInject constructor(
private val matrixClientsProvider: MatrixClientProvider,
private val appCoroutineScope: CoroutineScope,
) : Presenter<CallScreenState> {
@AssistedFactory
interface Factory {
fun create(callType: CallType, navigator: CallScreenNavigator): CallScreenPresenter
@ -224,6 +223,4 @@ class CallScreenPresenter @AssistedInject constructor( @@ -224,6 +223,4 @@ class CallScreenPresenter @AssistedInject constructor(
navigator.close()
widgetDriver?.close()
}
}

1
features/call/src/main/kotlin/io/element/android/features/call/utils/CallIntentDataParser.kt

@ -20,7 +20,6 @@ import android.net.Uri @@ -20,7 +20,6 @@ import android.net.Uri
import javax.inject.Inject
class CallIntentDataParser @Inject constructor() {
private val validHttpSchemes = sequenceOf("https")
fun parse(data: String?): String? {

3
features/call/src/main/kotlin/io/element/android/features/call/utils/WebViewWidgetMessageInterceptor.kt

@ -28,7 +28,6 @@ import kotlinx.coroutines.flow.MutableSharedFlow @@ -28,7 +28,6 @@ import kotlinx.coroutines.flow.MutableSharedFlow
class WebViewWidgetMessageInterceptor(
private val webView: WebView,
) : WidgetMessageInterceptor {
companion object {
// We call both the WebMessageListener and the JavascriptInterface objects in JS with this
// 'listenerName' so they can both receive the data from the WebView when
@ -56,7 +55,7 @@ class WebViewWidgetMessageInterceptor( @@ -56,7 +55,7 @@ class WebViewWidgetMessageInterceptor(
|| !message.data.response && message.data.api == "fromWidget") {
let json = JSON.stringify(event.data)
${"console.log('message sent: ' + json);".takeIf { BuildConfig.DEBUG } }
${LISTENER_NAME}.postMessage(json);
$LISTENER_NAME.postMessage(json);
} else {
${"console.log('message received (ignored): ' + JSON.stringify(event.data));".takeIf { BuildConfig.DEBUG } }
}

1
features/call/src/main/kotlin/io/element/android/features/call/utils/WidgetMessageSerializer.kt

@ -20,7 +20,6 @@ import io.element.android.features.call.data.WidgetMessage @@ -20,7 +20,6 @@ import io.element.android.features.call.data.WidgetMessage
import kotlinx.serialization.json.Json
object WidgetMessageSerializer {
private val coder = Json { ignoreUnknownKeys = true }
fun deserialize(message: String): Result<WidgetMessage> {

1
features/call/src/test/kotlin/io/element/android/features/call/MapWebkitPermissionsTest.kt

@ -23,7 +23,6 @@ import io.element.android.features.call.ui.mapWebkitPermissions @@ -23,7 +23,6 @@ import io.element.android.features.call.ui.mapWebkitPermissions
import org.junit.Test
class MapWebkitPermissionsTest {
@Test
fun `given Webkit's RESOURCE_AUDIO_CAPTURE returns Android's RECORD_AUDIO permission`() {
val permission = mapWebkitPermissions(arrayOf(PermissionRequest.RESOURCE_AUDIO_CAPTURE))

3
features/call/src/test/kotlin/io/element/android/features/call/ui/CallScreenPresenterTest.kt

@ -48,7 +48,6 @@ import org.junit.Rule @@ -48,7 +48,6 @@ import org.junit.Rule
import org.junit.Test
class CallScreenPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@ -191,7 +190,7 @@ class CallScreenPresenterTest { @@ -191,7 +190,7 @@ class CallScreenPresenterTest {
moleculeFlow(RecompositionMode.Immediate) {
presenter.present()
}.test {
consumeItemsUntilTimeout()
consumeItemsUntilTimeout()
assertThat(matrixClient.syncService().syncState.value).isEqualTo(SyncState.Running)

10
features/call/src/test/kotlin/io/element/android/features/call/ui/FakeCallScreenNavigator.kt

@ -17,10 +17,10 @@ @@ -17,10 +17,10 @@
package io.element.android.features.call.ui
class FakeCallScreenNavigator : CallScreenNavigator {
var closeCalled = false
private set
var closeCalled = false
private set
override fun close() {
closeCalled = true
}
override fun close() {
closeCalled = true
}
}

23
features/call/src/test/kotlin/io/element/android/features/call/utils/CallIntentDataParserTest.kt

@ -24,7 +24,6 @@ import java.net.URLEncoder @@ -24,7 +24,6 @@ import java.net.URLEncoder
@RunWith(RobolectricTestRunner::class)
class CallIntentDataParserTest {
private val callIntentDataParser = CallIntentDataParser()
@Test
@ -117,7 +116,7 @@ class CallIntentDataParserTest { @@ -117,7 +116,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url extra param appPrompt gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}&appPrompt=true",
url = "$VALID_CALL_URL_WITH_PARAM&appPrompt=true",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?$EXTRA_PARAMS"
)
}
@ -125,7 +124,7 @@ class CallIntentDataParserTest { @@ -125,7 +124,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url extra param in fragment appPrompt gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#?appPrompt=true",
url = "$VALID_CALL_URL_WITH_PARAM#?appPrompt=true",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?appPrompt=false&confineToRoom=true"
)
}
@ -133,7 +132,7 @@ class CallIntentDataParserTest { @@ -133,7 +132,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url extra param in fragment appPrompt and other gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#?appPrompt=true&otherParam=maybe",
url = "$VALID_CALL_URL_WITH_PARAM#?appPrompt=true&otherParam=maybe",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?appPrompt=false&otherParam=maybe&confineToRoom=true"
)
}
@ -141,7 +140,7 @@ class CallIntentDataParserTest { @@ -141,7 +140,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url extra param confineToRoom gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}&confineToRoom=false",
url = "$VALID_CALL_URL_WITH_PARAM&confineToRoom=false",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?$EXTRA_PARAMS"
)
}
@ -149,7 +148,7 @@ class CallIntentDataParserTest { @@ -149,7 +148,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url extra param in fragment confineToRoom gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#?confineToRoom=false",
url = "$VALID_CALL_URL_WITH_PARAM#?confineToRoom=false",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?confineToRoom=true&appPrompt=false"
)
}
@ -157,7 +156,7 @@ class CallIntentDataParserTest { @@ -157,7 +156,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url extra param in fragment confineToRoom and more gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#?confineToRoom=false&otherParam=maybe",
url = "$VALID_CALL_URL_WITH_PARAM#?confineToRoom=false&otherParam=maybe",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?confineToRoom=true&otherParam=maybe&appPrompt=false"
)
}
@ -165,7 +164,7 @@ class CallIntentDataParserTest { @@ -165,7 +164,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url fragment gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#fragment",
url = "$VALID_CALL_URL_WITH_PARAM#fragment",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#fragment?$EXTRA_PARAMS"
)
}
@ -173,7 +172,7 @@ class CallIntentDataParserTest { @@ -173,7 +172,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url fragment with params gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#fragment?otherParam=maybe",
url = "$VALID_CALL_URL_WITH_PARAM#fragment?otherParam=maybe",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#fragment?otherParam=maybe&$EXTRA_PARAMS"
)
}
@ -181,7 +180,7 @@ class CallIntentDataParserTest { @@ -181,7 +180,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with url fragment with other params gets url extracted`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#?otherParam=maybe",
url = "$VALID_CALL_URL_WITH_PARAM#?otherParam=maybe",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?otherParam=maybe&$EXTRA_PARAMS"
)
}
@ -189,7 +188,7 @@ class CallIntentDataParserTest { @@ -189,7 +188,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with empty fragment`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#",
url = "$VALID_CALL_URL_WITH_PARAM#",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?$EXTRA_PARAMS"
)
}
@ -197,7 +196,7 @@ class CallIntentDataParserTest { @@ -197,7 +196,7 @@ class CallIntentDataParserTest {
@Test
fun `Element Call url with empty fragment query`() {
doTest(
url = "${VALID_CALL_URL_WITH_PARAM}#?",
url = "$VALID_CALL_URL_WITH_PARAM#?",
expectedResult = "$VALID_CALL_URL_WITH_PARAM#?$EXTRA_PARAMS"
)
}

1
features/call/src/test/kotlin/io/element/android/features/call/utils/DefaultCallWidgetProviderTest.kt

@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest @@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
class DefaultCallWidgetProviderTest {
@Test
fun `getWidget - fails if the session does not exist`() = runTest {
val provider = createProvider(matrixClientProvider = FakeMatrixClientProvider { Result.failure(Exception("Session not found")) })

27
features/call/src/test/kotlin/io/element/android/features/call/utils/FakeCallWidgetProvider.kt

@ -24,19 +24,18 @@ import io.element.android.libraries.matrix.test.widget.FakeWidgetDriver @@ -24,19 +24,18 @@ import io.element.android.libraries.matrix.test.widget.FakeWidgetDriver
class FakeCallWidgetProvider(
private val widgetDriver: FakeWidgetDriver = FakeWidgetDriver(),
private val url: String = "https://call.element.io",
) : CallWidgetProvider {
) : CallWidgetProvider {
var getWidgetCalled = false
private set
var getWidgetCalled = false
private set
override suspend fun getWidget(
sessionId: SessionId,
roomId: RoomId,
clientId: String,
languageTag: String?,
theme: String?
): Result<Pair<MatrixWidgetDriver, String>> {
getWidgetCalled = true
return Result.success(widgetDriver to url)
}
override suspend fun getWidget(
sessionId: SessionId,
roomId: RoomId,
clientId: String,
languageTag: String?,
theme: String?
): Result<Pair<MatrixWidgetDriver, String>> {
getWidgetCalled = true
return Result.success(widgetDriver to url)
}
}

16
features/call/src/test/kotlin/io/element/android/features/call/utils/FakeWidgetMessageInterceptor.kt

@ -19,15 +19,15 @@ package io.element.android.features.call.utils @@ -19,15 +19,15 @@ package io.element.android.features.call.utils
import kotlinx.coroutines.flow.MutableSharedFlow
class FakeWidgetMessageInterceptor : WidgetMessageInterceptor {
val sentMessages = mutableListOf<String>()
val sentMessages = mutableListOf<String>()
override val interceptedMessages = MutableSharedFlow<String>(extraBufferCapacity = 1)
override val interceptedMessages = MutableSharedFlow<String>(extraBufferCapacity = 1)
override fun sendMessage(message: String) {
sentMessages += message
}
override fun sendMessage(message: String) {
sentMessages += message
}
fun givenInterceptedMessage(message: String) {
interceptedMessages.tryEmit(message)
}
fun givenInterceptedMessage(message: String) {
interceptedMessages.tryEmit(message)
}
}

1
features/createroom/api/src/main/kotlin/io/element/android/features/createroom/api/CreateRoomEntryPoint.kt

@ -23,7 +23,6 @@ import io.element.android.libraries.architecture.FeatureEntryPoint @@ -23,7 +23,6 @@ import io.element.android.libraries.architecture.FeatureEntryPoint
import io.element.android.libraries.matrix.api.core.RoomId
interface CreateRoomEntryPoint : FeatureEntryPoint {
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
interface NodeBuilder {
fun callback(callback: Callback): NodeBuilder

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/ConfigureRoomFlowNode.kt

@ -52,7 +52,6 @@ class ConfigureRoomFlowNode @AssistedInject constructor( @@ -52,7 +52,6 @@ class ConfigureRoomFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
private val component by lazy {
parent!!.bindings<CreateRoomComponent.ParentBindings>().createRoomComponentBuilder().build()
}

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/CreateRoomDataStore.kt

@ -33,7 +33,6 @@ import javax.inject.Inject @@ -33,7 +33,6 @@ import javax.inject.Inject
class CreateRoomDataStore @Inject constructor(
val selectedUserListDataStore: UserListDataStore,
) {
private val createRoomConfigFlow: MutableStateFlow<CreateRoomConfig> = MutableStateFlow(CreateRoomConfig())
private var cachedAvatarUri: Uri? = null
set(value) {

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/CreateRoomFlowNode.kt

@ -50,7 +50,6 @@ class CreateRoomFlowNode @AssistedInject constructor( @@ -50,7 +50,6 @@ class CreateRoomFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins
) {
sealed interface NavTarget : Parcelable {
@Parcelize
data object Root : NavTarget

3
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/DefaultCreateRoomEntryPoint.kt

@ -27,13 +27,10 @@ import javax.inject.Inject @@ -27,13 +27,10 @@ import javax.inject.Inject
@ContributesBinding(AppScope::class)
class DefaultCreateRoomEntryPoint @Inject constructor() : CreateRoomEntryPoint {
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): CreateRoomEntryPoint.NodeBuilder {
val plugins = ArrayList<Plugin>()
return object : CreateRoomEntryPoint.NodeBuilder {
override fun callback(callback: CreateRoomEntryPoint.Callback): CreateRoomEntryPoint.NodeBuilder {
plugins += callback
return this

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/DefaultStartDMAction.kt

@ -35,7 +35,6 @@ class DefaultStartDMAction @Inject constructor( @@ -35,7 +35,6 @@ class DefaultStartDMAction @Inject constructor(
private val matrixClient: MatrixClient,
private val analyticsService: AnalyticsService,
) : StartDMAction {
override suspend fun execute(userId: UserId, actionState: MutableState<AsyncAction<RoomId>>) {
actionState.value = AsyncAction.Loading
when (val result = matrixClient.startDM(userId)) {

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeopleNode.kt

@ -33,7 +33,6 @@ class AddPeopleNode @AssistedInject constructor( @@ -33,7 +33,6 @@ class AddPeopleNode @AssistedInject constructor(
@Assisted plugins: List<Plugin>,
private val presenter: AddPeoplePresenter,
) : Node(buildContext, plugins = plugins) {
interface Callback : Plugin {
fun onContinue()
}

2
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeoplePresenter.kt

@ -31,7 +31,6 @@ class AddPeoplePresenter @Inject constructor( @@ -31,7 +31,6 @@ class AddPeoplePresenter @Inject constructor(
userRepository: UserRepository,
dataStore: CreateRoomDataStore,
) : Presenter<UserListState> {
private val userListPresenter = userListPresenterFactory.create(
UserListPresenterArgs(
selectionMode = SelectionMode.Multiple,
@ -45,4 +44,3 @@ class AddPeoplePresenter @Inject constructor( @@ -45,4 +44,3 @@ class AddPeoplePresenter @Inject constructor(
return userListPresenter.present()
}
}

12
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeopleUserListStateProvider.kt

@ -37,11 +37,13 @@ open class AddPeopleUserListStateProvider : PreviewParameterProvider<UserListSta @@ -37,11 +37,13 @@ open class AddPeopleUserListStateProvider : PreviewParameterProvider<UserListSta
selectionMode = SelectionMode.Multiple,
),
aUserListState().copy(
searchResults = SearchBarResultState.Results(aMatrixUserList()
.mapIndexed { index, matrixUser ->
UserSearchResult(matrixUser, index % 2 == 0)
}
.toImmutableList()),
searchResults = SearchBarResultState.Results(
aMatrixUserList()
.mapIndexed { index, matrixUser ->
UserSearchResult(matrixUser, index % 2 == 0)
}
.toImmutableList()
),
selectedUsers = aListOfSelectedUsers(),
isSearchActive = true,
selectionMode = SelectionMode.Multiple,

7
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/components/RoomPrivacyOption.kt

@ -29,14 +29,14 @@ import androidx.compose.ui.Alignment @@ -29,14 +29,14 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.features.createroom.impl.configureroom.RoomPrivacyItem
import io.element.android.features.createroom.impl.configureroom.roomPrivacyItems
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.components.RadioButton
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.compound.theme.ElementTheme
@Composable
fun RoomPrivacyOption(
@ -85,7 +85,8 @@ fun RoomPrivacyOption( @@ -85,7 +85,8 @@ fun RoomPrivacyOption(
.align(Alignment.CenterVertically)
.size(48.dp),
selected = isSelected,
onClick = null // null recommended for accessibility with screenreaders
// null recommended for accessibility with screenreaders
onClick = null
)
}
}

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/ConfigureRoomNode.kt

@ -38,7 +38,6 @@ class ConfigureRoomNode @AssistedInject constructor( @@ -38,7 +38,6 @@ class ConfigureRoomNode @AssistedInject constructor(
private val presenter: ConfigureRoomPresenter,
private val analyticsService: AnalyticsService,
) : Node(buildContext, plugins = plugins) {
init {
lifecycle.subscribe(
onResume = {

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/ConfigureRoomPresenter.kt

@ -57,7 +57,6 @@ class ConfigureRoomPresenter @Inject constructor( @@ -57,7 +57,6 @@ class ConfigureRoomPresenter @Inject constructor(
private val analyticsService: AnalyticsService,
permissionsPresenterFactory: PermissionsPresenter.Factory,
) : Presenter<ConfigureRoomState> {
private val cameraPermissionPresenter: PermissionsPresenter = permissionsPresenterFactory.create(android.Manifest.permission.CAMERA)
private var pendingPermissionRequest = false

2
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/configureroom/RoomPrivacyItem.kt

@ -19,8 +19,8 @@ package io.element.android.features.createroom.impl.configureroom @@ -19,8 +19,8 @@ package io.element.android.features.createroom.impl.configureroom
import androidx.annotation.DrawableRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import io.element.android.libraries.designsystem.icons.CompoundDrawables
import io.element.android.features.createroom.impl.R
import io.element.android.libraries.designsystem.icons.CompoundDrawables
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/di/CreateRoomComponent.kt

@ -26,7 +26,6 @@ import io.element.android.libraries.di.SingleIn @@ -26,7 +26,6 @@ import io.element.android.libraries.di.SingleIn
@SingleIn(CreateRoomScope::class)
@MergeSubcomponent(CreateRoomScope::class)
interface CreateRoomComponent : NodeFactoriesBindings {
@Subcomponent.Builder
interface Builder {
fun build(): CreateRoomComponent

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootNode.kt

@ -42,7 +42,6 @@ class CreateRoomRootNode @AssistedInject constructor( @@ -42,7 +42,6 @@ class CreateRoomRootNode @AssistedInject constructor(
private val analyticsService: AnalyticsService,
private val inviteFriendsUseCase: InviteFriendsUseCase,
) : Node(buildContext, plugins = plugins) {
interface Callback : Plugin {
fun onCreateNewRoom()
fun onStartChatSuccess(roomId: RoomId)

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootPresenter.kt

@ -41,7 +41,6 @@ class CreateRoomRootPresenter @Inject constructor( @@ -41,7 +41,6 @@ class CreateRoomRootPresenter @Inject constructor(
private val startDMAction: StartDMAction,
private val buildMeta: BuildMeta,
) : Presenter<CreateRoomRootState> {
private val presenter = presenterFactory.create(
UserListPresenterArgs(
selectionMode = SelectionMode.Single,

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootStateProvider.kt

@ -19,7 +19,6 @@ package io.element.android.features.createroom.impl.root @@ -19,7 +19,6 @@ package io.element.android.features.createroom.impl.root
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.features.createroom.impl.userlist.aUserListState
import io.element.android.libraries.architecture.AsyncAction
import io.element.android.libraries.designsystem.theme.components.SearchBarResultState
import io.element.android.libraries.matrix.ui.components.aMatrixUser
import io.element.android.libraries.usersearch.api.UserSearchResult

2
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootView.kt

@ -106,7 +106,7 @@ fun CreateRoomRootView( @@ -106,7 +106,7 @@ fun CreateRoomRootView(
onRetry = {
state.userListState.selectedUsers.firstOrNull()
?.let { state.eventSink(CreateRoomRootEvents.StartDM(it)) }
// Cancel start DM if there is no more selected user (should not happen)
// Cancel start DM if there is no more selected user (should not happen)
?: state.eventSink(CreateRoomRootEvents.CancelStartDM)
},
onErrorDismiss = { state.eventSink(CreateRoomRootEvents.CancelStartDM) },

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/userlist/DefaultUserListPresenter.kt

@ -42,7 +42,6 @@ class DefaultUserListPresenter @AssistedInject constructor( @@ -42,7 +42,6 @@ class DefaultUserListPresenter @AssistedInject constructor(
@Assisted val userRepository: UserRepository,
@Assisted val userListDataStore: UserListDataStore,
) : UserListPresenter {
@AssistedFactory
@ContributesBinding(SessionScope::class)
interface DefaultUserListFactory : UserListPresenter.Factory {

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/userlist/UserListDataStore.kt

@ -22,7 +22,6 @@ import kotlinx.coroutines.flow.MutableStateFlow @@ -22,7 +22,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
import javax.inject.Inject
class UserListDataStore @Inject constructor() {
private val selectedUsers: MutableStateFlow<List<MatrixUser>> = MutableStateFlow(emptyList())
fun selectUser(user: MatrixUser) {

1
features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/userlist/UserListPresenter.kt

@ -20,7 +20,6 @@ import io.element.android.libraries.architecture.Presenter @@ -20,7 +20,6 @@ import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.usersearch.api.UserRepository
interface UserListPresenter : Presenter<UserListState> {
interface Factory {
fun create(
args: UserListPresenterArgs,

1
features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/DefaultStartDMActionTests.kt

@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest @@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
class DefaultStartDMActionTests {
@Test
fun `when dm is found, assert state is updated with given room id`() = runTest {
val matrixClient = FakeMatrixClient().apply {

2
features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/addpeople/AddPeoplePresenterTests.kt

@ -31,7 +31,6 @@ import org.junit.Rule @@ -31,7 +31,6 @@ import org.junit.Rule
import org.junit.Test
class AddPeoplePresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()
@ -57,4 +56,3 @@ class AddPeoplePresenterTests { @@ -57,4 +56,3 @@ class AddPeoplePresenterTests {
}
}
}

2
features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/configureroom/ConfigureRoomPresenterTests.kt

@ -62,7 +62,6 @@ private const val AN_URI_FROM_GALLERY = "content://uri_from_gallery" @@ -62,7 +62,6 @@ private const val AN_URI_FROM_GALLERY = "content://uri_from_gallery"
@RunWith(RobolectricTestRunner::class)
class ConfigureRoomPresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()
@ -316,4 +315,3 @@ class ConfigureRoomPresenterTests { @@ -316,4 +315,3 @@ class ConfigureRoomPresenterTests {
}
}
}

2
features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/root/CreateRoomRootPresenterTests.kt

@ -38,7 +38,6 @@ import org.junit.Rule @@ -38,7 +38,6 @@ import org.junit.Rule
import org.junit.Test
class CreateRoomRootPresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()
@ -80,7 +79,6 @@ class CreateRoomRootPresenterTests { @@ -80,7 +79,6 @@ class CreateRoomRootPresenterTests {
awaitItem().also { state ->
assertThat(state.startDmAction).isEqualTo(startDMSuccessResult)
}
}
}

1
features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/userlist/DefaultUserListPresenterTests.kt

@ -33,7 +33,6 @@ import org.junit.Rule @@ -33,7 +33,6 @@ import org.junit.Rule
import org.junit.Test
class DefaultUserListPresenterTests {
@get:Rule
val warmUpRule = WarmUpRule()

1
features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/userlist/FakeUserListPresenter.kt

@ -19,7 +19,6 @@ package io.element.android.features.createroom.impl.userlist @@ -19,7 +19,6 @@ package io.element.android.features.createroom.impl.userlist
import androidx.compose.runtime.Composable
class FakeUserListPresenter : UserListPresenter {
private var state = aUserListState()
fun givenState(state: UserListState) {

1
features/createroom/impl/src/test/kotlin/io/element/android/features/createroom/impl/userlist/FakeUserListPresenterFactory.kt

@ -21,7 +21,6 @@ import io.element.android.libraries.usersearch.api.UserRepository @@ -21,7 +21,6 @@ import io.element.android.libraries.usersearch.api.UserRepository
class FakeUserListPresenterFactory(
private val fakeUserListPresenter: FakeUserListPresenter = FakeUserListPresenter()
) : UserListPresenter.Factory {
override fun create(
args: UserListPresenterArgs,
userRepository: UserRepository,

1
features/createroom/test/src/main/kotlin/io/element/android/features/createroom/test/FakeStartDMAction.kt

@ -25,7 +25,6 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID @@ -25,7 +25,6 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID
import kotlinx.coroutines.delay
class FakeStartDMAction : StartDMAction {
private var executeResult: AsyncAction<RoomId> = AsyncAction.Success(A_ROOM_ID)
fun givenExecuteResult(result: AsyncAction<RoomId>) {

1
features/ftue/api/src/main/kotlin/io/element/android/features/ftue/api/FtueEntryPoint.kt

@ -22,7 +22,6 @@ import com.bumble.appyx.core.plugin.Plugin @@ -22,7 +22,6 @@ import com.bumble.appyx.core.plugin.Plugin
import io.element.android.libraries.architecture.FeatureEntryPoint
interface FtueEntryPoint : FeatureEntryPoint {
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
interface NodeBuilder {

2
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/DefaultFtueEntryPoint.kt

@ -27,12 +27,10 @@ import javax.inject.Inject @@ -27,12 +27,10 @@ import javax.inject.Inject
@ContributesBinding(AppScope::class)
class DefaultFtueEntryPoint @Inject constructor() : FtueEntryPoint {
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): FtueEntryPoint.NodeBuilder {
val plugins = ArrayList<Plugin>()
return object : FtueEntryPoint.NodeBuilder {
override fun callback(callback: FtueEntryPoint.Callback): FtueEntryPoint.NodeBuilder {
plugins += callback
return this

1
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/FtueFlowNode.kt

@ -70,7 +70,6 @@ class FtueFlowNode @AssistedInject constructor( @@ -70,7 +70,6 @@ class FtueFlowNode @AssistedInject constructor(
buildContext = buildContext,
plugins = plugins,
) {
sealed interface NavTarget : Parcelable {
@Parcelize
data object Placeholder : NavTarget

1
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/migration/MigrationScreenNode.kt

@ -32,7 +32,6 @@ class MigrationScreenNode @AssistedInject constructor( @@ -32,7 +32,6 @@ class MigrationScreenNode @AssistedInject constructor(
@Assisted plugins: List<Plugin>,
private val presenter: MigrationScreenPresenter,
) : Node(buildContext, plugins = plugins) {
interface Callback : Plugin {
fun onMigrationFinished()
}

3
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/migration/MigrationScreenView.kt

@ -50,5 +50,6 @@ fun MigrationScreenView( @@ -50,5 +50,6 @@ fun MigrationScreenView(
internal fun MigrationViewPreview() = ElementPreview {
MigrationScreenView(
migrationState = MigrationScreenState(isMigrating = true),
onMigrationFinished = {})
onMigrationFinished = {}
)
}

2
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/migration/SharedPrefsMigrationScreenStore.kt

@ -29,7 +29,6 @@ import javax.inject.Inject @@ -29,7 +29,6 @@ import javax.inject.Inject
class SharedPrefsMigrationScreenStore @Inject constructor(
@DefaultPreferences private val sharedPreferences: SharedPreferences,
) : MigrationScreenStore {
override fun isMigrationScreenNeeded(sessionId: SessionId): Boolean {
return sharedPreferences.getBoolean(sessionId.toKey(), false).not()
}
@ -58,4 +57,3 @@ class SharedPrefsMigrationScreenStore @Inject constructor( @@ -58,4 +57,3 @@ class SharedPrefsMigrationScreenStore @Inject constructor(
private const val IS_MIGRATION_SCREEN_SHOWN_PREFIX = "is_migration_screen_shown_"
}
}

1
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/notifications/NotificationsOptInNode.kt

@ -34,7 +34,6 @@ class NotificationsOptInNode @AssistedInject constructor( @@ -34,7 +34,6 @@ class NotificationsOptInNode @AssistedInject constructor(
@Assisted plugins: List<Plugin>,
presenterFactory: NotificationsOptInPresenter.Factory,
) : Node(buildContext, plugins = plugins) {
interface Callback : NodeInputs {
fun onNotificationsOptInFinished()
}

5
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/notifications/NotificationsOptInPresenter.kt

@ -40,7 +40,6 @@ class NotificationsOptInPresenter @AssistedInject constructor( @@ -40,7 +40,6 @@ class NotificationsOptInPresenter @AssistedInject constructor(
private val permissionStateProvider: PermissionStateProvider,
private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider,
) : Presenter<NotificationsOptInState> {
@AssistedFactory
interface Factory {
fun create(callback: NotificationsOptInNode.Callback): NotificationsOptInPresenter
@ -77,8 +76,8 @@ class NotificationsOptInPresenter @AssistedInject constructor( @@ -77,8 +76,8 @@ class NotificationsOptInPresenter @AssistedInject constructor(
}
LaunchedEffect(notificationsPermissionsState) {
if (notificationsPermissionsState.permissionGranted
|| notificationsPermissionsState.permissionAlreadyDenied) {
if (notificationsPermissionsState.permissionGranted ||
notificationsPermissionsState.permissionAlreadyDenied) {
callback.onNotificationsOptInFinished()
}
}

37
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/state/DefaultFtueState.kt

@ -40,7 +40,7 @@ import javax.inject.Inject @@ -40,7 +40,7 @@ import javax.inject.Inject
@ContributesBinding(SessionScope::class)
class DefaultFtueState @Inject constructor(
private val sdkVersionProvider: BuildVersionSdkIntProvider,
private val coroutineScope: CoroutineScope,
coroutineScope: CoroutineScope,
private val analyticsService: AnalyticsService,
private val welcomeScreenState: WelcomeScreenState,
private val migrationScreenStore: MigrationScreenStore,
@ -48,7 +48,6 @@ class DefaultFtueState @Inject constructor( @@ -48,7 +48,6 @@ class DefaultFtueState @Inject constructor(
private val lockScreenService: LockScreenService,
private val matrixClient: MatrixClient,
) : FtueState {
override val shouldDisplayFlow = MutableStateFlow(isAnyStepIncomplete())
override suspend fun reset() {
@ -68,21 +67,31 @@ class DefaultFtueState @Inject constructor( @@ -68,21 +67,31 @@ class DefaultFtueState @Inject constructor(
fun getNextStep(currentStep: FtueStep? = null): FtueStep? =
when (currentStep) {
null -> if (shouldDisplayMigrationScreen()) FtueStep.MigrationScreen else getNextStep(
null -> if (shouldDisplayMigrationScreen()) {
FtueStep.MigrationScreen
)
FtueStep.MigrationScreen -> if (shouldDisplayWelcomeScreen()) FtueStep.WelcomeScreen else getNextStep(
} else {
getNextStep(FtueStep.MigrationScreen)
}
FtueStep.MigrationScreen -> if (shouldDisplayWelcomeScreen()) {
FtueStep.WelcomeScreen
)
FtueStep.WelcomeScreen -> if (shouldAskNotificationPermissions()) FtueStep.NotificationsOptIn else getNextStep(
} else {
getNextStep(FtueStep.WelcomeScreen)
}
FtueStep.WelcomeScreen -> if (shouldAskNotificationPermissions()) {
FtueStep.NotificationsOptIn
)
FtueStep.NotificationsOptIn -> if (shouldDisplayLockscreenSetup()) FtueStep.LockscreenSetup else getNextStep(
} else {
getNextStep(FtueStep.NotificationsOptIn)
}
FtueStep.NotificationsOptIn -> if (shouldDisplayLockscreenSetup()) {
FtueStep.LockscreenSetup
)
FtueStep.LockscreenSetup -> if (needsAnalyticsOptIn()) FtueStep.AnalyticsOptIn else getNextStep(
} else {
getNextStep(FtueStep.LockscreenSetup)
}
FtueStep.LockscreenSetup -> if (needsAnalyticsOptIn()) {
FtueStep.AnalyticsOptIn
)
} else {
getNextStep(FtueStep.AnalyticsOptIn)
}
FtueStep.AnalyticsOptIn -> null
}
@ -115,7 +124,9 @@ class DefaultFtueState @Inject constructor( @@ -115,7 +124,9 @@ class DefaultFtueState @Inject constructor(
val isPermissionDenied = runBlocking { permissionStateProvider.isPermissionDenied(permission).first() }
val isPermissionGranted = permissionStateProvider.isPermissionGranted(permission)
!isPermissionGranted && !isPermissionDenied
} else false
} else {
false
}
}
private fun shouldDisplayLockscreenSetup(): Boolean {

2
features/ftue/impl/src/main/kotlin/io/element/android/features/ftue/impl/welcome/WelcomeNode.kt

@ -33,7 +33,6 @@ class WelcomeNode @AssistedInject constructor( @@ -33,7 +33,6 @@ class WelcomeNode @AssistedInject constructor(
@Assisted plugins: List<Plugin>,
private val buildMeta: BuildMeta,
) : Node(buildContext, plugins = plugins) {
interface Callback : Plugin {
fun onContinueClicked()
}
@ -50,5 +49,4 @@ class WelcomeNode @AssistedInject constructor( @@ -50,5 +49,4 @@ class WelcomeNode @AssistedInject constructor(
modifier = modifier
)
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save