mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Clear cache on changing the threads FF (#4581)
* clear cache on changing the threads FF # Conflicts: # PreviewTests/Sources/__Snapshots__/PreviewTests/labsScreen.iPad-pseudo-0.png # PreviewTests/Sources/__Snapshots__/PreviewTests/labsScreen.iPhone-16-pseudo-0.png * fix tests
This commit is contained in:
@@ -293,6 +293,7 @@
|
|||||||
"common_settings" = "Settings";
|
"common_settings" = "Settings";
|
||||||
"common_share_space" = "Share space";
|
"common_share_space" = "Share space";
|
||||||
"common_shared_location" = "Shared location";
|
"common_shared_location" = "Shared location";
|
||||||
|
"common_shared_space" = "Shared space";
|
||||||
"common_signing_out" = "Signing out";
|
"common_signing_out" = "Signing out";
|
||||||
"common_something_went_wrong" = "Something went wrong";
|
"common_something_went_wrong" = "Something went wrong";
|
||||||
"common_something_went_wrong_message" = "We encountered an issue. Please try again.";
|
"common_something_went_wrong_message" = "We encountered an issue. Please try again.";
|
||||||
@@ -573,6 +574,7 @@
|
|||||||
"screen_knock_requests_list_empty_state_title" = "No pending request to join";
|
"screen_knock_requests_list_empty_state_title" = "No pending request to join";
|
||||||
"screen_knock_requests_list_initial_loading_title" = "Loading requests to join…";
|
"screen_knock_requests_list_initial_loading_title" = "Loading requests to join…";
|
||||||
"screen_labs_enable_threads" = "Enable thread replies";
|
"screen_labs_enable_threads" = "Enable thread replies";
|
||||||
|
"screen_labs_enable_threads_description" = "The app will restart to apply this change.";
|
||||||
"screen_labs_header_description" = "Try out our latest ideas in development. These features are not finalised; they may be unstable, may change.";
|
"screen_labs_header_description" = "Try out our latest ideas in development. These features are not finalised; they may be unstable, may change.";
|
||||||
"screen_labs_header_title" = "Feeling experimental?";
|
"screen_labs_header_title" = "Feeling experimental?";
|
||||||
"screen_labs_title" = "Labs";
|
"screen_labs_title" = "Labs";
|
||||||
@@ -834,14 +836,14 @@
|
|||||||
"screen_invites_decline_direct_chat_title" = "Decline chat";
|
"screen_invites_decline_direct_chat_title" = "Decline chat";
|
||||||
"screen_invites_empty_list" = "No Invites";
|
"screen_invites_empty_list" = "No Invites";
|
||||||
"screen_invites_invited_you" = "%1$@ (%2$@) invited you";
|
"screen_invites_invited_you" = "%1$@ (%2$@) invited you";
|
||||||
"screen_join_room_ban_by_message" = "You were banned from this room by %1$@.";
|
"screen_join_room_ban_by_message" = "You were banned by %1$@.";
|
||||||
"screen_join_room_ban_message" = "You were banned from this room";
|
"screen_join_room_ban_message" = "You were banned";
|
||||||
"screen_join_room_ban_reason" = "Reason: %1$@.";
|
"screen_join_room_ban_reason" = "Reason: %1$@.";
|
||||||
"screen_join_room_fail_message" = "Joining the room failed.";
|
"screen_join_room_fail_message" = "Joining failed";
|
||||||
"screen_join_room_fail_reason" = "This room is either invite-only or there might be restrictions to access at space level.";
|
"screen_join_room_fail_reason" = "This room is either invite-only or there might be restrictions to access at space level.";
|
||||||
"screen_join_room_forget_action" = "Forget this room";
|
"screen_join_room_forget_action" = "Forget";
|
||||||
"screen_join_room_invite_required_message" = "You need an invite in order to join this room";
|
"screen_join_room_invite_required_message" = "You need an invite in order to join";
|
||||||
"screen_join_room_join_action" = "Join room";
|
"screen_join_room_join_action" = "Join";
|
||||||
"screen_join_room_join_restricted_message" = "You may need to be invited or be a member of a space in order to join.";
|
"screen_join_room_join_restricted_message" = "You may need to be invited or be a member of a space in order to join.";
|
||||||
"screen_join_room_knock_action" = "Send request to join";
|
"screen_join_room_knock_action" = "Send request to join";
|
||||||
"screen_join_room_space_not_supported_description" = "%1$@ does not support spaces yet. You can access spaces on web.";
|
"screen_join_room_space_not_supported_description" = "%1$@ does not support spaces yet. You can access spaces on web.";
|
||||||
|
|||||||
@@ -117,6 +117,15 @@ class SettingsFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
private func presentLabs() {
|
private func presentLabs() {
|
||||||
let coordinator = LabsScreenCoordinator(parameters: .init(appSettings: flowParameters.appSettings))
|
let coordinator = LabsScreenCoordinator(parameters: .init(appSettings: flowParameters.appSettings))
|
||||||
|
coordinator.actions
|
||||||
|
.sink { [weak self] action in
|
||||||
|
switch action {
|
||||||
|
case .clearCache:
|
||||||
|
self?.actionsSubject.send(.clearCache)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
navigationStackCoordinator.push(coordinator)
|
navigationStackCoordinator.push(coordinator)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -662,6 +662,8 @@ internal enum L10n {
|
|||||||
internal static var commonShareSpace: String { return L10n.tr("Localizable", "common_share_space") }
|
internal static var commonShareSpace: String { return L10n.tr("Localizable", "common_share_space") }
|
||||||
/// Shared location
|
/// Shared location
|
||||||
internal static var commonSharedLocation: String { return L10n.tr("Localizable", "common_shared_location") }
|
internal static var commonSharedLocation: String { return L10n.tr("Localizable", "common_shared_location") }
|
||||||
|
/// Shared space
|
||||||
|
internal static var commonSharedSpace: String { return L10n.tr("Localizable", "common_shared_space") }
|
||||||
/// Signing out
|
/// Signing out
|
||||||
internal static var commonSigningOut: String { return L10n.tr("Localizable", "common_signing_out") }
|
internal static var commonSigningOut: String { return L10n.tr("Localizable", "common_signing_out") }
|
||||||
/// Something went wrong
|
/// Something went wrong
|
||||||
@@ -1682,11 +1684,11 @@ internal enum L10n {
|
|||||||
internal static func screenInvitesInvitedYou(_ p1: Any, _ p2: Any) -> String {
|
internal static func screenInvitesInvitedYou(_ p1: Any, _ p2: Any) -> String {
|
||||||
return L10n.tr("Localizable", "screen_invites_invited_you", String(describing: p1), String(describing: p2))
|
return L10n.tr("Localizable", "screen_invites_invited_you", String(describing: p1), String(describing: p2))
|
||||||
}
|
}
|
||||||
/// You were banned from this room by %1$@.
|
/// You were banned by %1$@.
|
||||||
internal static func screenJoinRoomBanByMessage(_ p1: Any) -> String {
|
internal static func screenJoinRoomBanByMessage(_ p1: Any) -> String {
|
||||||
return L10n.tr("Localizable", "screen_join_room_ban_by_message", String(describing: p1))
|
return L10n.tr("Localizable", "screen_join_room_ban_by_message", String(describing: p1))
|
||||||
}
|
}
|
||||||
/// You were banned from this room
|
/// You were banned
|
||||||
internal static var screenJoinRoomBanMessage: String { return L10n.tr("Localizable", "screen_join_room_ban_message") }
|
internal static var screenJoinRoomBanMessage: String { return L10n.tr("Localizable", "screen_join_room_ban_message") }
|
||||||
/// Reason: %1$@.
|
/// Reason: %1$@.
|
||||||
internal static func screenJoinRoomBanReason(_ p1: Any) -> String {
|
internal static func screenJoinRoomBanReason(_ p1: Any) -> String {
|
||||||
@@ -1710,17 +1712,17 @@ internal enum L10n {
|
|||||||
internal static var screenJoinRoomDeclineAndBlockAlertTitle: String { return L10n.tr("Localizable", "screen_join_room_decline_and_block_alert_title") }
|
internal static var screenJoinRoomDeclineAndBlockAlertTitle: String { return L10n.tr("Localizable", "screen_join_room_decline_and_block_alert_title") }
|
||||||
/// Decline and block
|
/// Decline and block
|
||||||
internal static var screenJoinRoomDeclineAndBlockButtonTitle: String { return L10n.tr("Localizable", "screen_join_room_decline_and_block_button_title") }
|
internal static var screenJoinRoomDeclineAndBlockButtonTitle: String { return L10n.tr("Localizable", "screen_join_room_decline_and_block_button_title") }
|
||||||
/// Joining the room failed.
|
/// Joining failed
|
||||||
internal static var screenJoinRoomFailMessage: String { return L10n.tr("Localizable", "screen_join_room_fail_message") }
|
internal static var screenJoinRoomFailMessage: String { return L10n.tr("Localizable", "screen_join_room_fail_message") }
|
||||||
/// This room is either invite-only or there might be restrictions to access at space level.
|
/// This room is either invite-only or there might be restrictions to access at space level.
|
||||||
internal static var screenJoinRoomFailReason: String { return L10n.tr("Localizable", "screen_join_room_fail_reason") }
|
internal static var screenJoinRoomFailReason: String { return L10n.tr("Localizable", "screen_join_room_fail_reason") }
|
||||||
/// Forget this room
|
/// Forget
|
||||||
internal static var screenJoinRoomForgetAction: String { return L10n.tr("Localizable", "screen_join_room_forget_action") }
|
internal static var screenJoinRoomForgetAction: String { return L10n.tr("Localizable", "screen_join_room_forget_action") }
|
||||||
/// You need an invite in order to join this room
|
/// You need an invite in order to join
|
||||||
internal static var screenJoinRoomInviteRequiredMessage: String { return L10n.tr("Localizable", "screen_join_room_invite_required_message") }
|
internal static var screenJoinRoomInviteRequiredMessage: String { return L10n.tr("Localizable", "screen_join_room_invite_required_message") }
|
||||||
/// Invited by
|
/// Invited by
|
||||||
internal static var screenJoinRoomInvitedBy: String { return L10n.tr("Localizable", "screen_join_room_invited_by") }
|
internal static var screenJoinRoomInvitedBy: String { return L10n.tr("Localizable", "screen_join_room_invited_by") }
|
||||||
/// Join room
|
/// Join
|
||||||
internal static var screenJoinRoomJoinAction: String { return L10n.tr("Localizable", "screen_join_room_join_action") }
|
internal static var screenJoinRoomJoinAction: String { return L10n.tr("Localizable", "screen_join_room_join_action") }
|
||||||
/// You may need to be invited or be a member of a space in order to join.
|
/// You may need to be invited or be a member of a space in order to join.
|
||||||
internal static var screenJoinRoomJoinRestrictedMessage: String { return L10n.tr("Localizable", "screen_join_room_join_restricted_message") }
|
internal static var screenJoinRoomJoinRestrictedMessage: String { return L10n.tr("Localizable", "screen_join_room_join_restricted_message") }
|
||||||
@@ -1826,6 +1828,8 @@ internal enum L10n {
|
|||||||
internal static var screenKnockRequestsListTitle: String { return L10n.tr("Localizable", "screen_knock_requests_list_title") }
|
internal static var screenKnockRequestsListTitle: String { return L10n.tr("Localizable", "screen_knock_requests_list_title") }
|
||||||
/// Enable thread replies
|
/// Enable thread replies
|
||||||
internal static var screenLabsEnableThreads: String { return L10n.tr("Localizable", "screen_labs_enable_threads") }
|
internal static var screenLabsEnableThreads: String { return L10n.tr("Localizable", "screen_labs_enable_threads") }
|
||||||
|
/// The app will restart to apply this change.
|
||||||
|
internal static var screenLabsEnableThreadsDescription: String { return L10n.tr("Localizable", "screen_labs_enable_threads_description") }
|
||||||
/// Try out our latest ideas in development. These features are not finalised; they may be unstable, may change.
|
/// Try out our latest ideas in development. These features are not finalised; they may be unstable, may change.
|
||||||
internal static var screenLabsHeaderDescription: String { return L10n.tr("Localizable", "screen_labs_header_description") }
|
internal static var screenLabsHeaderDescription: String { return L10n.tr("Localizable", "screen_labs_header_description") }
|
||||||
/// Feeling experimental?
|
/// Feeling experimental?
|
||||||
|
|||||||
@@ -14,14 +14,35 @@ struct LabsScreenCoordinatorParameters {
|
|||||||
let appSettings: AppSettings
|
let appSettings: AppSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum LabsScreenCoordinatorAction {
|
||||||
|
case clearCache
|
||||||
|
}
|
||||||
|
|
||||||
final class LabsScreenCoordinator: CoordinatorProtocol {
|
final class LabsScreenCoordinator: CoordinatorProtocol {
|
||||||
private let viewModel: LabsScreenViewModelProtocol
|
private let viewModel: LabsScreenViewModelProtocol
|
||||||
|
|
||||||
|
private let actionsSubject: PassthroughSubject<LabsScreenCoordinatorAction, Never> = .init()
|
||||||
|
var actions: AnyPublisher<LabsScreenCoordinatorAction, Never> {
|
||||||
|
actionsSubject.eraseToAnyPublisher()
|
||||||
|
}
|
||||||
|
|
||||||
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
init(parameters: LabsScreenCoordinatorParameters) {
|
init(parameters: LabsScreenCoordinatorParameters) {
|
||||||
viewModel = LabsScreenViewModel(labsOptions: parameters.appSettings)
|
viewModel = LabsScreenViewModel(labsOptions: parameters.appSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() { }
|
func start() {
|
||||||
|
viewModel
|
||||||
|
.actionsPublisher
|
||||||
|
.sink { [weak self] action in
|
||||||
|
switch action {
|
||||||
|
case .clearCache:
|
||||||
|
self?.actionsSubject.send(.clearCache)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
}
|
||||||
|
|
||||||
func toPresentable() -> AnyView {
|
func toPresentable() -> AnyView {
|
||||||
AnyView(LabsScreen(context: viewModel.context))
|
AnyView(LabsScreen(context: viewModel.context))
|
||||||
|
|||||||
@@ -7,9 +7,13 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum LabsScreenViewAction { }
|
enum LabsScreenViewAction {
|
||||||
|
case clearCache
|
||||||
|
}
|
||||||
|
|
||||||
enum LabsScreenViewModelAction { }
|
enum LabsScreenViewModelAction {
|
||||||
|
case clearCache
|
||||||
|
}
|
||||||
|
|
||||||
struct LabsScreenViewState: BindableState {
|
struct LabsScreenViewState: BindableState {
|
||||||
var bindings: LabsScreenViewStateBindings
|
var bindings: LabsScreenViewStateBindings
|
||||||
|
|||||||
@@ -22,4 +22,11 @@ class LabsScreenViewModel: LabsScreenViewModelType, LabsScreenViewModelProtocol
|
|||||||
|
|
||||||
super.init(initialViewState: state)
|
super.init(initialViewState: state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func process(viewAction: LabsScreenViewAction) {
|
||||||
|
switch viewAction {
|
||||||
|
case .clearCache:
|
||||||
|
actionsSubject.send(.clearCache)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ struct LabsScreen: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
header
|
header
|
||||||
settingsSection
|
threadsSection
|
||||||
}
|
}
|
||||||
.compoundList()
|
.compoundList()
|
||||||
.navigationTitle(L10n.screenLabsTitle)
|
.navigationTitle(L10n.screenLabsTitle)
|
||||||
@@ -39,16 +39,23 @@ struct LabsScreen: View {
|
|||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
.foregroundColor(.compound.textSecondary)
|
.foregroundColor(.compound.textSecondary)
|
||||||
}
|
}
|
||||||
|
.compoundListSectionHeader()
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var settingsSection: some View {
|
private var threadsSection: some View {
|
||||||
Section {
|
Section {
|
||||||
ListRow(label: .default(title: L10n.screenLabsEnableThreads,
|
ListRow(label: .default(title: L10n.screenLabsEnableThreads,
|
||||||
icon: \.threads),
|
icon: \.threads),
|
||||||
kind: .toggle($context.threadsEnabled))
|
kind: .toggle($context.threadsEnabled))
|
||||||
|
} footer: {
|
||||||
|
Text(L10n.screenLabsEnableThreadsDescription)
|
||||||
|
.compoundListSectionFooter()
|
||||||
|
}
|
||||||
|
.onChange(of: context.threadsEnabled) { _, _ in
|
||||||
|
context.send(viewAction: .clearCache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +63,7 @@ struct LabsScreen: View {
|
|||||||
// MARK: - Previews
|
// MARK: - Previews
|
||||||
|
|
||||||
struct LabsScreen_Previews: PreviewProvider, TestablePreview {
|
struct LabsScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static let viewModel = LabsScreenViewModel(labsOptions: ServiceLocator.shared.settings)
|
static let viewModel = LabsScreenViewModel(labsOptions: AppSettings())
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:f2170efb3086308662f9dca90475254c16123f856ff295c4fe9cadb308310dc6
|
oid sha256:96544b24f533f3295762a591b66632d8795bbe87258c8ea8cdd30cc2996dfdb7
|
||||||
size 109823
|
size 116014
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:1865e6f52775f4a98309bd7daf8cb15680a0f2adf445d1ed6eeacf405021b9dc
|
oid sha256:6356d8bdd6c5d68262702dd73731fff5958c1e93c54f0d0158874b200e5ff9d4
|
||||||
size 122231
|
size 130952
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:c9ff0be2476921e4c18a3ff885a00c8470b1d1b0005b48ac88832dc49a3f1a01
|
oid sha256:4ce215c7568042d010cc42185fda078f7352820fa13ce46b4c732d7fa281d260
|
||||||
size 65214
|
size 70341
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:92e459c69eda664e3c2bef2cdf8b592deb66b4e5258626f85d7c91417c3a55b6
|
oid sha256:f492183d661c74d61304a8c46a8e5640eb592aebec49340eac25af580415c3d4
|
||||||
size 90188
|
size 100989
|
||||||
|
|||||||
Reference in New Issue
Block a user