Skip to content

Commit

Permalink
Merge pull request #1600 from p2p-org/feature/ETH-627
Browse files Browse the repository at this point in the history
[ETH-627] Remove intercom completely
  • Loading branch information
lisemyon authored Dec 27, 2023
2 parents 12fe463 + 60564bb commit ffe9f11
Show file tree
Hide file tree
Showing 40 changed files with 33 additions and 415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,6 @@
"version" : "1.3.1"
}
},
{
"identity" : "intercom-ios-sp",
"kind" : "remoteSourceControl",
"location" : "https://github.com/intercom/intercom-ios-sp",
"state" : {
"revision" : "1031655ceb49a8c8975b0cb138fe3bed897d159e",
"version" : "15.0.3"
}
},
{
"identity" : "jazziconswift",
"kind" : "remoteSourceControl",
Expand All @@ -194,8 +185,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher.git",
"state" : {
"revision" : "c75584ac759cbb16b204d0a7de3ebf53ea6b304d",
"version" : "7.9.0"
"revision" : "add0a87ec4e31e2ca2a0b2085f0559201e4f5918",
"version" : "7.10.1"
}
},
{
Expand Down Expand Up @@ -239,8 +230,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/marmelroy/PhoneNumberKit.git",
"state" : {
"revision" : "b6c141f4a97dde7cd3ea335a5d6d679faa7675f6",
"version" : "3.6.7"
"revision" : "d2886b0735a47e47fb227504666756efb2e2ac26",
"version" : "3.7.6"
}
},
{
Expand Down Expand Up @@ -401,8 +392,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "dc46eeb3928a75390651fac6c1ef7f93ad59a73b",
"version" : "1.11.1"
"revision" : "59b663f68e69f27a87b45de48cb63264b8194605",
"version" : "1.15.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
Expand Down
1 change: 0 additions & 1 deletion p2p_wallet/AppDelegate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Defaults.fiat = .usd

UserDefaults.standard.set(false, forKey: "_UIConstraintBasedLayoutLogUnsatisfiable")
IntercomStartingConfigurator().configure()

setupNavigationAppearance()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ final class AppDelegateProxyService: NSObject, UIApplicationDelegate {
AppflyerAppDelegateService(),
DeeplinkAppDelegateService(),
HistoryAppdelegateService(),
IntercomAppDelegateService(),
LokaliseAppDelegateService(),
]
serviceAppDelegates = services.compactMap { $0 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,9 @@ final class DeeplinkAppDelegateService: NSObject, AppDelegateService {
return
}

// Intercom survey
// https://key.app/intercom?intercom_survey_id=133423424
if urlComponents.host == "key.app",
urlComponents.path == "/intercom",
let queryItem = urlComponents.queryItems?.first(where: { $0.name == "intercom_survey_id" }),
let value = queryItem.value
{
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
GlobalAppState.shared.surveyID = value
}
}

// Send via link
// https://t.key.app/<seed>
else if urlComponents.host == "t.key.app" {
if urlComponents.host == "t.key.app" {
GlobalAppState.shared.sendViaLinkUrl = urlComponents.url
}
}
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions p2p_wallet/Common/Services/Intercom/HelpCenterLauncher.swift

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions p2p_wallet/Injection/Resolver+registerAllServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ extension Resolver: ResolverRegistering {

/// Graph scope: Recreate and reuse dependencies
@MainActor private static func registerForGraphScope() {
// Intercom
register { IntercomMessengerLauncher() }
.implements(HelpCenterLauncher.self)

// ImageSaver
register { ImageSaver() }
.implements(ImageSaverType.self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ struct SettingsView: View {
}
)
}
Button(
action: { viewModel.showView(.support) },
label: { cellView(image: .settingsSupport, title: L10n.support.uppercaseFirst) }
)
Button(
action: {
viewModel.sendSignOutAnalytics()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ final class SettingsViewModel: BaseViewModel, ObservableObject {
return KeyAppAnalyticsEvent.settingsPinClick
case .network:
return KeyAppAnalyticsEvent.settingsNetworkClick
case .support:
return KeyAppAnalyticsEvent.settingsSupportClick
case .recoveryKit:
return KeyAppAnalyticsEvent.settingsRecoveryClick
default:
Expand Down Expand Up @@ -195,7 +193,6 @@ final class SettingsViewModel: BaseViewModel, ObservableObject {
extension SettingsViewModel {
enum OpenAction {
case username
case support
case reserveUsername(userAddress: String)
case recoveryKit
case yourPin
Expand Down
4 changes: 0 additions & 4 deletions p2p_wallet/Scenes/Main/NewSettings/SettingsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import Resolver
import UIKit

final class SettingsCoordinator: Coordinator<Void> {
@Injected private var helpLauncher: HelpCenterLauncher

private let navigationController: UINavigationController

init(navigationController: UINavigationController) {
Expand All @@ -24,8 +22,6 @@ final class SettingsCoordinator: Coordinator<Void> {
case .username:
let vc = NewUsernameViewController()
navigationController.pushViewController(vc, animated: true)
case .support:
helpLauncher.launch()
case .reserveUsername:
coordinate(to: CreateUsernameCoordinator(navigationOption: .settings(parent: navigationController)))
.sink { [unowned self] in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class PincodeChangeCoordinator: Coordinator<Bool> {
private let transition = PanelTransition()

@Injected private var pincodeStorage: PincodeStorageType
@Injected private var helpLauncher: HelpCenterLauncher
let result = PassthroughSubject<Bool, Never>()

init(navVC: UINavigationController) {
Expand Down Expand Up @@ -52,11 +51,6 @@ class PincodeChangeCoordinator: Coordinator<Bool> {
viewController.modalPresentationStyle = .custom
self.navVC.present(viewController, animated: true)
}
view.help
.sink(receiveValue: { [unowned self] in
helpLauncher.launch()
})
.store(in: &subscriptions)

let vc = UIHostingController(rootView: view)
vc.title = L10n.changePIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ struct PincodeVerifyView: View {
@Injected private var pincodeStorage: PincodeStorageType
var onSuccess: (() -> Void)?
var forgetPinCode: (() -> Void)?
private let helpSubject = PassthroughSubject<Void, Never>()
var help: AnyPublisher<Void, Never> { helpSubject.eraseToAnyPublisher() }

var body: some View {
VStack {
Expand Down Expand Up @@ -59,15 +57,6 @@ struct PincodeVerifyView: View {
.padding(.top, 24)
}
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button {
helpSubject.send()
} label: {
Image(.helpOutline)
}
}
}
.padding(.top, safeAreaInsets.top + 50)
.padding(.bottom, 54)
.background(Color(.rain))
Expand Down
17 changes: 0 additions & 17 deletions p2p_wallet/Scenes/TabBar/TabBarController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import AnalyticsManager
import Combine
import Intercom
import Onboarding
import Resolver
import Sell
Expand All @@ -11,7 +10,6 @@ final class TabBarController: UITabBarController {
// MARK: - Dependencies

@Injected private var analyticsManager: AnalyticsManager
@Injected private var helpLauncher: HelpCenterLauncher
@Injected private var solanaTracker: SolanaTracker
@Injected private var deviceShareMigration: DeviceShareMigrationService

Expand Down Expand Up @@ -186,12 +184,6 @@ final class TabBarController: UITabBarController {
}
.store(in: &subscriptions)

pincodeViewModel.infoDidTap
.sink(receiveValue: { [unowned self] in
helpLauncher.launch()
})
.store(in: &subscriptions)

localAuthVC?.onClose = { [weak self] in
self?.viewModel.authenticate(presentationStyle: nil)
if authSuccess == false {
Expand Down Expand Up @@ -261,15 +253,6 @@ final class TabBarController: UITabBarController {
})
.store(in: &subscriptions)

viewModel.moveToIntercomSurvey
.sink { id in
guard !id.isEmpty else { return }
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
Intercom.presentSurvey(id)
}
}
.store(in: &subscriptions)

// locking status
viewModel.isLockedPublisher
.sink(receiveValue: { [weak self] isLocked in
Expand Down
25 changes: 0 additions & 25 deletions p2p_wallet/Scenes/TabBar/TabBarViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,6 @@ extension TabBarViewModel {
.eraseToAnyPublisher()
}

var moveToIntercomSurvey: AnyPublisher<String, Never> {
Publishers.Merge(
authenticationHandler
.isLockedPublisher
.filter { value in
GlobalAppState.shared.surveyID != nil && value == false
}
.map { _ in () },

viewDidLoad
.filter { [weak self] in
self?.notificationService.showFromLaunch == true
}
)
.map { _ in () }
.map {
GlobalAppState.shared.surveyID ?? ""
}
.handleEvents(receiveOutput: { _ in
GlobalAppState.shared.surveyID = nil
})
.receive(on: DispatchQueue.main)
.eraseToAnyPublisher()
}

var moveToSendViaLinkClaim: AnyPublisher<URL, Never> {
Publishers.CombineLatest(
authenticationStatusPublisher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ final class PincodeViewController: BaseViewController {

private func setupNavBar() {
addLeftButton()
addRightButton()
}

private func addLeftButton() {
Expand Down Expand Up @@ -164,23 +163,6 @@ final class PincodeViewController: BaseViewController {
viewModel.back.send()
}

private func addRightButton() {
let infoButton = UIButton()
infoButton.addTarget(self, action: #selector(openInfo), for: .touchUpInside)
infoButton.setImage(.init(resource: .helpOutline), for: .normal)
infoButton.contentMode = .scaleAspectFill
if navigationController != nil {
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: infoButton)
} else {
view.addSubview(infoButton)
infoButton.autoPinToTopRightCornerOfSuperviewSafeArea(xInset: 17, yInset: 3)
}
}

@objc private func openInfo() {
viewModel.infoDidTap.send()
}

private var transition: PanelTransition?
private var forgetPinViewController: UIViewController?
private func openForgotPIN(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ final class PincodeViewModel: BaseViewModel, ObservableObject {
@Published var showForgotModal: Bool = false

let back = PassthroughSubject<Void, Never>()
let infoDidTap = PassthroughSubject<Void, Never>()
let pincodeSuccess = PassthroughSubject<String?, Never>()
let pincodeFailed = PassthroughSubject<Void, Never>()

Expand Down
Loading

0 comments on commit ffe9f11

Please sign in to comment.