diff --git a/Session/Open Groups/JoinOpenGroupVC.swift b/Session/Open Groups/JoinOpenGroupVC.swift index 5e0b94657..38a248521 100644 --- a/Session/Open Groups/JoinOpenGroupVC.swift +++ b/Session/Open Groups/JoinOpenGroupVC.swift @@ -129,7 +129,7 @@ final class JoinOpenGroupVC : BaseVC, UIPageViewControllerDataSource, UIPageView // A V2 open group URL will look like: + + + + // The host doesn't parse if no explicit scheme is provided if let url = URL(string: string), let host = url.host ?? given(string.split(separator: "/").first, { String($0) }) { - if let (room, server, publicKey) = OpenGroupManagerV2.parseV2OpenGroup(from: string) { + if let (room, server, publicKey) = OpenGroupManagerV2.parseV2OpenGroup(from: string), OpenGroupManagerV2.useV2OpenGroups { joinV2OpenGroup(room: room, server: server, publicKey: publicKey) } else { // Inputs that should work: @@ -242,8 +242,13 @@ private final class EnterURLVC : UIViewController, UIGestureRecognizerDelegate, nextButtonContainer.pin(.trailing, to: .trailing, of: nextButton, withInset: 80) nextButtonContainer.pin(.bottom, to: .bottom, of: nextButton) // Stack view - let stackView = UIStackView(arrangedSubviews: [ urlTextField, UIView.spacer(withHeight: Values.mediumSpacing), suggestionGridTitleLabel, - UIView.spacer(withHeight: Values.mediumSpacing), suggestionGrid, UIView.vStretchingSpacer(), nextButtonContainer ]) + let stackView: UIStackView + if OpenGroupManagerV2.useV2OpenGroups { + stackView = UIStackView(arrangedSubviews: [ urlTextField, UIView.spacer(withHeight: Values.mediumSpacing), suggestionGridTitleLabel, + UIView.spacer(withHeight: Values.mediumSpacing), suggestionGrid, UIView.vStretchingSpacer(), nextButtonContainer ]) + } else { + stackView = UIStackView(arrangedSubviews: [ urlTextField, UIView.vStretchingSpacer(), nextButtonContainer ]) + } stackView.axis = .vertical stackView.alignment = .fill stackView.layoutMargins = UIEdgeInsets(uniform: Values.largeSpacing) diff --git a/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift b/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift index 579d62ff3..f8cbbf3bd 100644 --- a/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift +++ b/SessionMessagingKit/Open Groups/V2/OpenGroupManagerV2.swift @@ -4,6 +4,8 @@ import PromiseKit public final class OpenGroupManagerV2 : NSObject { private var pollers: [String:OpenGroupPollerV2] = [:] private var isPolling = false + + public static var useV2OpenGroups = false // MARK: Initialization @objc public static let shared = OpenGroupManagerV2()