diff --git a/Packages/GodPackage/Sources/OnboardFeature/InviteFriend.swift b/Packages/GodPackage/Sources/OnboardFeature/InviteFriend.swift index fbbb7762..cc70ffdf 100644 --- a/Packages/GodPackage/Sources/OnboardFeature/InviteFriend.swift +++ b/Packages/GodPackage/Sources/OnboardFeature/InviteFriend.swift @@ -3,14 +3,14 @@ import AnalyticsClient import ComposableArchitecture import God import GodClient -import Styleguide -import SwiftUI import Lottie import ShareLinkBuilder +import Styleguide +import SwiftUI public struct InviteFriendLogic: Reducer { public init() {} - + public struct CompletionWithItems: Equatable { public let activityType: UIActivity.ActivityType? public let result: Bool @@ -19,8 +19,9 @@ public struct InviteFriendLogic: Reducer { public struct State: Equatable { var shareURL = URL(string: "https://godapp.jp")! var remainingInvitationCount: Int { - return invites.filter { !$0 }.count + invites.filter { !$0 }.count } + var invites = Array(repeating: false, count: 3) @BindingState var isPresented = false @PresentationState var alert: AlertState? @@ -38,11 +39,11 @@ public struct InviteFriendLogic: Reducer { case binding(BindingAction) case alert(PresentationAction) case delegate(Delegate) - + public enum Alert: Equatable { case confirmOkay } - + public enum Delegate: Equatable { case nextScreen } @@ -50,7 +51,7 @@ public struct InviteFriendLogic: Reducer { @Dependency(\.godClient) var godClient @Dependency(\.analytics) var analytics - + enum Cancel { case currentUser } @@ -72,7 +73,7 @@ public struct InviteFriendLogic: Reducer { case .onAppear: analytics.logScreen(screenName: "InviteFriend", of: self) return .none - + case .whyFriendsButtonTapped: state.alert = AlertState { TextState("To use God, you need friends from the same school 👥", bundle: .module) @@ -84,14 +85,14 @@ public struct InviteFriendLogic: Reducer { TextState("God is by invitation only; send invitations to 3 people and you will be specifically invited.", bundle: .module) } return .none - + case .inviteFriendButtonTapped where state.remainingInvitationCount == 0: return .send(.delegate(.nextScreen)) - + case .inviteFriendButtonTapped: state.isPresented = true return .none - + case let .currentUserResponse(.success(data)): guard let username = data.currentUser.username else { return .none } @@ -102,25 +103,25 @@ public struct InviteFriendLogic: Reducer { medium: .requiredInvite ) return .none - + case let .onCompletion(completion): state.isPresented = false guard completion.result, state.remainingInvitationCount > 0 else { return .none } - for i in 0.. UIActivityViewController { - return activityViewController - } - - public func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) { + activityViewController } + + public func updateUIViewController(_ uiViewController: UIActivityViewController, context: Context) {} } #Preview { @@ -37,10 +36,10 @@ public struct ActivityView: UIViewControllerRepresentable { .sheet(isPresented: .constant(true)) { ActivityView( activityItems: [ - "tomokisun" + "tomokisun", ], applicationActivities: nil - ) { activityType, result, _, error in + ) { activityType, _, _, _ in print(activityType) } .presentationDetents([.medium, .large])