Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5ec6c32
[ABRSDK-4375] refactor(concurrency): use Swift 6
minjae999 Aug 21, 2026
eb6af84
[ABRSDK-4375] refactor(promise): harden state
minjae999 Aug 21, 2026
01955ff
[ABRSDK-4375] refactor(contract): simplify state
minjae999 Aug 21, 2026
b4abbb5
[ABRSDK-4375] refactor(esc): require Sendable
minjae999 Aug 21, 2026
9c3b269
[ABRSDK-4375] refactor(storage): require Sendable
minjae999 Aug 21, 2026
ccbaee3
[ABRSDK-4375] refactor(storage): simplify concurrency
minjae999 Aug 21, 2026
b94e581
[ABRSDK-4375] refactor: serialize file storage
minjae999 Aug 24, 2026
9e5f505
[ABRSDK-4375] refactor: remove Atomic
minjae999 Aug 24, 2026
f333254
[ABRSDK-4375] refactor: make data Sendable
minjae999 Aug 24, 2026
e91b2f1
[ABRSDK-4375] refactor: bridge tasks to promises
minjae999 Aug 24, 2026
420e895
[ABRSDK-4375] refactor: bridge promises to async
minjae999 Aug 24, 2026
fbd226e
[ABRSDK-4375] refactor: isolate preference
minjae999 Aug 24, 2026
885b190
[ABRSDK-4375] refactor: simplify concurrency
minjae999 Aug 25, 2026
40b87ce
[ABRSDK-4375] refactor: remove unused APIs
minjae999 Aug 25, 2026
455eb11
[ABRSDK-4375] test: migrate to Swift Testing
minjae999 Aug 25, 2026
d0ea66e
[ABRSDK-4375] refactor(apple): support platforms
minjae999 Aug 25, 2026
84dc702
[ABRSDK-4375] refactor(time): add Sendable
minjae999 Aug 25, 2026
20bec06
[ABRSDK-4375] refactor(timestamp): add Sendable
minjae999 Aug 25, 2026
186716e
[ABRSDK-4375] feature: add async Contract then
minjae999 Aug 27, 2026
e4c2e8a
[ABRSDK-4375] feature: add Contract stream
minjae999 Aug 27, 2026
8d120cd
[ABRSDK-4375] feature: add Never value stream
minjae999 Aug 27, 2026
a226f4f
[ABRSDK-4375] change: preserve Promise on cancel
minjae999 Aug 27, 2026
a26781f
[ABRSDK-4375] refactor: make logger Sendable
minjae999 Aug 31, 2026
095db02
[ABRSDK-4375] refactor: make storage Sendable
minjae999 Aug 31, 2026
d99849c
[ABRSDK-4375] refactor: make shared types Sendable
minjae999 Aug 31, 2026
3a64dfa
[ABRSDK-4375] refactor: make protocols Sendable
minjae999 Sep 1, 2026
7898145
[ABRSDK-4375] refactor: make remaining protocols Sendable
kanghuiseon Sep 1, 2026
cdff0b6
[ABRSDK-4375] refactor: make client option block Sendable
kanghuiseon Sep 1, 2026
45ea083
[ABRSDK-4375] refactor: make object instance reflection Sendable
kanghuiseon Sep 1, 2026
2842fdb
[ABRSDK-4375] change: make Promise isResolved synchronous
kanghuiseon Sep 1, 2026
78eba8a
[ABRSDK-4375] change: make preference migration async
kanghuiseon Sep 2, 2026
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
30 changes: 12 additions & 18 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// swift-tools-version: 5.6
// swift-tools-version: 6.0
import PackageDescription

var package = Package(
name: "Saby",
platforms: [
.iOS(.v12),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6),
.iOS(.v15),
.macOS(.v14),
.tvOS(.v15),
.watchOS(.v8),
.visionOS(.v1)
],
products: [
.library(
Expand All @@ -19,9 +20,6 @@ var package = Package(
.library(
name: "SabyESCArchitecture",
targets: ["SabyESCArchitecture"]),
.library(
name: "SabyTestExpect",
targets: ["SabyTestExpect"]),
.library(
name: "SabyJSON",
targets: ["SabyJSON"]),
Expand Down Expand Up @@ -65,10 +63,6 @@ var package = Package(
name: "SabyESCArchitecture",
dependencies: ["SabyConcurrency"],
path: "Source/ESCArchitecture"),
.target(
name: "SabyTestExpect",
dependencies: ["SabyConcurrency"],
path: "Source/TestExpect"),
.target(
name: "SabyTestWait",
dependencies: ["SabyConcurrency", "SabyTestMock"],
Expand All @@ -79,7 +73,7 @@ var package = Package(
path: "Source/JSON"),
.target(
name: "SabyTestMock",
dependencies: ["SabyConcurrency", "SabyJSON"],
dependencies: ["SabyConcurrency"],
path: "Source/TestMock"),
.target(
name: "SabyTestFake",
Expand Down Expand Up @@ -107,7 +101,7 @@ var package = Package(
path: "Source/Time"),
.testTarget(
name: "SabyConcurrencyTest",
dependencies: ["SabyConcurrency", "SabyTestWait"],
dependencies: ["SabyConcurrency"],
path: "Test/Concurrency"),
.testTarget(
name: "SabyEncodeTest",
Expand All @@ -119,7 +113,7 @@ var package = Package(
path: "Test/JSON"),
.testTarget(
name: "SabyNetworkTest",
dependencies: ["SabyNetwork", "SabyTestMock", "SabyTestExpect"],
dependencies: ["SabyNetwork", "SabyConcurrency", "SabyJSON"],
path: "Test/Network"),
.testTarget(
name: "SabyNumericTest",
Expand All @@ -140,7 +134,7 @@ var package = Package(
]
)

#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)
package
.products.append(contentsOf: [
.library(
Expand Down Expand Up @@ -189,7 +183,7 @@ package
path: "Source/AppleStorage"),
.target(
name: "SabyApplePreference",
dependencies: ["SabyConcurrency", "SabyJSON"],
dependencies: ["SabyJSON"],
path: "Source/ApplePreference"),
.target(
name: "SabyAppleTracker",
Expand All @@ -209,7 +203,7 @@ package
path: "Test/AppleCrypto"),
.testTarget(
name: "SabyAppleStorageTest",
dependencies: ["SabyAppleStorage", "SabyTestWait"],
dependencies: ["SabyAppleStorage"],
path: "Test/AppleStorage"),
.testTarget(
name: "SabyApplePreferenceTest",
Expand Down
16 changes: 0 additions & 16 deletions Source/AppleCrypto/Hash.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Source/AppleCrypto/Implement/HMAC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Created by WOF on 2023/06/13.
//

#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
#if (os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)) && canImport(Foundation) && canImport(CommonCrypto)

import Foundation
import CommonCrypto

public enum HMAC: MessageAuthenticationCode {
public enum HMAC {
public static func code(message: String, key: String, hash: Hash) -> String {
var result = Array<UInt8>(repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH))

Expand Down
4 changes: 2 additions & 2 deletions Source/AppleCrypto/Implement/SHA256.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Created by WOF on 2023/02/17.
//

#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
#if (os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)) && canImport(Foundation) && canImport(CommonCrypto)

import Foundation
import CommonCrypto

public enum SHA256: Hash {
public enum SHA256 {
public static func hash(message: String) -> String {
var result = Array<UInt8>(repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH))

Expand Down
26 changes: 4 additions & 22 deletions Source/AppleCrypto/Implement/TOTP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// Created by WOF on 2023/06/13.
//

#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
#if (os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)) && canImport(Foundation) && canImport(CommonCrypto)

import Foundation
import CommonCrypto
import SabyTime

public enum TOTP: OneTimePassword {
public enum TOTP {
public static func password(
timestamp: Timestamp,
key: String,
Expand Down Expand Up @@ -77,31 +77,13 @@ extension TOTP {

extension TOTP {
public enum Digit: Int {
case digit0 = 0
case digit1
case digit2
case digit3
case digit4
case digit5
case digit6
case digit7
case digit8
case digit8 = 8
}
}

extension TOTP.Digit {
var mask: UInt32 {
switch self {
case .digit0: return 1
case .digit1: return 10
case .digit2: return 100
case .digit3: return 1000
case .digit4: return 10000
case .digit5: return 100000
case .digit6: return 1000000
case .digit7: return 10000000
case .digit8: return 100000000
}
100000000
}
}

Expand Down
22 changes: 0 additions & 22 deletions Source/AppleCrypto/MessageAuthenticationCode.swift

This file was deleted.

26 changes: 0 additions & 26 deletions Source/AppleCrypto/OneTimePassword.swift

This file was deleted.

1 change: 0 additions & 1 deletion Source/AppleFetcher/Alias/Fetcher/FetcherProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
import Foundation

extension Fetcher {
public typealias SelfProtocol = Fetcher<Self.Value>
public typealias AnyProtocol = any Fetcher<Self.Value>
}
2 changes: 1 addition & 1 deletion Source/AppleFetcher/Fetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

public protocol Fetcher<Value> {
public protocol Fetcher<Value>: Sendable {
associatedtype Value

func fetch() -> Value
Expand Down
2 changes: 1 addition & 1 deletion Source/AppleFetcher/Implement/AppFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by WOF on 2022/08/24.
//

#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)

import Foundation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by WOF on 2022/08/22.
//

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)

import Foundation

Expand All @@ -24,16 +24,17 @@ public final class AppleAdsAttributionTokenFetcher: Fetcher {
}

public func fetch() -> Promise<AppleAdsAttributionToken, Error> {
Promise.async {
try self.classAAAttribution.attributionToken()
let classAAAttribution = self.classAAAttribution

return Promise.async {
try await classAAAttribution.attributionToken()
}
}
}

public typealias AppleAdsAttributionToken = String

private final class ClassAAAttribution {
private let classAAAttribution: NSObjectClass
private actor ClassAAAttribution {
private let methodAttributionTokenWithError: NSObjectClassMethod

init?() {
Expand All @@ -48,7 +49,6 @@ private final class ClassAAAttribution {
return nil
}

self.classAAAttribution = classAAAttribution
self.methodAttributionTokenWithError = methodAttributionTokenWithError
}

Expand Down
15 changes: 6 additions & 9 deletions Source/AppleFetcher/Implement/CarrierFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by WOF on 2022/08/24.
//

#if os(iOS)
#if os(iOS) && canImport(CoreTelephony)

import Foundation
import CoreTelephony
Expand Down Expand Up @@ -35,14 +35,11 @@ public struct Carrier {
extension CarrierFetcher {
private func fetchCTCarrier() -> CTCarrier? {
let information = CTTelephonyNetworkInfo()
if #available(iOS 12.0, *) {
return information
.serviceSubscriberCellularProviders?
.values
.first { $0.carrierName != nil }
} else {
return information.subscriberCellularProvider
}

return information
.serviceSubscriberCellularProviders?
.values
.first { $0.carrierName != nil }
}
}

Expand Down
5 changes: 3 additions & 2 deletions Source/AppleFetcher/Implement/CoarseLocationFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by WOF on 2022/08/23.
//

#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(visionOS)

import Foundation

Expand Down Expand Up @@ -65,7 +65,8 @@ extension CoarseLocationFetcher {
}

private func fetchRegion() -> String? {
Locale.autoupdatingCurrent.regionCode
(Locale.autoupdatingCurrent as NSLocale)
.object(forKey: .countryCode) as? String
}
}

Expand Down
26 changes: 13 additions & 13 deletions Source/AppleFetcher/Implement/IdentifierForVendorFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
// Created by WOF on 2022/08/25.
//

#if os(iOS) || os(tvOS)
#if (os(iOS) || os(tvOS) || os(visionOS)) && canImport(UIKit)

import Foundation
import UIKit

import SabyConcurrency

public final class IdentifierForVendorFetcher: Fetcher {
public typealias Value = IdentifierForVendor
public typealias Value = Promise<IdentifierForVendor, Never>

public init() {}

public func fetch() -> IdentifierForVendor {
IdentifierForVendor(
identifier: fetchIdentifier()
)
public func fetch() -> Promise<IdentifierForVendor, Never> {
Promise.async {
await MainActor.run {
IdentifierForVendor(
identifier: UIDevice.current.identifierForVendor?.uuidString
)
}
}
}
}

public struct IdentifierForVendor {
public struct IdentifierForVendor: Sendable {
public let identifier: String?
}

extension IdentifierForVendorFetcher {
private func fetchIdentifier() -> String? {
UIDevice.current.identifierForVendor?.uuidString
}
}

#endif
Loading
Loading