Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into master for new QA release #2410

Merged
merged 15 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/firebase.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Distribute To Firebase

on:
push:
branches: [ master ]
# Will only distribute manually for now. ~Levi
# on:
# push:
# branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1035.0)
aws-sdk-core (3.215.0)
aws-partitions (1.1040.0)
aws-sdk-core (3.216.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.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (1.97.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.177.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-s3 (1.178.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.11.0)
Expand Down Expand Up @@ -86,7 +86,7 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.3.4)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
declarative (0.0.20)
digest-crc (0.6.5)
Expand Down Expand Up @@ -228,7 +228,7 @@ GEM
http-cookie (1.0.8)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.14.6)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.9.1)
Expand Down
210 changes: 137 additions & 73 deletions godtools.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions godtools.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "46c3e5d6b619464f81f8c9a21f423fede21a2c1aee05c005c799696c1132e668",
"originHash" : "a0be7c04d04795109cee91897335f98e419cba46dc747a64041fe1b9e6ea1b3b",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand All @@ -15,8 +15,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "3b62f154d00019ae29a71e9738800bb6f18b236d",
"version" : "10.19.2"
"revision" : "61b85103a1aeed8218f17c794687781505fbbef5",
"version" : "11.2.0"
}
},
{
Expand Down Expand Up @@ -60,8 +60,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "42eae77a0af79e9c3f41df04a23c76f05cfdda77",
"version" : "10.24.0"
"revision" : "0d885d28250fb1196b614bc9455079b75c531f72",
"version" : "11.7.0"
}
},
{
Expand All @@ -78,17 +78,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "51ba746a9d51a4bd0774b68499b0c73ef6e8570d",
"version" : "10.24.0"
"revision" : "be0881ff728eca210ccb628092af400c086abda3",
"version" : "11.7.0"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "a637d318ae7ae246b02d7305121275bc75ed5565",
"version" : "9.4.0"
"revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
"version" : "10.1.0"
}
},
{
Expand All @@ -105,17 +105,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "57a1d307f42df690fdef2637f3e5b776da02aad6",
"version" : "7.13.3"
"revision" : "53156c7ec267db846e6b64c9f4c4e31ba4cf75eb",
"version" : "8.0.2"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "e9fad491d0673bdda7063a0341fb6b47a30c5359",
"version" : "1.62.2"
"revision" : "f56d8fc3162de9a498377c7b6cea43431f4f5083",
"version" : "1.65.1"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ class AppDataLayerDependencies {
)
}

func getRemoteConfigRepository() -> RemoteConfigRepository {

return RemoteConfigRepository(
remoteDatabase: firebaseEnabled ? FirebaseRemoteConfigWrapper() : DisabledRemoteConfigDatabase()
)
}

func getResourcesFileCache() -> ResourcesSHA256FileCache {
return ResourcesSHA256FileCache(realmDatabase: sharedRealmDatabase)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// GetGlobalActivityIsEnabled.swift
// godtools
//
// Created by Levi Eggert on 1/15/25.
// Copyright © 2025 Cru. All rights reserved.
//

import Foundation
import Combine

class GetGlobalActivityIsEnabled: GetGlobalActivityIsEnabledInterface {

private let remoteConfigRepository: RemoteConfigRepository

init(remoteConfigRepository: RemoteConfigRepository) {

self.remoteConfigRepository = remoteConfigRepository
}

func getIsEnabledPublisher() -> AnyPublisher<Bool, Never> {

return remoteConfigRepository
.getRemoteConfigPublisher()
.map { (dataModel: RemoteConfigDataModel?) in
return dataModel?.globalActivityIsEnabled ?? false
}
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class GlobalActivityDataLayerDependencies {

// MARK: - Domain Interface

func getGlobalActivityIsEnabled() -> GetGlobalActivityIsEnabledInterface {
return GetGlobalActivityIsEnabled(
remoteConfigRepository: coreDataLayer.getRemoteConfigRepository()
)
}

func getGlobalActivityThisWeekRepository() -> GetGlobalActivityThisWeekRepositoryInterface {

return GetGlobalActivityThisWeekRepository(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ class GlobalActivityDomainLayerDependencies {
self.dataLayer = dataLayer
}

func getGlobalActivityEnabledUseCase() -> GetGlobalActivityEnabledUseCase {
return GetGlobalActivityEnabledUseCase(
getGlobalActivityIsEnabled: dataLayer.getGlobalActivityIsEnabled()
)
}

func getViewGlobalActivityThisWeekUseCase() -> ViewGlobalActivityThisWeekUseCase {

return ViewGlobalActivityThisWeekUseCase(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// GetGlobalActivityIsEnabledInterface.swift
// godtools
//
// Created by Levi Eggert on 1/15/25.
// Copyright © 2025 Cru. All rights reserved.
//

import Foundation
import Combine

protocol GetGlobalActivityIsEnabledInterface {

func getIsEnabledPublisher() -> AnyPublisher<Bool, Never>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// GetGlobalActivityEnabledUseCase.swift
// godtools
//
// Created by Levi Eggert on 1/15/25.
// Copyright © 2025 Cru. All rights reserved.
//

import Foundation
import Combine

class GetGlobalActivityEnabledUseCase {

private let getGlobalActivityIsEnabled: GetGlobalActivityIsEnabledInterface

init(getGlobalActivityIsEnabled: GetGlobalActivityIsEnabledInterface) {

self.getGlobalActivityIsEnabled = getGlobalActivityIsEnabled
}

func getIsEnabledPublisher() -> AnyPublisher<Bool, Never> {

return getGlobalActivityIsEnabled.getIsEnabledPublisher()
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ struct AccountView_Preview: PreviewProvider {
getUserActivityUseCase: appDiContainer.domainLayer.getUserActivityUseCase(),
viewGlobalActivityThisWeekUseCase: appDiContainer.feature.globalActivity.domainLayer.getViewGlobalActivityThisWeekUseCase(),
trackScreenViewAnalyticsUseCase: appDiContainer.domainLayer.getTrackScreenViewAnalyticsUseCase(),
viewAccountUseCase: appDiContainer.domainLayer.getViewAccountUseCase()
viewAccountUseCase: appDiContainer.domainLayer.getViewAccountUseCase(),
getGlobalActivityEnabledUseCase: appDiContainer.feature.globalActivity.domainLayer.getGlobalActivityEnabledUseCase()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AccountViewModel: ObservableObject {
private let viewGlobalActivityThisWeekUseCase: ViewGlobalActivityThisWeekUseCase
private let trackScreenViewAnalyticsUseCase: TrackScreenViewAnalyticsUseCase
private let viewAccountUseCase: ViewAccountUseCase
private let getGlobalActivityEnabledUseCase: GetGlobalActivityEnabledUseCase

private var cancellables: Set<AnyCancellable> = Set()

Expand All @@ -27,6 +28,8 @@ class AccountViewModel: ObservableObject {
@Published private var appLanguage: AppLanguageDomainModel = LanguageCodeDomainModel.english.value
@Published private var didPullToRefresh: Void = ()

@Published private(set) var globalActivityIsEnabled: Bool = false

@Published var navTitle: String = ""
@Published var isLoadingProfile: Bool = true
@Published var isLoadingGlobalActivityThisWeek: Bool = true
Expand All @@ -41,7 +44,7 @@ class AccountViewModel: ObservableObject {
@Published var globalActivitiesThisWeek: [GlobalActivityThisWeekDomainModel] = Array()
@Published var stats = [UserActivityStatDomainModel]()

init(flowDelegate: FlowDelegate, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getUserAccountDetailsUseCase: GetUserAccountDetailsUseCase, getUserActivityUseCase: GetUserActivityUseCase, viewGlobalActivityThisWeekUseCase: ViewGlobalActivityThisWeekUseCase, trackScreenViewAnalyticsUseCase: TrackScreenViewAnalyticsUseCase, viewAccountUseCase: ViewAccountUseCase) {
init(flowDelegate: FlowDelegate, getCurrentAppLanguageUseCase: GetCurrentAppLanguageUseCase, getUserAccountDetailsUseCase: GetUserAccountDetailsUseCase, getUserActivityUseCase: GetUserActivityUseCase, viewGlobalActivityThisWeekUseCase: ViewGlobalActivityThisWeekUseCase, trackScreenViewAnalyticsUseCase: TrackScreenViewAnalyticsUseCase, viewAccountUseCase: ViewAccountUseCase, getGlobalActivityEnabledUseCase: GetGlobalActivityEnabledUseCase) {

self.flowDelegate = flowDelegate
self.getCurrentAppLanguageUseCase = getCurrentAppLanguageUseCase
Expand All @@ -50,6 +53,7 @@ class AccountViewModel: ObservableObject {
self.getUserActivityUseCase = getUserActivityUseCase
self.trackScreenViewAnalyticsUseCase = trackScreenViewAnalyticsUseCase
self.viewAccountUseCase = viewAccountUseCase
self.getGlobalActivityEnabledUseCase = getGlobalActivityEnabledUseCase

getCurrentAppLanguageUseCase
.getLanguagePublisher()
Expand Down Expand Up @@ -129,6 +133,11 @@ class AccountViewModel: ObservableObject {
self?.stats = userActivity.stats
}
.store(in: &cancellables)

getGlobalActivityEnabledUseCase
.getIsEnabledPublisher()
.receive(on: DispatchQueue.main)
.assign(to: &$globalActivityIsEnabled)
}

deinit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ struct AccountSectionsView: View {
static let sectionTitleFont: Font = FontLibrary.sfProTextRegular.font(size: 22)
static let sectionTitleColor: Color = ColorPalette.gtGrey.color

private let sections: [AccountSectionType] = [.activity, .globalActivity]
private let sectionHorizontalPadding: CGFloat = 20

@State private var selectedSegmentIndex: Int = 0
Expand All @@ -28,11 +27,24 @@ struct AccountSectionsView: View {
self.geometry = geometry
}

private var accountSections: [AccountSectionType] {

var accountSections: [AccountSectionType] = Array()

accountSections.append(.activity)

if viewModel.globalActivityIsEnabled {
accountSections.append(.globalActivity)
}

return accountSections
}

var body: some View {

let sectionFrameWidth: CGFloat = geometry.size.width - (sectionHorizontalPadding * 2)

let segmentTitles: [String] = sections.map({
let segmentTitles: [String] = accountSections.map({
switch $0 {
case .activity:
return viewModel.activityButtonTitle
Expand All @@ -49,7 +61,7 @@ struct AccountSectionsView: View {

SegmentControl(selectedIndex: $selectedSegmentIndex, segments: segmentTitles, segmentTappedClosure: { (index: Int) in

switch sections[selectedSegmentIndex] {
switch accountSections[selectedSegmentIndex] {
case .activity:
viewModel.activityViewed()
case .globalActivity:
Expand All @@ -66,7 +78,7 @@ struct AccountSectionsView: View {

VStack(alignment: .leading, spacing: 0) {

switch sections[selectedSegmentIndex] {
switch accountSections[selectedSegmentIndex] {

case .activity:

Expand All @@ -86,7 +98,7 @@ struct AccountSectionsView: View {
.frame(width: sectionFrameWidth, alignment: .leading)
.padding(EdgeInsets(top: 20, leading: sectionHorizontalPadding, bottom: 20, trailing: sectionHorizontalPadding))
.onAppear {
switch sections[selectedSegmentIndex] {
switch accountSections[selectedSegmentIndex] {
case .activity:
viewModel.activityViewed()
case .globalActivity:
Expand Down
9 changes: 9 additions & 0 deletions godtools/App/Flows/App/AppFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AppFlow: NSObject, ToolNavigationFlow, Flow {

private static let defaultStartingDashboardTab: DashboardTabTypeDomainModel = .favorites

private let remoteConfigRepository: RemoteConfigRepository
private let resourcesRepository: ResourcesRepository
private let toolLanguageDownloader: ToolLanguageDownloader
private let followUpsService: FollowUpsService
Expand Down Expand Up @@ -61,6 +62,7 @@ class AppFlow: NSObject, ToolNavigationFlow, Flow {

self.appDiContainer = appDiContainer
self.navigationController = AppNavigationController(navigationBarAppearance: navigationBarAppearance)
self.remoteConfigRepository = appDiContainer.dataLayer.getRemoteConfigRepository()
self.resourcesRepository = appDiContainer.dataLayer.getResourcesRepository()
self.toolLanguageDownloader = appDiContainer.feature.appLanguage.dataLayer.getToolLanguageDownloader()
self.followUpsService = appDiContainer.dataLayer.getFollowUpsService()
Expand Down Expand Up @@ -488,6 +490,13 @@ extension AppFlow {

} receiveValue: { authUser in

}
.store(in: &cancellables)

remoteConfigRepository
.syncDataPublisher()
.sink { _ in

}
.store(in: &cancellables)
}
Expand Down
3 changes: 2 additions & 1 deletion godtools/App/Flows/Menu/MenuFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ extension MenuFlow {
getUserActivityUseCase: appDiContainer.domainLayer.getUserActivityUseCase(),
viewGlobalActivityThisWeekUseCase: appDiContainer.feature.globalActivity.domainLayer.getViewGlobalActivityThisWeekUseCase(),
trackScreenViewAnalyticsUseCase: appDiContainer.domainLayer.getTrackScreenViewAnalyticsUseCase(),
viewAccountUseCase: appDiContainer.domainLayer.getViewAccountUseCase()
viewAccountUseCase: appDiContainer.domainLayer.getViewAccountUseCase(),
getGlobalActivityEnabledUseCase: appDiContainer.feature.globalActivity.domainLayer.getGlobalActivityEnabledUseCase()
)

let view = AccountView(viewModel: viewModel)
Expand Down
Loading
Loading