-
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2fd450
commit b225a49
Showing
43 changed files
with
1,953 additions
and
46 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
12 changes: 12 additions & 0 deletions
12
BookPlayer/Assets.xcassets/small-family-pic.imageset/Contents.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "small-family-picture.jpg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+171 KB
BookPlayer/Assets.xcassets/small-family-pic.imageset/small-family-picture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
79 changes: 79 additions & 0 deletions
79
BookPlayer/SecondOnboarding/SecondOnboardingCoordinator.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// SecondOnboardingCoordinator.swift | ||
// BookPlayer | ||
// | ||
// Created by Gianni Carlo on 1/6/24. | ||
// Copyright © 2024 Tortuga Power. All rights reserved. | ||
// | ||
|
||
import BookPlayerKit | ||
import Foundation | ||
import SwiftUI | ||
|
||
/// Handle second onboarding flows | ||
class SecondOnboardingCoordinator: Coordinator { | ||
let anonymousId: String | ||
let accountService: AccountServiceProtocol | ||
let eventsService: EventsServiceProtocol | ||
let flow: BPCoordinatorPresentationFlow | ||
unowned var presentedController: UIViewController? | ||
|
||
init( | ||
flow: BPCoordinatorPresentationFlow, | ||
anonymousId: String, | ||
accountService: AccountServiceProtocol, | ||
eventsService: EventsServiceProtocol | ||
) { | ||
self.flow = flow | ||
self.anonymousId = anonymousId | ||
self.accountService = accountService | ||
self.eventsService = eventsService | ||
} | ||
|
||
func start() { | ||
Task { | ||
let response: SecondOnboardingResponse = try await accountService.getSecondOnboarding() | ||
|
||
await showOnboarding(data: response) | ||
} | ||
} | ||
|
||
@MainActor | ||
func showOnboarding(data: SecondOnboardingResponse) { | ||
switch data.type { | ||
case .support: | ||
let coordinator = SupportFlowCoordinator( | ||
flow: flow, | ||
anonymousId: anonymousId, | ||
onboardingId: data.onboardingId, | ||
stories: data.support, | ||
accountService: accountService, | ||
eventsService: eventsService | ||
) | ||
coordinator.start() | ||
} | ||
} | ||
|
||
func showAlert(_ content: BPAlertContent) { | ||
presentedController?.showAlert(content) | ||
} | ||
|
||
func showLoader() { | ||
if let vc = presentedController { | ||
LoadingUtils.loadAndBlock(in: vc) | ||
} | ||
} | ||
|
||
func stopLoader() { | ||
if let vc = presentedController { | ||
LoadingUtils.stopLoading(in: vc) | ||
} | ||
} | ||
|
||
func showCongrats() { | ||
presentedController?.view.startConfetti() | ||
presentedController?.showAlert("thanks_amazing_title".localized, message: nil) { [weak self] in | ||
self?.flow.finishPresentation(animated: true) | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
BookPlayer/SecondOnboarding/SecondOnboardingResponse.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// SecondOnboardingResponse.swift | ||
// BookPlayer | ||
// | ||
// Created by Gianni Carlo on 1/7/24. | ||
// Copyright © 2024 Tortuga Power. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct SecondOnboardingResponse: Codable { | ||
let onboardingId: String | ||
let type: SecondOnboardingType | ||
let support: [StoryViewModel] | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case type, support | ||
case onboardingId = "onboarding_id" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// SecondOnboardingType.swift | ||
// BookPlayer | ||
// | ||
// Created by Gianni Carlo on 8/6/24. | ||
// Copyright © 2024 Tortuga Power. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
enum SecondOnboardingType: String, Codable { | ||
case support | ||
} |
Oops, something went wrong.