[PI-36] Firebase, Kakao sdk를 추가하고 카톡으로 공유할 수 있도록 합니다. #53
Open
escapeanaemia wants to merge 16 commits intomainfrom
Open
[PI-36] Firebase, Kakao sdk를 추가하고 카톡으로 공유할 수 있도록 합니다. #53escapeanaemia wants to merge 16 commits intomainfrom
escapeanaemia wants to merge 16 commits intomainfrom
Conversation
GangWoon
requested changes
Apr 8, 2023
Contributor
GangWoon
left a comment
There was a problem hiding this comment.
현재 FireAndForget 이펙트가 다수 발생하는 거 같은데, 실행시켜버리고 마는 거 같습니다.
이를 조금 더 저희가 이해하기 쉽도록 분리해주셨으면 좋겠습니다.
또한 리듀서 내부에서 이펙트를 핸들링하는 함수를 만드는게 아닌, kakao, firebase를 리듀서 내부에서 바로 사용하지말고, 레이어를 하나 만들어주셨으면 좋겠습니다.
| struct PlanzApp: App { | ||
| @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate | ||
|
|
||
| let store: StoreOf<AppCore> = .init( |
Contributor
There was a problem hiding this comment.
스토어의 위치를 AppDelegate로 옮겨 주시겠어요?
| import ShareFeature | ||
| import SwiftUI | ||
|
|
||
| class AppDelegate: NSObject, UIApplicationDelegate { |
Comment on lines
+34
to
+65
| func getDeepLink(id: String?) -> URL? { | ||
| if let id { | ||
| return URL(string: "\(Secrets.Firebase.domain.value)/?plandId=\(id)") | ||
| } else { | ||
| return URL(string: Secrets.Firebase.domain.value) | ||
| } | ||
| } | ||
|
|
||
| func getDynamicLink(id _: String?) -> URL? { | ||
| guard let link = getDeepLink(id: nil) else { return nil } | ||
| let dynamicLinksDomainURIPrefix = Secrets.Firebase.prefix.value | ||
| let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix) | ||
| linkBuilder?.iOSParameters = DynamicLinkIOSParameters(bundleID: Secrets.App.iosBundleId.value) | ||
| linkBuilder?.androidParameters = DynamicLinkAndroidParameters(packageName: Secrets.App.androidBundleId.value) | ||
| return linkBuilder?.url | ||
| } | ||
|
|
||
| func shareViaKakao(url _: String) { | ||
| if ShareApi.isKakaoTalkSharingAvailable() { | ||
| // TODO: 이전 화면에서 전달해주는 id 값에 맞춰서 공유 링크의 파라미터로 추가하도록 수정 필요 | ||
| ShareApi.shared.shareCustom(templateId: Int64(Secrets.Kakao.templateId.value)!, templateArgs: ["": ""]) { linkResult, error in | ||
| if let error = error { | ||
| print("error : \(error)") | ||
| } else { | ||
| print("defaultLink(templateObject:templateJsonObject) success.") | ||
| guard let linkResult = linkResult else { return } | ||
| UIApplication.shared.open(linkResult.url, options: [:], completionHandler: nil) | ||
| } | ||
| } | ||
|
|
||
| } else {} | ||
| } |
Contributor
There was a problem hiding this comment.
해당 작업을 실행하는 객체로 분리시켜주실 수 있을까요?
해당 객체를 Dependency로 받아오면 좋을 거 같습니다.
추가적으로 강제 언래핑도 제거 부탁드리겠습니다.
| func shareViaKakao(url _: String) { | ||
| if ShareApi.isKakaoTalkSharingAvailable() { | ||
| // TODO: 이전 화면에서 전달해주는 id 값에 맞춰서 공유 링크의 파라미터로 추가하도록 수정 필요 | ||
| ShareApi.shared.shareCustom(templateId: Int64(Secrets.Kakao.templateId.value)!, templateArgs: ["": ""]) { linkResult, error in |
Contributor
There was a problem hiding this comment.
escaping closure의 경우 swift concurrency로 변경해주시겠어요?
| // TODO: 이전 화면에서 전달해주는 id 값에 맞춰서 공유 링크의 파라미터로 추가하도록 수정 필요 | ||
| ShareApi.shared.shareCustom(templateId: Int64(Secrets.Kakao.templateId.value)!, templateArgs: ["": ""]) { linkResult, error in | ||
| if let error = error { | ||
| print("error : \(error)") |
Contributor
There was a problem hiding this comment.
에러가 발생하는 케이스에 대해서 다루는 정해진 규칙은 없을까요
| } | ||
| return .none | ||
| case .copyLinkTapped: | ||
| UIPasteboard.general.string = state.linkForShare |
Contributor
There was a problem hiding this comment.
해당 부분도 디펜던시로 분리시켜주시면 감사하겠습니다.
| UIPasteboard.general.string = state.linkForShare | ||
| return .none | ||
| case .shareAsKakaoTapped: | ||
| shareViaKakao(url: state.linkForShare) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ISSUE
작업 내용
실행 화면
Check List
[ISSUE-{N}] PR 제목으로 작성