Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS-2533 Multiplayer | More info screen #1075

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Anytype.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@
2A80D0562ABAE17F00DB0513 /* EditorPageCoordinatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A80D0532ABAE17F00DB0513 /* EditorPageCoordinatorView.swift */; };
2A80D0572ABAE17F00DB0513 /* EditorPageCoordinatorViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A80D0542ABAE17F00DB0513 /* EditorPageCoordinatorViewModel.swift */; };
2A80D0622ABAFE9200DB0513 /* EditorNavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A80D0612ABAFE9200DB0513 /* EditorNavigationBarView.swift */; };
2A80F7682BB47569000B55C6 /* SpaceMoreInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A80F7672BB47569000B55C6 /* SpaceMoreInfoView.swift */; };
2A816AC72AD7DC1700975BCA /* ServerConfigirationStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A816AC62AD7DC1700975BCA /* ServerConfigirationStorage.swift */; };
2A816AC92AD7DFC700975BCA /* ServerConfigurationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A816AC82AD7DFC700975BCA /* ServerConfigurationView.swift */; };
2A816ACC2AD7E31F00975BCA /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A816ACB2AD7E31F00975BCA /* DocumentPicker.swift */; };
Expand Down Expand Up @@ -2350,6 +2351,7 @@
2A80D0532ABAE17F00DB0513 /* EditorPageCoordinatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditorPageCoordinatorView.swift; sourceTree = "<group>"; };
2A80D0542ABAE17F00DB0513 /* EditorPageCoordinatorViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditorPageCoordinatorViewModel.swift; sourceTree = "<group>"; };
2A80D0612ABAFE9200DB0513 /* EditorNavigationBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorNavigationBarView.swift; sourceTree = "<group>"; };
2A80F7672BB47569000B55C6 /* SpaceMoreInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpaceMoreInfoView.swift; sourceTree = "<group>"; };
2A816AC62AD7DC1700975BCA /* ServerConfigirationStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerConfigirationStorage.swift; sourceTree = "<group>"; };
2A816AC82AD7DFC700975BCA /* ServerConfigurationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerConfigurationView.swift; sourceTree = "<group>"; };
2A816ACB2AD7E31F00975BCA /* DocumentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPicker.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6138,6 +6140,14 @@
path = EditorSetFlow;
sourceTree = "<group>";
};
2A80F7662BB47557000B55C6 /* SpaceMoreInfo */ = {
isa = PBXGroup;
children = (
2A80F7672BB47569000B55C6 /* SpaceMoreInfoView.swift */,
);
path = SpaceMoreInfo;
sourceTree = "<group>";
};
2A816AC52AD7DC0D00975BCA /* ServerConfigirationStorage */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6488,6 +6498,7 @@
2ABAF2B62938E53A003C4730 /* Modules */ = {
isa = PBXGroup;
children = (
2A80F7662BB47557000B55C6 /* SpaceMoreInfo */,
2ABAF2B72938E548003C4730 /* CodeLanguage */,
2A28722F2B4D8B35007B3D59 /* GalleryInstallationPreview */,
2AD276402B6D22A900112215 /* GallerySpaceSelection */,
Expand Down Expand Up @@ -12211,6 +12222,7 @@
2A673C0B29B0B26D00E3D672 /* SettingsCoordinator.swift in Sources */,
2ADD14EF2AE2B9A50060BC33 /* HomeCreateObjectTip.swift in Sources */,
2ABF214329B204BE00E872D9 /* UIUserInterfaceStyle+Settings.swift in Sources */,
2A80F7682BB47569000B55C6 /* SpaceMoreInfoView.swift in Sources */,
1247BC6427FD9637005F2DB4 /* SearchNewRelationModuleOutput.swift in Sources */,
03475B6F2306031D00F8FCE7 /* ViewExtension.swift in Sources */,
2A2B331E2A7AA7A6004BD906 /* CreateWidgetCoordinatorView.swift in Sources */,
Expand Down
12 changes: 12 additions & 0 deletions Anytype/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,8 @@ internal enum Loc {
internal static let manageSpaces = Loc.tr("Localizable", "SpaceShare.ManageSpaces", fallback: "Manage Spaces")
/// Members
internal static let members = Loc.tr("Localizable", "SpaceShare.Members", fallback: "Members")
/// More info
internal static let moreInfo = Loc.tr("Localizable", "SpaceShare.MoreInfo", fallback: "More info")
/// Sharing
internal static let title = Loc.tr("Localizable", "SpaceShare.Title", fallback: "Sharing")
/// %@ (you)
Expand All @@ -2282,6 +2284,16 @@ internal enum Loc {
/// Delete link
internal static let title = Loc.tr("Localizable", "SpaceShare.DeleteSharingLink.Title", fallback: "Delete link")
}
internal enum HowToShare {
/// Please provide the link to the person you'd like to collaborate with.
internal static let step1 = Loc.tr("Localizable", "SpaceShare.HowToShare.Step1", fallback: "Please provide the link to the person you'd like to collaborate with.")
/// By clicking the link, a person requests to join the space.
internal static let step2 = Loc.tr("Localizable", "SpaceShare.HowToShare.Step2", fallback: "By clicking the link, a person requests to join the space.")
/// After approving the request, you can choose the access rights for that person.
internal static let step3 = Loc.tr("Localizable", "SpaceShare.HowToShare.Step3", fallback: "After approving the request, you can choose the access rights for that person.")
/// How to share a space?
internal static let title = Loc.tr("Localizable", "SpaceShare.HowToShare.Title", fallback: "How to share a space?")
}
internal enum Invite {
/// Share this invite link so that others can join your Space. Once they click your link and request access, you can set their access rights.
internal static let description = Loc.tr("Localizable", "SpaceShare.Invite.Description", fallback: "Share this invite link so that others can join your Space. Once they click your link and request access, you can set their access rights.")
Expand Down
5 changes: 5 additions & 0 deletions Anytype/Resources/Strings/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,11 @@
"SpaceShare.StopSharing.Toast" = "The space is no longer shared";
"SpaceShare.QR.Title" = "QR code for joing a Space";
"SpaceShare.QR.Button" = "Show QR code";
"SpaceShare.MoreInfo" = "More info";
"SpaceShare.HowToShare.Title" = "How to share a space?";
"SpaceShare.HowToShare.Step1" = "Please provide the link to the person you'd like to collaborate with.";
"SpaceShare.HowToShare.Step2" = "By clicking the link, a person requests to join the space.";
"SpaceShare.HowToShare.Step3" = "After approving the request, you can choose the access rights for that person.";

// MARK: - Permission notification
"PermissionChangeNotification.Text" = "Your access rights were changed to **%@** in the **%@** space.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ struct SpaceShareCoordinatorView: View {
@StateObject private var model = SpaceShareCoordinatorViewModel()

var body: some View {
SpaceShareView()
SpaceShareView {
model.onMoreInfoSelected()
}
.sheet(isPresented: $model.showMoreInfo) {
SpaceMoreInfoView()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import SwiftUI
@MainActor
final class SpaceShareCoordinatorViewModel: ObservableObject {

init() {
@Published var showMoreInfo = false

init() {}

func onMoreInfoSelected() {
showMoreInfo = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Foundation
import SwiftUI

struct SpaceMoreInfoView: View {

private let steps = [
Loc.SpaceShare.HowToShare.step1,
Loc.SpaceShare.HowToShare.step2,
Loc.SpaceShare.HowToShare.step3
]

var body: some View {
VStack(spacing: 0) {
DragIndicator()
TitleView(title: Loc.SpaceShare.HowToShare.title)
VStack(spacing: 8) {
ForEach(steps.indices, id: \.self) { index in
HStack(alignment: .top, spacing: 8) {
AnytypeText("\(index + 1).", style: .bodyRegular, color: .Text.primary)
AnytypeText(steps[index], style: .bodyRegular, color: .Text.primary)
Spacer()
}
}
}
.padding(.vertical, 8)
Spacer()
}
.padding(.horizontal, 20)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import SwiftUI

struct SpaceShareView: View {

@StateObject private var model = SpaceShareViewModel()
@StateObject private var model: SpaceShareViewModel

init(onMoreInfo: @escaping () -> Void) {
self._model = StateObject(wrappedValue: SpaceShareViewModel(onMoreInfo: onMoreInfo))
}

var body: some View {
VStack(spacing: 0) {
Expand Down Expand Up @@ -75,6 +79,9 @@ struct SpaceShareView: View {

private var rightNavigationButton: some View {
Menu {
Button(Loc.SpaceShare.moreInfo) {
model.onMoreInfoTap()
}
Button(Loc.SpaceShare.StopSharing.action, role: .destructive) {
model.onStopSharing()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final class SpaceShareViewModel: ObservableObject {
@Injected(\.deepLinkParser)
private var deppLinkParser: DeepLinkParserProtocol

private var onMoreInfo: () -> Void
private var participants: [Participant] = []

var accountSpaceId: String { activeWorkspaceStorage.workspaceInfo.accountSpaceId }
Expand All @@ -35,7 +36,9 @@ final class SpaceShareViewModel: ObservableObject {
@Published var showDeleteLinkAlert = false
@Published var showStopSharingAlert = false

nonisolated init() {}
nonisolated init(onMoreInfo: @escaping () -> Void) {
self.onMoreInfo = onMoreInfo
}

func startParticipantsTask() async {
for await items in activeSpaceParticipantStorage.participantsPublisher.values {
Expand Down Expand Up @@ -84,6 +87,10 @@ final class SpaceShareViewModel: ObservableObject {
qrCodeInviteLink = inviteLink
}

func onMoreInfoTap() {
onMoreInfo()
}

// MARK: - Private

private func updateParticipant(items: [Participant]) {
Expand Down
Loading