Skip to content

Commit

Permalink
Merge pull request #2346 from CruGlobal/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
levieggertcru authored Nov 12, 2024
2 parents af787bd + ef4f726 commit 8e1d2db
Show file tree
Hide file tree
Showing 50 changed files with 96 additions and 981 deletions.
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.999.0)
aws-sdk-core (3.211.0)
aws-partitions (1.1003.0)
aws-sdk-core (3.212.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.95.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.169.0)
aws-sdk-s3 (1.170.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
benchmark (0.3.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.16.2)
Expand Down Expand Up @@ -224,14 +224,14 @@ GEM
i18n (1.14.6)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.5)
json (2.8.1)
jwt (2.9.3)
base64
logger (1.6.1)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.1001)
mime-types-data (3.2024.1105)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
Expand All @@ -245,7 +245,7 @@ GEM
nkf (0.2.0)
onesky-ruby (1.3.1)
rest-client (~> 2.0)
optparse (0.5.0)
optparse (0.6.0)
os (1.1.4)
plist (3.7.1)
public_suffix (4.0.7)
Expand Down
151 changes: 2 additions & 149 deletions godtools.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

11 changes: 1 addition & 10 deletions godtools.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "01118c20edbf992410dbd18dc8543d268a2c5d52f8d92674de8f87566072017c",
"originHash" : "5e34efb51656fc5e129b4e86acd222181e73d4b2ba93068a2bb8a599a23dde13",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -28,15 +28,6 @@
"version" : "1.7.5"
}
},
{
"identity" : "appsflyerframework-strict",
"kind" : "remoteSourceControl",
"location" : "https://github.com/AppsFlyerSDK/AppsFlyerFramework-Strict",
"state" : {
"revision" : "629e2e9873ec3f990b8be9500062b077cef730b9",
"version" : "6.14.6"
}
},
{
"identity" : "cwlcatchexception",
"kind" : "remoteSourceControl",
Expand Down
13 changes: 0 additions & 13 deletions godtools/App/AppConfig/AppConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,7 @@ class AppConfig: AppConfigInterface {
func getAppleAppId() -> String {
return "542773210"
}

func getAppsFlyerConfiguration() -> AppsFlyerConfiguration {

return AppsFlyerConfiguration(
appleAppId: getAppleAppId(),
appsFlyerDevKey: "QdbVaVHi9bHRchUTWtoaij",
shouldUseUninstallSandbox: appBuild.isDebug
)
}

func getAppsFlyerDevKey() -> String {
return "QdbVaVHi9bHRchUTWtoaij"
}

func getFacebookConfiguration() -> FacebookConfiguration {

return FacebookConfiguration(
Expand Down
2 changes: 0 additions & 2 deletions godtools/App/AppConfig/AppConfigInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import SocialAuthentication
protocol AppConfigInterface {

func getAppleAppId() -> String
func getAppsFlyerConfiguration() -> AppsFlyerConfiguration
func getAppsFlyerDevKey() -> String
func getFacebookConfiguration() -> FacebookConfiguration
func getFirebaseGoogleServiceFileName() -> String
func getGoogleAuthenticationConfiguration() -> GoogleAuthenticationConfiguration
Expand Down
36 changes: 4 additions & 32 deletions godtools/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

import UIKit
import AppsFlyerLib
import SocialAuthentication
import FacebookCore
import FirebaseDynamicLinks
Expand Down Expand Up @@ -85,13 +84,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if appBuild.configuration == .release {
GodToolsParserLogger.shared.start()
}

appDiContainer.dataLayer.getSharedAppsFlyer().configure(configuration: appConfig.getAppsFlyerConfiguration(), deepLinkDelegate: self)


appDiContainer.dataLayer.getAnalytics().firebaseAnalytics.configure()

appDiContainer.dataLayer.getAnalytics().appsFlyerAnalytics.configure()


ConfigureFacebookOnAppLaunch.configure(
application: application,
launchOptions: launchOptions,
Expand Down Expand Up @@ -133,8 +128,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidBecomeActive(_ application: UIApplication) {

reloadShortcutItems(application: application)

appDiContainer.dataLayer.getAnalytics().appsFlyerAnalytics.trackAppLaunch()
}

func applicationWillTerminate(_ application: UIApplication) {
Expand Down Expand Up @@ -168,17 +161,14 @@ extension AppDelegate {

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

appDiContainer.dataLayer.getSharedAppsFlyer().registerUninstall(deviceToken: deviceToken)
}

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {

appDiContainer.dataLayer.getSharedAppsFlyer().handlePushNotification(userInfo: userInfo)
}

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {

appDiContainer.dataLayer.getSharedAppsFlyer().handlePushNotification(userInfo: userInfo)
}
}

Expand Down Expand Up @@ -228,9 +218,7 @@ extension AppDelegate {
extension AppDelegate {

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {

appDiContainer.dataLayer.getSharedAppsFlyer().handleOpenUrl(url: url, options: options)


if let firebaseDynamicLinkUrl = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url)?.url {
_ = appDeepLinkingService.parseDeepLinkAndNotify(incomingDeepLink: .url(incomingUrl: IncomingDeepLinkUrl(url: firebaseDynamicLinkUrl)))
return true
Expand All @@ -255,9 +243,7 @@ extension AppDelegate {
extension AppDelegate {

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {

appDiContainer.dataLayer.getSharedAppsFlyer().continueUserActivity(userActivity: userActivity)


if userActivity.activityType != NSUserActivityTypeBrowsingWeb {
return false
}
Expand Down Expand Up @@ -290,17 +276,3 @@ extension AppDelegate {
return false
}
}

// MARK: - AppsFlyer DeepLinkDelegate

extension AppDelegate: DeepLinkDelegate {

func didResolveDeepLink(_ result: DeepLinkResult) {

guard let data = result.deepLink?.clickEvent else {
return
}

_ = appDeepLinkingService.parseDeepLinkAndNotify(incomingDeepLink: .appsFlyer(data: data))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class AppDataLayerDependencies {
self.firebaseEnabled = firebaseEnabled

sharedAnalytics = AnalyticsContainer(
appsFlyerAnalytics: AppsFlyerAnalytics(appsFlyer: AppsFlyer.shared, loggingEnabled: appBuild.configuration == .analyticsLogging),
firebaseAnalytics: FirebaseAnalytics(appBuild: appBuild, loggingEnabled: appBuild.configuration == .analyticsLogging)
)
}
Expand Down Expand Up @@ -273,10 +272,6 @@ class AppDataLayerDependencies {
)
}

func getSharedAppsFlyer() -> AppsFlyer {
return AppsFlyer.shared
}

func getSharedIgnoreCacheSession() -> IgnoreCacheSession {
return sharedIgnoreCacheSession
}
Expand Down Expand Up @@ -362,7 +357,6 @@ class AppDataLayerDependencies {
func getTranslationsRepository() -> TranslationsRepository {
return TranslationsRepository(
infoPlist: getInfoPlist(),
appBuild: getAppBuild(),
api: MobileContentTranslationsApi(config: getAppConfig(), ignoreCacheSession: sharedIgnoreCacheSession),
cache: RealmTranslationsCache(realmDatabase: sharedRealmDatabase),
resourcesFileCache: getResourcesFileCache(),
Expand Down
6 changes: 1 addition & 5 deletions godtools/App/DependencyContainer/AppDiContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class AppDiContainer {
let toolDetailsDiContainer = ToolDetailsFeatureDiContainer(coreDataLayer: dataLayer)
let toolScreenShareDiContainer = ToolScreenShareFeatureDiContainer(coreDataLayer: dataLayer)
let toolSettingsDiContainer = ToolSettingsDiContainer(coreDataLayer: dataLayer)
let toolsFilterDiContainer = ToolsFilterFeatureDiContainer(coreDataLayer: dataLayer, coreDomainLayer: domainLayer)
let toolsFilterDiContainer = ToolsFilterFeatureDiContainer(coreDataLayer: dataLayer)
let toolShortcutLinks = ToolShortcutLinksDiContainer(coreDataLayer: dataLayer)
let tutorialDiContainer = TutorialFeatureDiContainer(coreDataLayer: dataLayer)

Expand Down Expand Up @@ -150,10 +150,6 @@ class AppDiContainer {
)
}

func getToolOpenedAnalytics() -> ToolOpenedAnalytics {
return ToolOpenedAnalytics(appsFlyerAnalytics: dataLayer.getAnalytics().appsFlyerAnalytics)
}

func getToolTrainingTipsOnboardingViews() -> ToolTrainingTipsOnboardingViewsService {
return ToolTrainingTipsOnboardingViewsService(
cache: ToolTrainingTipsOnboardingViewsUserDefaultsCache(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ class ArticleCategoriesView: AppViewController {
let cellAspectRatio: CGSize = CGSize(width: 15, height: 8)
categoriesTableView.rowHeight = floor(UIScreen.main.bounds.size.width / cellAspectRatio.width * cellAspectRatio.height)

if #available(iOS 10.0, *) {
categoriesTableView.refreshControl = refreshArticlesControl
} else {
categoriesTableView.addSubview(refreshArticlesControl)
}
categoriesTableView.refreshControl = refreshArticlesControl
}

private func setupBinding() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class TractViewModel: MobileContentPagesViewModel {
private let resourceViewsService: ResourceViewsService
private let trackActionAnalyticsUseCase: TrackActionAnalyticsUseCase
private let persistUserToolLanguageSettingsUseCase: PersistUserToolLanguageSettingsUseCase
private let toolOpenedAnalytics: ToolOpenedAnalytics
private let liveShareStream: String?

private var cancellables: Set<AnyCancellable> = Set()
Expand All @@ -32,14 +31,13 @@ class TractViewModel: MobileContentPagesViewModel {

@Published var hidesRemoteShareIsActive: Bool = true

init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, tractRemoteSharePublisher: TractRemoteSharePublisher, tractRemoteShareSubscriber: TractRemoteShareSubscriber, resourceViewsService: ResourceViewsService, trackActionAnalyticsUseCase: TrackActionAnalyticsUseCase, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, toolOpenedAnalytics: ToolOpenedAnalytics, liveShareStream: String?, initialPage: MobileContentPagesPage?, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase, selectedLanguageIndex: Int?, persistUserToolLanguageSettingsUseCase: PersistUserToolLanguageSettingsUseCase, shouldPersistToolSettings: Bool) {
init(flowDelegate: FlowDelegate, renderer: MobileContentRenderer, tractRemoteSharePublisher: TractRemoteSharePublisher, tractRemoteShareSubscriber: TractRemoteShareSubscriber, resourceViewsService: ResourceViewsService, trackActionAnalyticsUseCase: TrackActionAnalyticsUseCase, resourcesRepository: ResourcesRepository, translationsRepository: TranslationsRepository, mobileContentEventAnalytics: MobileContentRendererEventAnalyticsTracking, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getTranslatedLanguageName: GetTranslatedLanguageName, liveShareStream: String?, initialPage: MobileContentPagesPage?, trainingTipsEnabled: Bool, incrementUserCounterUseCase: IncrementUserCounterUseCase, selectedLanguageIndex: Int?, persistUserToolLanguageSettingsUseCase: PersistUserToolLanguageSettingsUseCase, shouldPersistToolSettings: Bool) {

self.flowDelegate = flowDelegate
self.tractRemoteSharePublisher = tractRemoteSharePublisher
self.tractRemoteShareSubscriber = tractRemoteShareSubscriber
self.resourceViewsService = resourceViewsService
self.trackActionAnalyticsUseCase = trackActionAnalyticsUseCase
self.toolOpenedAnalytics = toolOpenedAnalytics
self.liveShareStream = liveShareStream
self.persistUserToolLanguageSettingsUseCase = persistUserToolLanguageSettingsUseCase
self.shouldPersistToolSettings = shouldPersistToolSettings
Expand Down Expand Up @@ -141,9 +139,6 @@ class TractViewModel: MobileContentPagesViewModel {
subscribeToLiveShareStreamIfNeeded()

_ = resourceViewsService.postNewResourceView(resourceId: resource.id)

toolOpenedAnalytics.trackFirstToolOpenedIfNeeded(resource: resource)
toolOpenedAnalytics.trackToolOpened(resource: resource)
}

private func trackLanguageTapped(tappedLanguage: LanguageModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,22 @@ class GetToolDetailsLearnToShareToolIsAvailableRepository: GetToolDetailsLearnTo
self.translationsRepository = translationsRepository
}

func getIsAvailablePublisher(toolId: String, language: BCP47LanguageIdentifier) -> AnyPublisher<Bool, Never> {
func getIsAvailablePublisher(toolId: String, primaryLanguage: BCP47LanguageIdentifier, parallelLanguage: BCP47LanguageIdentifier?) -> AnyPublisher<Bool, Never> {

guard let translation = translationsRepository.getLatestTranslation(resourceId: toolId, languageCode: language) else {
return Publishers.CombineLatest(
getTranslationHasTipsPublisher(toolId: toolId, language: primaryLanguage),
getTranslationHasTipsPublisher(toolId: toolId, language: parallelLanguage)
)
.map { (primaryTranslationHasTips: Bool, parallelTranslationHasTips: Bool) in

return primaryTranslationHasTips || parallelTranslationHasTips
}
.eraseToAnyPublisher()
}

private func getTranslationHasTipsPublisher(toolId: String, language: BCP47LanguageIdentifier?) -> AnyPublisher<Bool, Never> {

guard let language = language, let translation = translationsRepository.getLatestTranslation(resourceId: toolId, languageCode: language) else {
return Just(false)
.eraseToAnyPublisher()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import Combine

protocol GetToolDetailsLearnToShareToolIsAvailableRepositoryInterface {

func getIsAvailablePublisher(toolId: String, language: BCP47LanguageIdentifier) -> AnyPublisher<Bool, Never>
func getIsAvailablePublisher(toolId: String, primaryLanguage: BCP47LanguageIdentifier, parallelLanguage: BCP47LanguageIdentifier?) -> AnyPublisher<Bool, Never>
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ class GetToolDetailsLearnToShareToolIsAvailableUseCase {
self.getToolDetailsLearnToShareToolIsAvailableRepository = getToolDetailsLearnToShareToolIsAvailableRepository
}

func getIsAvailablePublisher(toolId: String, language: BCP47LanguageIdentifier) -> AnyPublisher<Bool, Never> {
func getIsAvailablePublisher(toolId: String, primaryLanguage: BCP47LanguageIdentifier, parallelLanguage: BCP47LanguageIdentifier?) -> AnyPublisher<Bool, Never> {

return self.getToolDetailsLearnToShareToolIsAvailableRepository.getIsAvailablePublisher(toolId: toolId, language: language)
.eraseToAnyPublisher()
return self.getToolDetailsLearnToShareToolIsAvailableRepository.getIsAvailablePublisher(
toolId: toolId,
primaryLanguage: primaryLanguage,
parallelLanguage: parallelLanguage
)
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ class ToolDetailsViewModel: ObservableObject {
.map { (toolId: String) in

getToolDetailsLearnToShareToolIsAvailableUseCase
.getIsAvailablePublisher(toolId: toolId, language: primaryLanguage)
.getIsAvailablePublisher(
toolId: toolId,
primaryLanguage: primaryLanguage,
parallelLanguage: parallelLanguage
)
}
.switchToLatest()
.receive(on: DispatchQueue.main)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ class ToolsFilterFeatureDiContainer {
let dataLayer: ToolsFilterFeatureDataLayerDependencies
let domainLayer: ToolsFilterFeatureDomainLayerDependencies

// TODO: Eventually coreDomainLayer: AppDomainLayerDependencies should not be injected here once ToolsFilterDomainLayer no longer needs to depend on these use cases. ~Levi
init(coreDataLayer: AppDataLayerDependencies, coreDomainLayer: AppDomainLayerDependencies) {
init(coreDataLayer: AppDataLayerDependencies) {

dataLayer = ToolsFilterFeatureDataLayerDependencies(coreDataLayer: coreDataLayer)
// TODO: Eventually coreDataLayer: coreDataLayer and coreDomainLayer: AppDomainLayerDependencies should not be injected here. ~Levi
domainLayer = ToolsFilterFeatureDomainLayerDependencies(dataLayer: dataLayer, coreDataLayer: coreDataLayer, coreDomainLayer: coreDomainLayer)
domainLayer = ToolsFilterFeatureDomainLayerDependencies(dataLayer: dataLayer)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ import Foundation
class ToolsFilterFeatureDomainLayerDependencies {

private let dataLayer: ToolsFilterFeatureDataLayerDependencies
private let coreDataLayer: AppDataLayerDependencies // TODO: Eventually this needs to be removed as our UseCases in this feature will instead depend on interfaces. ~Levi
private let coreDomainLayer: AppDomainLayerDependencies // TODO: Eventually this needs to be removed as our UseCases in this feature will not need to depend on UseCases. ~Levi

init(dataLayer: ToolsFilterFeatureDataLayerDependencies, coreDataLayer: AppDataLayerDependencies, coreDomainLayer: AppDomainLayerDependencies) {
init(dataLayer: ToolsFilterFeatureDataLayerDependencies) {

self.dataLayer = dataLayer
self.coreDataLayer = coreDataLayer
self.coreDomainLayer = coreDomainLayer
}

func getUserToolFiltersUseCase() -> GetUserToolFiltersUseCase {
Expand Down
1 change: 0 additions & 1 deletion godtools/App/Flows/Tract/TractFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ extension TractFlow {
mobileContentEventAnalytics: appDiContainer.getMobileContentRendererEventAnalyticsTracking(),
getCurrentAppLanguageUseCase: appDiContainer.feature.appLanguage.domainLayer.getCurrentAppLanguageUseCase(),
getTranslatedLanguageName: appDiContainer.dataLayer.getTranslatedLanguageName(),
toolOpenedAnalytics: appDiContainer.getToolOpenedAnalytics(),
liveShareStream: liveShareStream,
initialPage: initialPage,
trainingTipsEnabled: trainingTipsEnabled,
Expand Down
Loading

0 comments on commit 8e1d2db

Please sign in to comment.