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

Analytics plugins - closed: wrong branch #25

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fd82d2f
chore: add push services protocol
rnr Nov 25, 2024
a7b52e0
choreL set protocol public
rnr Nov 26, 2024
2c8a9b6
chore: added DeepLinkManager protocols
rnr Nov 26, 2024
95b9f80
chore: move DeepLinkService protocol back
rnr Nov 26, 2024
5d29858
chore: added func processDeepLink to protocol
rnr Nov 26, 2024
72032b6
chore: added sendable protocol
rnr Dec 9, 2024
eb1de4d
chore: added sendable protocol
rnr Dec 9, 2024
ab08296
chore: added sendable protocol
rnr Dec 26, 2024
3283f2c
chore: deleted DeepLinkManagerProtocol
rnr Dec 26, 2024
0aadd3d
Revert "chore: deleted DeepLinkManagerProtocol"
rnr Dec 26, 2024
fa15242
chore: removed functions from protocol
rnr Dec 26, 2024
fc27a5f
Revert "chore: removed functions from protocol"
rnr Dec 26, 2024
d63206d
chore: set MainActor for protocol
rnr Dec 26, 2024
57b6c05
Merge branch 'main' into anton/plugins-experiments
rnr Dec 30, 2024
537cc2c
chore: add DeepLinkManager protocol mock
rnr Jan 13, 2025
0ef629c
chore: fix warning
rnr Jan 13, 2025
3a4adeb
chore: added public init for DeepLinkManagerProtocolMock
rnr Jan 13, 2025
bf467d9
chore: moved protocol mock to tests
rnr Jan 13, 2025
6a64df7
chore: moved mock to protocol
rnr Jan 13, 2025
924f894
chore: fixed warnings
rnr Jan 13, 2025
41f6906
chore: added Mirror extension
rnr Jan 13, 2025
1d0f294
Revert "chore: added Mirror extension"
rnr Jan 14, 2025
563721c
chore: move some functions for PushNotificationsProvider to extension
rnr Jan 14, 2025
2e9403b
chore: set macos version
rnr Jan 15, 2025
374beef
Revert "chore: set macos version"
rnr Jan 16, 2025
373536d
chore: make extension public
rnr Jan 17, 2025
6592c3d
chore: added extensions
rnr Feb 13, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import Swinject

public protocol AnalyticsService {
public protocol AnalyticsService: Sendable {
func identify(id: String, username: String?, email: String?)
func logEvent(_ event: String, parameters: [String: Any]?)
func logScreenEvent(_ event: String, parameters: [String: Any]?)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// File.swift
// OEXFoundation
//
// Created by Anton Yarmolenka on 26/11/2024.
//

import Foundation
import UIKit

@MainActor
public protocol DeepLinkManagerProtocol: Sendable {
func processLinkFrom(userInfo: [AnyHashable: Any])
func processDeepLink(with params: [AnyHashable: Any]?)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// File.swift
// OEXFoundation
//
// Created by Anton Yarmolenka on 13/01/2025.
//

import Foundation

public class DeepLinkManagerProtocolMock: DeepLinkManagerProtocol {
public var processLinkFromUserInfo: [AnyHashable: Any] = [:]
public var processLinkFromCallsCount: Int = 0

public func processLinkFrom(userInfo: [AnyHashable: Any]) {
processLinkFromCallsCount += 1
processLinkFromUserInfo = userInfo
}

public var processDeepLinkUserInfo: [AnyHashable: Any]?
public var processDeepLinkCallsCount: Int = 0

public func processDeepLink(with params: [AnyHashable: Any]?) {
processDeepLinkCallsCount += 1
processDeepLinkUserInfo = params
}
public init() {}
}
1 change: 1 addition & 0 deletions Sources/OEXFoundation/Extensions/Notification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public extension Notification.Name {
public extension Notification {
enum UserInfoKey: String {
case isForced
case status
}
}
32 changes: 32 additions & 0 deletions Sources/OEXFoundation/Network/Alamofire+Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,35 @@ public extension Error {
}
}
}

public extension Error {
var errorCode: Int {
guard let afError = self.asAFError else {
return (self as NSError).code
}

if let validationError = afError.validationError {
return validationError.statusCode
}

if let code = afError.responseCode {
return code
}

return (self as NSError).code
}

var errorMessage: String {
guard let afError = self.asAFError else {
return (self as NSError).localizedDescription
}

if let validationError = afError.validationError,
let data = validationError.data,
let error = data["error"] as? String {
return error
}

return afError.localizedDescription
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// PushNotificationService.swift
// OpenEdX
//
// Created by Anton Yarmolenka on 22/11/2024.
//

import Foundation

public protocol PushNotificationsProvider: Sendable {
func didRegisterWithDeviceToken(deviceToken: Data)
}

public extension PushNotificationsProvider {
func didFailToRegisterForRemoteNotificationsWithError(error: Error) {}
func synchronizeToken() {}
func refreshToken() {}
}

@MainActor
public protocol PushNotificationsListener: Sendable {
func shouldListenNotification(userinfo: [AnyHashable: Any]) -> Bool
func didReceiveRemoteNotification(userInfo: [AnyHashable: Any])
}
Loading