Skip to content

Commit

Permalink
resolved manual conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shafqat-muneer committed Jul 9, 2024
2 parents b8b3abc + 5f4268c commit 152656a
Show file tree
Hide file tree
Showing 84 changed files with 1,592 additions and 551 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ default_config/
I18N/
*.lproj/
!en.lproj/
/config_script/__pycache__
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import Core

public enum AuthMethod: Equatable {
case password
Expand Down Expand Up @@ -40,6 +41,7 @@ public protocol AuthorizationAnalytics {
func forgotPasswordClicked()
func resetPasswordClicked()
func resetPassword(success: Bool)
func authTrackScreenEvent(_ event: AnalyticsEvent, biValue: EventBIValue)
}

#if DEBUG
Expand All @@ -54,5 +56,6 @@ class AuthorizationAnalyticsMock: AuthorizationAnalytics {
public func forgotPasswordClicked() {}
public func resetPasswordClicked() {}
public func resetPassword(success: Bool) {}
public func authTrackScreenEvent(_ event: AnalyticsEvent, biValue: EventBIValue) {}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ public struct SignInView: View {
.hideNavigationBar()
.ignoresSafeArea(.all, edges: .horizontal)
.background(Theme.Colors.background.ignoresSafeArea(.all))
.onFirstAppear{
viewModel.trackScreenEvent()
}
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,11 @@ public class SignInViewModel: ObservableObject {
func trackForgotPasswordClicked() {
analytics.forgotPasswordClicked()
}


func trackScreenEvent() {
analytics.authTrackScreenEvent(
.logistrationSignIn,
biValue: .logistrationSignIn
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ public struct SignUpView: View {
.ignoresSafeArea(.all, edges: .horizontal)
.background(Theme.Colors.background.ignoresSafeArea(.all))
.hideNavigationBar()
.onFirstAppear{
viewModel.trackScreenEvent()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,11 @@ public class SignUpViewModel: ObservableObject {
func trackCreateAccountClicked() {
analytics.createAccountClicked()
}

func trackScreenEvent() {
analytics.authTrackScreenEvent(
.logistrationRegister,
biValue: .logistrationRegister
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public struct StartupView: View {
.onTapGesture {
UIApplication.shared.endEditing()
}
.onFirstAppear {
viewModel.trackScreenEvent()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ public class StartupViewModel: ObservableObject {
analytics.trackEvent(.logistrationExploreAllCourses, biValue: .logistrationExploreAllCourses)
}
}

func trackScreenEvent() {
analytics.trackScreenEvent(.logistration, biValue: .logistration)
}
}
95 changes: 95 additions & 0 deletions Authorization/AuthorizationTests/AuthorizationMock.generated.swift

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion Core/Core.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@
141F1D302B7328D4009E81EB /* WebviewCookiesUpdateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 141F1D2F2B7328D4009E81EB /* WebviewCookiesUpdateProtocol.swift */; };
142EDD6C2B831D1400F9F320 /* BranchSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 142EDD6B2B831D1400F9F320 /* BranchSDK */; };
14769D3C2B9822EE00AB36D4 /* CoreAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14769D3B2B9822EE00AB36D4 /* CoreAnalytics.swift */; };
14D912D92C2553C70077CCCE /* FullStoryConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14D912D82C2553C70077CCCE /* FullStoryConfig.swift */; };
14D912DB2C257E9E0077CCCE /* FullStoryConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14D912DA2C257E9E0077CCCE /* FullStoryConfigTests.swift */; };
9784D47E2BF7762800AFEFFF /* FullScreenErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9784D47D2BF7762800AFEFFF /* FullScreenErrorView.swift */; };
A51CDBE72B6D21F2009B6D4E /* SegmentConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = A51CDBE62B6D21F2009B6D4E /* SegmentConfig.swift */; };
A53A32352B233DEC005FE38A /* ThemeConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = A53A32342B233DEC005FE38A /* ThemeConfig.swift */; };
Expand Down Expand Up @@ -335,6 +337,8 @@
0E13E9173C9C4CFC19F8B6F2 /* Pods-App-Core.debugstage.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Core.debugstage.xcconfig"; path = "Target Support Files/Pods-App-Core/Pods-App-Core.debugstage.xcconfig"; sourceTree = "<group>"; };
141F1D2F2B7328D4009E81EB /* WebviewCookiesUpdateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebviewCookiesUpdateProtocol.swift; sourceTree = "<group>"; };
14769D3B2B9822EE00AB36D4 /* CoreAnalytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreAnalytics.swift; sourceTree = "<group>"; };
14D912D82C2553C70077CCCE /* FullStoryConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullStoryConfig.swift; sourceTree = "<group>"; };
14D912DA2C257E9E0077CCCE /* FullStoryConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullStoryConfigTests.swift; sourceTree = "<group>"; };
1A154A95AF4EE85A4A1C083B /* Pods-App-Core.releasedev.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Core.releasedev.xcconfig"; path = "Target Support Files/Pods-App-Core/Pods-App-Core.releasedev.xcconfig"; sourceTree = "<group>"; };
2B7E6FE7843FC4CF2BFA712D /* Pods-App-Core.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Core.debug.xcconfig"; path = "Target Support Files/Pods-App-Core/Pods-App-Core.debug.xcconfig"; sourceTree = "<group>"; };
349B90CD6579F7B8D257E515 /* Pods_App_Core.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App_Core.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -867,6 +871,7 @@
02CA59832BD7DDBE00D517AA /* DashboardConfig.swift */,
A53A32342B233DEC005FE38A /* ThemeConfig.swift */,
E0D586192B2FF74C009B4BA7 /* DiscoveryConfig.swift */,
14D912D82C2553C70077CCCE /* FullStoryConfig.swift */,
);
path = Config;
sourceTree = "<group>";
Expand All @@ -884,6 +889,7 @@
children = (
E09179FC2B0F204D002AB695 /* ConfigTests.swift */,
BAD9CA412B2B140100DE790A /* AgreementConfigTests.swift */,
14D912DA2C257E9E0077CCCE /* FullStoryConfigTests.swift */,
);
path = Configuration;
sourceTree = "<group>";
Expand Down Expand Up @@ -1071,6 +1077,7 @@
buildActionMask = 2147483647;
files = (
BAD9CA422B2B140100DE790A /* AgreementConfigTests.swift in Sources */,
14D912DB2C257E9E0077CCCE /* FullStoryConfigTests.swift in Sources */,
E09179FD2B0F204E002AB695 /* ConfigTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1137,6 +1144,7 @@
06078B702BA49C3100576798 /* Dictionary+JSON.swift in Sources */,
9784D47E2BF7762800AFEFFF /* FullScreenErrorView.swift in Sources */,
027BD3AE2909475000392132 /* KeyboardScrollerOptions.swift in Sources */,
14D912D92C2553C70077CCCE /* FullStoryConfig.swift in Sources */,
BAFB99922B14E23D007D09F9 /* AppleSignInConfig.swift in Sources */,
141F1D302B7328D4009E81EB /* WebviewCookiesUpdateProtocol.swift in Sources */,
064987992B4D69FF0071642A /* WebViewScriptInjectionProtocol.swift in Sources */,
Expand Down Expand Up @@ -1223,7 +1231,6 @@
02F164372902A9EB0090DDEF /* StringExtension.swift in Sources */,
0231CDBE2922422D00032416 /* CSSInjector.swift in Sources */,
064987982B4D69FF0071642A /* CSSInjectionProtocol.swift in Sources */,
BAAD62C62AFCF00B000E6103 /* CustomDisclosureGroup.swift in Sources */,
029EE3ED2BF6650500F64F33 /* Bundle.swift in Sources */,
BADB3F5B2AD6EC56004D5CFA /* ResultExtension.swift in Sources */,
0236961928F9A26900EEF206 /* AuthRepository.swift in Sources */,
Expand Down
20 changes: 20 additions & 0 deletions Core/Core/Analytics/CoreAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Foundation
public protocol CoreAnalytics {
func trackEvent(_ event: AnalyticsEvent, parameters: [String: Any]?)
func trackEvent(_ event: AnalyticsEvent, biValue: EventBIValue, parameters: [String: Any]?)
func trackScreenEvent(_ event: AnalyticsEvent, parameters: [String: Any]?)
func trackScreenEvent(_ event: AnalyticsEvent, biValue: EventBIValue, parameters: [String: Any]?)
func appreview(_ event: AnalyticsEvent, biValue: EventBIValue, action: String?, rating: Int?)
func videoQualityChanged(
_ event: AnalyticsEvent,
Expand All @@ -28,13 +30,23 @@ public extension CoreAnalytics {
func trackEvent(_ event: AnalyticsEvent, biValue: EventBIValue) {
trackEvent(event, biValue: biValue, parameters: nil)
}

func trackScreenEvent(_ event: AnalyticsEvent) {
trackScreenEvent(event, parameters: nil)
}

func trackScreenEvent(_ event: AnalyticsEvent, biValue: EventBIValue) {
trackScreenEvent(event, biValue: biValue, parameters: nil)
}
}

#if DEBUG
public class CoreAnalyticsMock: CoreAnalytics {
public init() {}
public func trackEvent(_ event: AnalyticsEvent, parameters: [String: Any]? = nil) {}
public func trackEvent(_ event: AnalyticsEvent, biValue: EventBIValue, parameters: [String: Any]?) {}
public func trackScreenEvent(_ event: AnalyticsEvent, parameters: [String: Any]?) {}
public func trackScreenEvent(_ event: AnalyticsEvent, biValue: EventBIValue, parameters: [String: Any]?) {}
public func appreview(_ event: AnalyticsEvent, biValue: EventBIValue, action: String? = nil, rating: Int? = 0) {}
public func videoQualityChanged(
_ event: AnalyticsEvent,
Expand Down Expand Up @@ -124,6 +136,10 @@ public enum AnalyticsEvent: String {
case whatnewPopup = "WhatsNew:Pop up Viewed"
case whatnewDone = "WhatsNew:Done"
case whatnewClose = "WhatsNew:Close"
case logistration = "Logistration"
case logistrationSignIn = "Logistration:Sign In"
case logistrationRegister = "Logistration:Register"
case profileEdit = "Profile:Edit Profile"
}

public enum EventBIValue: String {
Expand Down Expand Up @@ -205,6 +221,10 @@ public enum EventBIValue: String {
case whatnewPopup = "edx.bi.app.whats_new.popup.viewed"
case whatnewDone = "edx.bi.app.whats_new.done"
case whatnewClose = "edx.bi.app.whats_new.close"
case logistration = "edx.bi.app.logistration"
case logistrationSignIn = "edx.bi.app.logistration.signin"
case logistrationRegister = "edx.bi.app.logistration.register"
case profileEdit = "edx.bi.app.profile.edit"
}

public struct EventParamKey {
Expand Down
1 change: 1 addition & 0 deletions Core/Core/Configuration/Config/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public protocol ConfigProtocol {
var segment: SegmentConfig { get }
var program: DiscoveryConfig { get }
var URIScheme: String { get }
var fullStory: FullStoryConfig { get }
}

public enum TokenType: String {
Expand Down
30 changes: 30 additions & 0 deletions Core/Core/Configuration/Config/FullStoryConfig.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// FullStoryConfig.swift
// Core
//
// Created by Saeed Bashir on 6/21/24.
//

import Foundation

private enum Keys: String, RawStringExtractable {
case enabled = "ENABLED"
case orgID = "ORG_ID"
}

public final class FullStoryConfig {
public var enabled: Bool = false
public var orgID: String = ""

init(dictionary: [String: AnyObject]) {
orgID = dictionary[Keys.orgID] as? String ?? ""
enabled = !orgID.isEmpty && dictionary[Keys.enabled] as? Bool ?? false
}
}

private let configKey = "FULLSTORY"
extension Config {
public var fullStory: FullStoryConfig {
FullStoryConfig(dictionary: self[configKey] as? [String: AnyObject] ?? [:])
}
}
11 changes: 5 additions & 6 deletions Core/Core/Data/Persistence/CorePersistenceProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ public protocol CorePersistenceProtocol {
func set(userId: Int)
func getUserID() -> Int?
func publisher() -> AnyPublisher<Int, Never>
func addToDownloadQueue(blocks: [CourseBlock], downloadQuality: DownloadQuality)
func nextBlockForDownloading() -> DownloadDataTask?
func addToDownloadQueue(blocks: [CourseBlock], downloadQuality: DownloadQuality) async
func nextBlockForDownloading() async -> DownloadDataTask?
func updateDownloadState(id: String, state: DownloadState, resumeData: Data?)
func deleteDownloadDataTask(id: String) throws
func deleteDownloadDataTask(id: String) async throws
func saveDownloadDataTask(_ task: DownloadDataTask)
func downloadDataTask(for blockId: String) -> DownloadDataTask?
func downloadDataTask(for blockId: String, completion: @escaping (DownloadDataTask?) -> Void)
func getDownloadDataTasks(completion: @escaping ([DownloadDataTask]) -> Void)
func getDownloadDataTasksForCourse(_ courseId: String, completion: @escaping ([DownloadDataTask]) -> Void)
func getDownloadDataTasks() async -> [DownloadDataTask]
func getDownloadDataTasksForCourse(_ courseId: String) async -> [DownloadDataTask]
}

public final class CoreBundle {
Expand Down
Loading

0 comments on commit 152656a

Please sign in to comment.