Skip to content

Commit

Permalink
Merge pull request #2326 from CruGlobal/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
levieggertcru authored Nov 5, 2024
2 parents bfea3d3 + 6999ad7 commit 1f6c7cf
Show file tree
Hide file tree
Showing 24 changed files with 144 additions and 115 deletions.
20 changes: 11 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ GEM
base64
nkf
rexml
activesupport (7.2.1.2)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
Expand All @@ -24,8 +25,8 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.992.0)
aws-sdk-core (3.210.0)
aws-partitions (1.999.0)
aws-sdk-core (3.211.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
Expand All @@ -37,16 +38,17 @@ GEM
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.0)
aws-sigv4 (1.10.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
benchmark (0.3.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.16.1)
cocoapods (1.16.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.16.1)
cocoapods-core (= 1.16.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -60,8 +62,8 @@ GEM
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.26.0, < 2.0)
cocoapods-core (1.16.1)
xcodeproj (>= 1.27.0, < 2.0)
cocoapods-core (1.16.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand Down Expand Up @@ -292,7 +294,7 @@ GEM
xcode-install (2.8.1)
claide (>= 0.9.1)
fastlane (>= 2.1.0, < 3.0.0)
xcodeproj (1.26.0)
xcodeproj (1.27.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand Down
11 changes: 8 additions & 3 deletions godtools/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
appConfig: appConfig,
infoPlist: infoPlist,
realmDatabase: realmDatabase,
appMessagingEnabled: launchEnvironmentReader.getAppMessagingIsEnabled() ?? true
firebaseEnabled: firebaseEnabled
)
}()

Expand All @@ -56,6 +56,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}()

private var toolShortcutLinks: ToolShortcutLinksView?
private var firebaseEnabled: Bool {
return launchEnvironmentReader.getFirebaseEnabled() ?? true
}

var window: UIWindow?

Expand All @@ -74,8 +77,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if appBuild.configuration == .analyticsLogging {
appDiContainer.getFirebaseDebugArguments().enable()
}

appDiContainer.getFirebaseConfiguration().configure()

if firebaseEnabled {
appDiContainer.getFirebaseConfiguration().configure()
}

if appBuild.configuration == .release {
GodToolsParserLogger.shared.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class AppDataLayerDependencies {
private let sharedIgnoreCacheSession: IgnoreCacheSession = IgnoreCacheSession()
private let sharedUserDefaultsCache: SharedUserDefaultsCache = SharedUserDefaultsCache()
private let sharedAnalytics: AnalyticsContainer
private let appMessagingEnabled: Bool
private let firebaseEnabled: Bool

init(appBuild: AppBuild, appConfig: AppConfig, infoPlist: InfoPlist, realmDatabase: RealmDatabase, appMessagingEnabled: Bool) {
init(appBuild: AppBuild, appConfig: AppConfig, infoPlist: InfoPlist, realmDatabase: RealmDatabase, firebaseEnabled: Bool) {

sharedAppBuild = appBuild
sharedAppConfig = appConfig
sharedInfoPlist = infoPlist
sharedRealmDatabase = realmDatabase
self.appMessagingEnabled = appMessagingEnabled
self.firebaseEnabled = firebaseEnabled

sharedAnalytics = AnalyticsContainer(
appsFlyerAnalytics: AppsFlyerAnalytics(appsFlyer: AppsFlyer.shared, loggingEnabled: appBuild.configuration == .analyticsLogging),
Expand Down Expand Up @@ -57,7 +57,7 @@ class AppDataLayerDependencies {

func getAppMessaging() -> AppMessagingInterface {

guard appMessagingEnabled else {
guard firebaseEnabled else {
return DisabledInAppMessaging()
}

Expand Down
4 changes: 2 additions & 2 deletions godtools/App/DependencyContainer/AppDiContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AppDiContainer {
let domainLayer: AppDomainLayerDependencies
let feature: AppFeatureDiContainer

init(appBuild: AppBuild, appConfig: AppConfig, infoPlist: InfoPlist, realmDatabase: RealmDatabase, appMessagingEnabled: Bool) {
init(appBuild: AppBuild, appConfig: AppConfig, infoPlist: InfoPlist, realmDatabase: RealmDatabase, firebaseEnabled: Bool) {

self.appBuild = appBuild
self.realmDatabase = realmDatabase
Expand All @@ -29,7 +29,7 @@ class AppDiContainer {
appConfig: appConfig,
infoPlist: infoPlist,
realmDatabase: realmDatabase,
appMessagingEnabled: appMessagingEnabled
firebaseEnabled: firebaseEnabled
)

domainLayer = AppDomainLayerDependencies(dataLayer: dataLayer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,18 @@ import Combine

struct DashboardView_Previews: PreviewProvider {

private static let diContainer: AppDiContainer = SwiftUIPreviewDiContainer().getAppDiContainer()
private static let flowDelegate: FlowDelegate = MockFlowDelegate()
private static let dashboardDependencies: DashboardPresentationLayerDependencies = DashboardPresentationLayerDependencies(appDiContainer: Self.diContainer, flowDelegate: Self.flowDelegate)

static func getDashboardViewModel() -> DashboardViewModel {

let appDiContainer: AppDiContainer = SwiftUIPreviewDiContainer().getAppDiContainer()
let appDiContainer: AppDiContainer = Self.diContainer

let viewModel = DashboardViewModel(
startingTab: .favorites,
flowDelegate: MockFlowDelegate(),
dashboardPresentationLayerDependencies: DashboardPresentationLayerDependencies(appDiContainer: appDiContainer, flowDelegate: MockFlowDelegate()),
flowDelegate: Self.flowDelegate,
dashboardPresentationLayerDependencies: Self.dashboardDependencies,
getCurrentAppLanguageUseCase: appDiContainer.feature.appLanguage.domainLayer.getCurrentAppLanguageUseCase(),
viewDashboardUseCase: appDiContainer.feature.dashboard.domainLayer.getViewDashboardUseCase(),
dashboardTabObserver: CurrentValueSubject(.favorites)
Expand All @@ -118,6 +122,6 @@ struct DashboardView_Previews: PreviewProvider {

static var previews: some View {

DashboardView(viewModel: DashboardView_Previews.getDashboardViewModel())
DashboardView(viewModel: Self.getDashboardViewModel())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,20 @@ class ChooseYourOwnAdventureFlow: ToolNavigationFlow, ToolSettingsNavigationFlow
var tractFlow: TractFlow?
var downloadToolTranslationFlow: DownloadToolTranslationsFlow?

init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentPagesPage?, selectedLanguageIndex: Int?) {
init(flowDelegate: FlowDelegate, appDiContainer: AppDiContainer, sharedNavigationController: AppNavigationController, appLanguage: AppLanguageDomainModel, toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentPagesPage?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool) {

self.flowDelegate = flowDelegate
self.appDiContainer = appDiContainer
self.navigationController = sharedNavigationController
self.appLanguage = appLanguage

sharedNavigationController.pushViewController(
getChooseYourOwnAdventureView(toolTranslations: toolTranslations, initialPage: initialPage, selectedLanguageIndex: selectedLanguageIndex),
getChooseYourOwnAdventureView(
toolTranslations: toolTranslations,
initialPage: initialPage,
selectedLanguageIndex: selectedLanguageIndex,
trainingTipsEnabled: trainingTipsEnabled
),
animated: true
)
}
Expand Down Expand Up @@ -71,7 +76,7 @@ class ChooseYourOwnAdventureFlow: ToolNavigationFlow, ToolSettingsNavigationFlow

extension ChooseYourOwnAdventureFlow {

private func getChooseYourOwnAdventureView(toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentPagesPage?, selectedLanguageIndex: Int?) -> UIViewController {
private func getChooseYourOwnAdventureView(toolTranslations: ToolTranslationsDomainModel, initialPage: MobileContentPagesPage?, selectedLanguageIndex: Int?, trainingTipsEnabled: Bool) -> UIViewController {

let navigation: MobileContentRendererNavigation = appDiContainer.getMobileContentRendererNavigation(
parentFlow: self,
Expand All @@ -97,7 +102,7 @@ extension ChooseYourOwnAdventureFlow {
mobileContentEventAnalytics: appDiContainer.getMobileContentRendererEventAnalyticsTracking(),
getCurrentAppLanguageUseCase: appDiContainer.feature.appLanguage.domainLayer.getCurrentAppLanguageUseCase(),
getTranslatedLanguageName: appDiContainer.dataLayer.getTranslatedLanguageName(),
trainingTipsEnabled: false,
trainingTipsEnabled: trainingTipsEnabled,
incrementUserCounterUseCase: appDiContainer.domainLayer.getIncrementUserCounterUseCase(),
selectedLanguageIndex: selectedLanguageIndex
)
Expand Down
3 changes: 2 additions & 1 deletion godtools/App/Flows/ToolNavigation/ToolNavigationFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ extension ToolNavigationFlow {
appLanguage: appLanguage,
toolTranslations: toolTranslations,
initialPage: initialPage,
selectedLanguageIndex: selectedLanguageIndex
selectedLanguageIndex: selectedLanguageIndex,
trainingTipsEnabled: trainingTipsEnabled
)

case .metaTool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SwiftUIPreviewDiContainer {
appConfig: AppConfig(appBuild: appBuild),
infoPlist: InfoPlist(),
realmDatabase: SwiftUIPreviewDiContainer.previewDatabase,
appMessagingEnabled: false
firebaseEnabled: false
)
}
}
14 changes: 2 additions & 12 deletions godtools/App/Services/Analytics/AppsFlyer/AppsFlyerAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ class AppsFlyerAnalytics: NSObject {
func trackAppLaunch() {

serialQueue.async { [weak self] in

self?.assertFailureIfNotConfigured()


self?.appsFlyer.appsFlyerLib.start()

self?.log(method: "trackAppLaunch()", label: nil, labelValue: nil, data: nil)
Expand All @@ -60,20 +58,12 @@ class AppsFlyerAnalytics: NSObject {
func trackAction(actionName: String, data: [String: Any]?) {

serialQueue.async { [weak self] in

self?.assertFailureIfNotConfigured()


self?.appsFlyer.appsFlyerLib.logEvent(actionName, withValues: data)
self?.log(method: "trackEvent()", label: "eventName", labelValue: actionName, data: data)
}
}

private func assertFailureIfNotConfigured() {
if !isConfigured {
assertionFailure("AppsFlyer has not been configured. Call configure() on application didFinishLaunching.")
}
}

private func log(method: String, label: String?, labelValue: String?, data: [String: Any]?) {

if loggingEnabled {
Expand Down
12 changes: 1 addition & 11 deletions godtools/App/Services/Analytics/Firebase/FirebaseAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class FirebaseAnalytics {
}

func setLoggedInStateUserProperties(isLoggedIn: Bool, loggedInUserProperties: FirebaseAnalyticsLoggedInUserProperties?) {
assertFailureIfNotConfigured()

let userId: String? = loggedInUserProperties?.grMasterPersonId ?? loggedInUserProperties?.ssoguid

Expand Down Expand Up @@ -104,16 +103,8 @@ class FirebaseAnalytics {
)
}

private func assertFailureIfNotConfigured() {
if !isConfigured {
assertionFailure("FirebaseAnalytics has not been configured. Call configure() on application didFinishLaunching.")
}
}

private func internalTrackEvent(screenName: String?, siteSection: String?, siteSubSection: String?, appLanguage: String?, contentLanguage: String?, secondaryContentLanguage: String?, previousScreenName: String, eventName: String, data: [String: Any]?) {

assertFailureIfNotConfigured()


DispatchQueue.global().async { [weak self] in

guard let firebaseAnalytics = self else {
Expand Down Expand Up @@ -176,7 +167,6 @@ class FirebaseAnalytics {
}

private func createBaseProperties(screenName: String?, siteSection: String?, siteSubSection: String?, appLanguage: String?, contentLanguage: String?, secondaryContentLanguage: String?, previousScreenName: String?) -> [String: String] {
assertFailureIfNotConfigured()

var properties: [String: String] = [:]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ class MobileContentRendererPageViewFactories: MobileContentPageViewFactoryType {
mobileContentAnalytics: mobileContentAnalytics
)

pageViewFactories = [chooseYourOwnAdventureViewFactory]
let trainingViewFactory: TrainingViewFactory = TrainingViewFactory(
mobileContentAnalytics: mobileContentAnalytics,
getTrainingTipCompletedUseCase: getTrainingTipCompletedUseCase
)

pageViewFactories = [chooseYourOwnAdventureViewFactory, trainingViewFactory]

case .lesson:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ enum LaunchEnvironmentKey: String {
return rawValue
}

case appMessagingIsEnabled
case firebaseEnabled
case urlDeeplink
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class LaunchEnvironmentReader {
return LaunchEnvironmentReader(launchEnvironment: ProcessInfo.processInfo.environment)
}

func getAppMessagingIsEnabled() -> Bool? {
func getFirebaseEnabled() -> Bool? {

guard let stringBool = launchEnvironment[LaunchEnvironmentKey.appMessagingIsEnabled.value] else {
guard let stringBool = launchEnvironment[LaunchEnvironmentKey.firebaseEnabled.value] else {
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class LaunchEnvironmentWriter {

}

func setAppMessagingIsEnabled(launchEnvironment: inout [String: String], enabled: Bool) {
launchEnvironment[LaunchEnvironmentKey.appMessagingIsEnabled.value] = String(enabled)
func setFirebaseEnabled(launchEnvironment: inout [String: String], enabled: Bool) {
launchEnvironment[LaunchEnvironmentKey.firebaseEnabled.value] = String(enabled)
}

func setUrlDeepLink(launchEnvironment: inout [String: String], url: String) {
Expand Down
7 changes: 0 additions & 7 deletions godtools/App/Share/Data/AppsFlyer/AppsFlyer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,9 @@ class AppsFlyer {
}

var appsFlyerLib: AppsFlyerLib {
assertFailureIfNotConfigured()
return sharedAppsFlyerLib
}

private func assertFailureIfNotConfigured() {
if !isConfigured {
assertionFailure("AppsFlyer has not been configured. Be sure to call configure on application didFinishLaunching.")
}
}

func configure(configuration: AppsFlyerConfiguration, deepLinkDelegate: DeepLinkDelegate) {

guard !isConfigured else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestsDiContainer: AppDiContainer {
appConfig: appConfig,
infoPlist: InfoPlist(),
realmDatabase: realmDatabase,
appMessagingEnabled: false
firebaseEnabled: false
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class GetSpiritualConversationReadinessScaleTests: QuickSpec {
}
}

// NOTE: Disabling this test since failing in iOS 18. For some reason NumberFormatter and String format based on Locale isn't working with iOS 18 and iOS 18.1. See GT-2473. ~Levi

/*
context("When viewing the ready to share faith scale and my app language is arabic.") {

let getSpiritualConversationReadinessScale = GetSpiritualConversationReadinessScale(
Expand Down Expand Up @@ -146,7 +149,7 @@ class GetSpiritualConversationReadinessScaleTests: QuickSpec {
expect(readinessScaleRef?.maxScale.valueTranslatedInAppLanguage).to(equal("١٠"))
expect(readinessScaleRef?.scale.valueTranslatedInAppLanguage).to(equal("٥"))
}
}
}*/

context("When providing a scale value that is lower than the minimum 1.") {

Expand Down
Loading

0 comments on commit 1f6c7cf

Please sign in to comment.