Skip to content

Commit

Permalink
Merge branch 'main' into feature/edit-coinsured/GEN-1451-deep-link
Browse files Browse the repository at this point in the history
# Conflicts:
#	Projects/App/Sources/AppDelegate+Deeplinks.swift
#	Projects/App/Sources/Screens/ChatScreen/Models/Message.swift
#	Projects/EditCoInsured/Sources/Journeys/EditCoInsuredJourney.swift
#	Projects/EditCoInsured/Sources/View/ContractDetailErrorScreen.swift
#	Projects/hCore/Sources/DeepLink.swift
  • Loading branch information
julia-andersson committed Dec 4, 2023
2 parents 452924d + 2c9a9c5 commit 42ec241
Show file tree
Hide file tree
Showing 215 changed files with 5,348 additions and 11,134 deletions.
3 changes: 1 addition & 2 deletions Projects/App/Config/Production/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
<string>nb</string>
<string>en</string>
<string>sv</string>
<string>fr</string>
</array>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>12.2.0</string>
<string>12.2.3</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
3 changes: 1 addition & 2 deletions Projects/App/Config/Test/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
<string>en</string>
<string>da</string>
<string>nb</string>
<string>fr</string>
</array>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>12.2.0</string>
<string>12.2.3</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
1 change: 0 additions & 1 deletion Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ let appDependencies: [TargetDependency] = [
target: "ResourceBundledDependencies",
path: .relativeToRoot("Dependencies/ResourceBundledDependencies")
),
.project(target: "Embark", path: .relativeToRoot("Projects/Embark")),
],
sdkFrameworks,
]
Expand Down
11 changes: 11 additions & 0 deletions Projects/App/Sources/AppDelegate+Deeplinks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extension AppDelegate {
}
profileStore.send(.fetchMemberDetails)
}
//<<<<<<< HEAD
} else if path == .contract {
let contractId = getContractId(from: dynamicLinkUrl)
deepLinkDisposeBag += ApplicationContext.shared.$hasFinishedBootstrapping.atOnce().filter { $0 }
Expand Down Expand Up @@ -83,6 +84,16 @@ extension AppDelegate {
}
contractStore.send(.fetchContracts)
}
//=======
} else if path == .payments {
deepLinkDisposeBag += ApplicationContext.shared.$hasFinishedBootstrapping.atOnce().filter { $0 }
.onValue { [weak self] _ in
self?.deepLinkDisposeBag.dispose()
let vc = PaymentsView().detentJourney(schema: Bundle.main.urlScheme ?? "")
let disposeBag = DisposeBag()
disposeBag += fromVC.present(vc)
//>>>>>>> main
}
} else {
deepLinkDisposeBag += ApplicationContext.shared.$hasFinishedBootstrapping.atOnce().filter { $0 }
.onValue { [weak self] _ in
Expand Down
7 changes: 7 additions & 0 deletions Projects/App/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,19 @@ extension ApolloClient {
public static func initAndRegisterClient() -> Future<Void> {
Self.initClients()
.onValue { hApollo in
let paymentService = hPaymentServiceOctopus()
let hForeverCodeService = hForeverCodeServiceOctopus()
let hCampaignsService = hCampaingsServiceOctopus()
let networkClient = NetworkClient()
Dependencies.shared.add(module: Module { hApollo.giraffe })
Dependencies.shared.add(module: Module { hApollo.octopus })
Dependencies.shared.add(module: Module { () -> FileUploaderClient in networkClient })
Dependencies.shared.add(module: Module { () -> ChatFileUploaderClient in networkClient })
Dependencies.shared.add(module: Module { () -> AdyenService in networkClient })
Dependencies.shared.add(module: Module { () -> hPaymentService in paymentService })
Dependencies.shared.add(module: Module { () -> hForeverCodeService in hForeverCodeService })
Dependencies.shared.add(module: Module { () -> hCampaignsService in hCampaignsService })

}
.toVoid()
}
Expand Down
1 change: 0 additions & 1 deletion Projects/App/Sources/CrossFrameworkCoordinator.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Apollo
import Contracts
import Embark
import Flow
import Foundation
import Home
Expand Down
38 changes: 0 additions & 38 deletions Projects/App/Sources/Journeys/ClaimsJourney.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Claims
import Contacts
import Embark
import Flow
import Foundation
import Home
Expand Down Expand Up @@ -30,21 +29,6 @@ extension AppJourney {
static func startClaimsJourney(from origin: ClaimsOrigin) -> some JourneyPresentation {
if hAnalyticsExperiment.claimsFlow {
honestyPledge(from: origin)
} else {
claimsJourneyPledgeAndNotificationWrapper { redirect in
switch redirect {
case .chat:
AppJourney.claimsChat()
.withJourneyDismissButton
.hidesBackButton
case .close:
DismissJourney()
case .menu:
ContinueJourney()
case .mailingList:
DismissJourney()
}
}
}
}

Expand Down Expand Up @@ -73,17 +57,6 @@ extension AppJourney {
}
}
}
@JourneyBuilder
private static func claimsJourneyPledgeAndNotificationWrapper<RedirectJourney: JourneyPresentation>(
@JourneyBuilder redirectJourney: @escaping (_ redirect: ExternalRedirect) -> RedirectJourney
) -> some JourneyPresentation {
HonestyPledge.journey(style: .detented(.scrollViewContentSize)) {
AppJourney.notificationJourney {
let embark = Embark(name: "claims")
AppJourney.embark(embark, redirectJourney: redirectJourney).hidesBackButton
}
}
}
}

extension AppJourney {
Expand All @@ -106,17 +79,6 @@ extension AppJourney {
}
}

extension AppJourney {
static func embark<RedirectJourney: JourneyPresentation>(
_ embark: Embark,
style: PresentationStyle = .default,
@JourneyBuilder redirectJourney: @escaping (_ redirect: ExternalRedirect) -> RedirectJourney
) -> some JourneyPresentation {
Journey(embark, style: style) { redirect in
redirectJourney(redirect)
}
}
}
extension JourneyPresentation {
func sendActionOnDismiss<S: Store>(_ storeType: S.Type, _ action: S.Action) -> Self {
return self.onDismiss {
Expand Down
5 changes: 3 additions & 2 deletions Projects/App/Sources/Journeys/CoInsuredJourney.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Contracts
import EditCoInsured
import Presentation

extension AppJourney {
@JourneyBuilder
static func editCoInsured(contractIds: [String]) -> some JourneyPresentation {
EditCoInsuredJourney.openInitialScreen(contractIds: contractIds)
static func editCoInsured(configs: [InsuredPeopleConfig]) -> some JourneyPresentation {
EditCoInsuredJourney.openInitialScreen(configs: configs)
}
}
135 changes: 81 additions & 54 deletions Projects/App/Sources/Journeys/LoggedInJourney.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Claims
import Contracts
import Embark
import EditCoInsured
import Flow
import Forever
import Form
Expand Down Expand Up @@ -50,7 +50,7 @@ extension AppJourney {
}
}
case let .startCoInsuredFlow(contractIds):
AppJourney.editCoInsured(contractIds: contractIds)
AppJourney.editCoInsured(configs: contractIds)
}
}
.makeTabSelected(UgglanStore.self) { action in
Expand Down Expand Up @@ -100,56 +100,50 @@ extension AppJourney {
}

fileprivate static var profileTab: some JourneyPresentation {
ProfileView.journey { result in
switch result {
case .openPayment:
HostingJourney(
PaymentStore.self,
rootView: MyPaymentsView(urlScheme: Bundle.main.urlScheme ?? "")
) { action in
if case .openConnectBankAccount = action {
let store: PaymentStore = globalPresentableStoreContainer.get()
let hasAlreadyConnected = [PayinMethodStatus.active, PayinMethodStatus.pending]
.contains(store.state.paymentStatusData?.status ?? .active)
ConnectBankAccount(
setupType: hasAlreadyConnected ? .replacement : .initial,
urlScheme: Bundle.main.urlScheme ?? ""
)
.journeyThenDismiss
} else if case .openHistory = action {
PaymentHistory.journey
}
let store: PaymentStore = globalPresentableStoreContainer.get()
store.send(.setSchema(schema: Bundle.main.urlScheme ?? ""))
return
ProfileView.journey { result in
switch result {
case .openPayment:
PaymentsView().journey(schema: Bundle.main.urlScheme ?? "")
case .resetAppLanguage:
ContinueJourney()
.onPresent {
UIApplication.shared.appDelegate.bag += UIApplication.shared.appDelegate.window.present(
AppJourney.main
)
}
case .openChat:
AppJourney.freeTextChat().withDismissButton
case .logout:
ContinueJourney()
.onPresent {
UIApplication.shared.appDelegate.logout()
}
case .registerForPushNotifications:
ContinueJourney()
.onPresent {
_ = UIApplication.shared.appDelegate
.registerForPushNotifications()
}
}
.configureTitle(L10n.myPaymentTitle)
case .resetAppLanguage:
ContinueJourney()
.onPresent {
UIApplication.shared.appDelegate.bag += UIApplication.shared.appDelegate.window.present(
AppJourney.main
)
}
case .openChat:
AppJourney.freeTextChat().withDismissButton
case .logout:
ContinueJourney()
.onPresent {
UIApplication.shared.appDelegate.logout()
}
case .registerForPushNotifications:
ContinueJourney()
.onPresent {
_ = UIApplication.shared.appDelegate
.registerForPushNotifications()
}
}
}
.makeTabSelected(UgglanStore.self) { action in
if case .makeTabActive(let deepLink) = action {
return deepLink == .profile || deepLink == .sasEuroBonus
} else {
return false
.makeTabSelected(UgglanStore.self) { action in
if case .makeTabActive(let deepLink) = action {
return deepLink == .profile || deepLink == .sasEuroBonus
} else {
return false
}
}
.onAction(HomeStore.self) { action in
if case let .openDocument(url) = action {
Journey(
Document(url: url, title: L10n.insuranceCertificateTitle),
style: .detented(.large)
)
}
}
}
}

static var loggedIn: some JourneyPresentation {
Expand Down Expand Up @@ -244,23 +238,56 @@ extension JourneyPresentation {

public var configurePaymentNavigation: some JourneyPresentation {
onAction(PaymentStore.self) { action in
if case .connectPayments = action {
PaymentSetup(setupType: .initial).journeyThenDismiss
if case let .navigation(navigateTo) = action {
if case .openConnectPayments = navigateTo {
PaymentSetup(setupType: .initial).journeyThenDismiss
}
}
}
}

public var configureContractNavigation: some JourneyPresentation {
onAction(
ContractStore.self,
EditCoInsuredStore.self,
{ action in
if case let .coInsuredNavigationAction(navAction) = action {
if case let .openMissingCoInsuredAlert(contractId) = navAction {
EditCoInsuredJourney.openMissingCoInsuredAlert(contractId: contractId)
if case let .openMissingCoInsuredAlert(config) = navAction {
EditCoInsuredJourney.openMissingCoInsuredAlert(config: config)
}
} else if case let .openEditCoInsured(contractId, fromInfoCard) = action {
EditCoInsuredJourney.handleOpenEditCoInsured(for: contractId, fromInfoCard: fromInfoCard)
}
}
)
.onAction(EditCoInsuredStore.self) { action, pre in
if case .fetchContracts = action {
let store: ContractStore = globalPresentableStoreContainer.get()
store.send(.fetchContracts)
} else if case .goToFreeTextChat = action {
let store: UgglanStore = globalPresentableStoreContainer.get()
store.send(.openChat)
} else if case .checkForAlert = action {
let store: ContractStore = globalPresentableStoreContainer.get()
let editStore: EditCoInsuredStore = globalPresentableStoreContainer.get()

let missingContract = store.state.activeContracts.first { contract in
if contract.upcomingChangedAgreement != nil {
return false
} else {
return contract.coInsured
.first(where: { coInsured in
coInsured.hasMissingInfo && contract.terminationDate == nil
}) != nil
}
}
if let missingContract {
editStore.send(
.coInsuredNavigationAction(
action: .openMissingCoInsuredAlert(config: .init(contract: missingContract))
)
)
}
}
}
}
}
1 change: 0 additions & 1 deletion Projects/App/Sources/Journeys/MovingFlowJourney.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Apollo
import Contracts
import Embark
import Flow
import Foundation
import Home
Expand Down
1 change: 0 additions & 1 deletion Projects/App/Sources/Journeys/OnboardingJourney.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Embark
import Flow
import Foundation
import Presentation
Expand Down
1 change: 0 additions & 1 deletion Projects/App/Sources/Journeys/WebRedirectJourney.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Embark
import Flow
import Foundation
import Presentation
Expand Down
13 changes: 10 additions & 3 deletions Projects/App/Sources/Screens/ChatScreen/ChatState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ class ChatState {
self.askForPermissionsSignal.value = true
case .denied:
func createToast() -> Toast {
let schema = UITraitCollection.current.userInterfaceStyle
return Toast(
symbol: .icon(hCoreUIAssets.chatQuickNav.image),
body: L10n.pushNotificationsAlertTitle,
subtitle: L10n.chatToastPushNotificationsSubtitle,
symbol: .icon(hCoreUIAssets.infoIconFilled.image),
body: L10n.chatToastPushNotificationsTitle,
infoText: L10n.pushNotificationsAlertActionOk,
textColor: hSignalColor.blueText.colorFor(schema == .dark ? .dark : .light, .base).color
.uiColor(),
backgroundColor: hSignalColor.blueFill.colorFor(schema == .dark ? .dark : .light, .base).color
.uiColor(),
symbolColor: hSignalColor.blueElement.colorFor(schema == .dark ? .dark : .light, .base).color
.uiColor(),
duration: 6
)
}
Expand Down
8 changes: 2 additions & 6 deletions Projects/App/Sources/Screens/ChatScreen/Models/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,8 @@ func hash(into hasher: inout Hasher) { hasher.combine(globalId) }
type = .gif(url: URL(string: text.text))
} else if text.text.isCrossSell {
type = .crossSell(url: URL(string: text.text))
} else if text.text.isDeepLink {
if let url = URL(string: text.text) {
type = .deepLink(url: url)
} else {
type = .text
}
} else if text.text.isDeepLink, let url = URL(string: text.text) {
type = .deepLink(url: url)
} else {
type = .text
}
Expand Down
Loading

0 comments on commit 42ec241

Please sign in to comment.