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

Share #736

Merged
merged 2 commits into from
Oct 11, 2023
Merged

Share #736

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
17 changes: 8 additions & 9 deletions Packages/GodPackage/Sources/GodFeature/ShareTheApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public struct ShareTheAppLogic: Reducer {

public enum Action: Equatable {
case onTask
case shareTheAppButtonTapped
case currentUserResponse(TaskResult<God.CurrentUserQuery.Data>)
}

Expand All @@ -34,18 +33,14 @@ public struct ShareTheAppLogic: Reducer {
await send(.currentUserResponse(.failure(error)))
}

case .shareTheAppButtonTapped:
return .run { _ in
// await openURL(url)
}
case let .currentUserResponse(.success(data)):
guard
let schoolName = data.currentUser.school?.name,
let username = data.currentUser.username
else { return .none }
let text = """
\(schoolName)向けの新しいアプリダウンロードしてみて!
https://godapp.jp/invite/\(username)?utm_source=line&utm_campaign=share_the_app
https://godapp.jp/invite/\(username)
"""
guard let shareURL = URL(string: "https://line.me/R/share?text=\(text)")
else { return .none }
Expand Down Expand Up @@ -73,15 +68,19 @@ public struct ShareTheAppView: View {
ZStack {
Color.godService
.ignoresSafeArea()
VStack(spacing: 20) {
Text("Get more\nfriends to play")
VStack(spacing: 24) {
Image(ImageResource.upsideDownFace)
.resizable()
.aspectRatio(1, contentMode: .fit)
.frame(width: 120)
Text("Get more\nfriends to play", bundle: .module)
.font(.title2)
.foregroundStyle(Color.white)

ShareLink(
item: viewStore.shareURL
) {
Text("Share the app")
Text("Share the app", bundle: .module)
.bold()
.frame(width: 188, height: 54)
.background(Color.white)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public struct PlayAgainLogic: Reducer {
else { return .none }
let text = """
\(schoolName)向けの新しいアプリダウンロードしてみて!
https://godapp.jp/invite/\(username)?utm_source=line&utm_campaign=invite
https://godapp.jp/invite/\(username)
"""
guard
let encodedText = text.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public struct ProfileShareLogic: Reducer {
"""
let lineText = """
\(schoolName)向けの新しいアプリダウンロードしてみて!
https://godapp.jp/add/\(username)?utm_source=line&utm_campaign=profile
https://godapp.jp/add/\(username)
"""
guard
let text = lineText.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed),
Expand Down