diff --git a/Source/App/AppConfiguration.swift b/Source/App/AppConfiguration.swift index 520639ab8d..c34af0a090 100644 --- a/Source/App/AppConfiguration.swift +++ b/Source/App/AppConfiguration.swift @@ -51,6 +51,10 @@ class AppConfiguration: NSObject, NSCoding, Identifiable, @unchecked Sendable { } } + var isUsingTestingNetwork: Bool { + network?.name == Environment.Networks.test.name + } + private var secretDidChange = false var secret: Secret { didSet { diff --git a/Source/Controller/RoomListController.swift b/Source/Controller/RoomListController.swift index b787df6c77..df14a90bd1 100644 --- a/Source/Controller/RoomListController.swift +++ b/Source/Controller/RoomListController.swift @@ -130,12 +130,20 @@ import Secrets func joinPlanetaryRoom() { loadingMessage = Localized.loading.text Task { - guard let token = Keys.shared.get(key: .planetaryRoomToken) else { + let key: Key + let host: String + if AppConfiguration.current?.isUsingTestingNetwork == true { + key = .lorentzRoomToken + host = "test-room.lorentz.is" + } else { + key = .planetaryRoomToken + host = "planetary.name" + } + guard let token = Keys.shared.get(key: key) else { loadingMessage = nil return } do { - let host = "planetary.name" try await RoomInvitationRedeemer.redeem(token: token, at: host, bot: bot) refresh() alertMessageTitle = Localized.success.text diff --git a/Source/UI/RoomListView.swift b/Source/UI/RoomListView.swift index 2b6b0faab5..bcda187fbe 100644 --- a/Source/UI/RoomListView.swift +++ b/Source/UI/RoomListView.swift @@ -141,11 +141,11 @@ struct RoomListView: View where ViewModel: RoomListViewModel { if viewModel.showJoinPlanetaryRoomButton { Section { - Button(Localized.Onboarding.joinPlanetarySystem.text) { + Button(Localized.ManageRelays.joinPlanetaryRoom.text) { viewModel.joinPlanetaryRoom() } .foregroundColor(.primaryAction) - Text(Localized.Onboarding.joinPlanetarySystemDescription.text) + Text(Localized.ManageRelays.joinPlanetaryRoomDescription.text) .foregroundColor(.secondaryText) .font(.subheadline) .padding(.top, 4)