-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update dependencies and upgrade versions * Update tools and tools' tests * Update Example * Update errors * Update decorators * Update bottomsheet * Update screen * Update deeplink * Update components * Added missing code * Added mising MainActor for DeeplinkIntercepter * Added MainActor to BottomSheet * Small fixes
- Loading branch information
1 parent
0753cdc
commit 77cf062
Showing
152 changed files
with
608 additions
and
602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.7 | ||
6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
15.2 | ||
16.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import Foundation | ||
import Nivelir | ||
|
||
@MainActor | ||
struct Screens { | ||
|
||
let services: Services | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Example/NivelirExample/Routing/Authorization/ScreenAuthorizeActionScreens.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Example/NivelirExample/Routing/Extensions/Alert+Extensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import UIKit | ||
import Nivelir | ||
|
||
@MainActor | ||
extension Alert { | ||
|
||
static let somethingWentWrong = Self( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Example/NivelirExample/Screens/Authorization/AuthorizationObserver.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
Example/NivelirExample/Services/Authorization/AuthorizationService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 35 additions & 42 deletions
77
Example/NivelirExample/Services/Profile/DefaultProfileService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,62 @@ | ||
import UIKit | ||
|
||
final class DefaultProfileService: ProfileService { | ||
final class DefaultProfileService: ProfileService, Sendable { | ||
|
||
private class UncheckedCGFloat: @unchecked Sendable { | ||
var value: CGFloat = .zero | ||
} | ||
|
||
private let authorizationService: AuthorizationService | ||
private let intervalCount = UncheckedCGFloat() | ||
|
||
init(authorizationService: AuthorizationService) { | ||
self.authorizationService = authorizationService | ||
} | ||
|
||
private func finishSucceedUploading( | ||
timer: Timer, | ||
progress: @escaping (_ ratio: CGFloat) -> Void, | ||
completion: @escaping (_ result: Result<Void, Error>) -> Void | ||
) { | ||
timer.invalidate() | ||
progress(1.0) | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { | ||
completion(.success(Void())) | ||
} | ||
} | ||
|
||
private func finishFailedUploading( | ||
timer: Timer, | ||
completion: @escaping (_ result: Result<Void, Error>) -> Void | ||
) { | ||
timer.invalidate() | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { | ||
completion(.failure(ProfileError.unavailable)) | ||
} | ||
} | ||
|
||
func uploadPhoto( | ||
image: UIImage, | ||
progress: @escaping (_ ratio: CGFloat) -> Void, | ||
completion: @escaping (_ result: Result<Void, Error>) -> Void | ||
progress: @MainActor @Sendable @escaping (_ ratio: CGFloat) -> Void, | ||
completion: @MainActor @Sendable @escaping (_ result: Result<Void, Error>) -> Void | ||
) { | ||
intervalCount.value = .zero | ||
guard authorizationService.isAuthorized else { | ||
return completion(.failure(ProfileError.unauthorized)) | ||
} | ||
|
||
var intervalCount: CGFloat = .zero | ||
Timer.scheduledTimer(withTimeInterval: 0.05, repeats: true) { [weak self] timer in | ||
guard let self else { | ||
return | ||
} | ||
|
||
guard intervalCount.value <= 100 else { | ||
timer.invalidate() | ||
|
||
Task { @MainActor in | ||
progress(1.0) | ||
} | ||
|
||
Timer.scheduledTimer(withTimeInterval: 0.05, repeats: true) { timer in | ||
guard intervalCount <= 100 else { | ||
return self.finishSucceedUploading( | ||
timer: timer, | ||
progress: progress, | ||
completion: completion | ||
) | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { | ||
completion(.success(Void())) | ||
} | ||
return | ||
} | ||
|
||
let random = Int.random(in: 1...1000) | ||
|
||
guard random < 997 || intervalCount < 50 else { | ||
return self.finishFailedUploading( | ||
timer: timer, | ||
completion: completion | ||
) | ||
guard random < 997 || intervalCount.value < 50 else { | ||
timer.invalidate() | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { | ||
completion(.failure(ProfileError.unavailable)) | ||
} | ||
return | ||
} | ||
|
||
progress(intervalCount * 0.01) | ||
Task { @MainActor in | ||
progress(self.intervalCount.value * 0.01) | ||
} | ||
|
||
intervalCount += 1.0 | ||
intervalCount.value += 1.0 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.