Skip to content

Commit 25b6873

Browse files
authored
Merge pull request #99 from makinosp/develop
Develop
2 parents c9b0a05 + 933fcae commit 25b6873

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

.github/FUNDING.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github: makinosp
2+
patreon: makinosp
3+
ko_fi: makinosp
4+
liberapay: makinon

Sources/VRCKit/Models/Favorite/FavoriteListModel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// Created by makinosp on 2024/10/06.
66
//
77

8+
import MemberwiseInit
9+
10+
@MemberwiseInit(.public)
811
public struct FavoriteList: Sendable, Identifiable {
912
public let id: String
1013
public let favorites: [Favorite]

Sources/VRCKit/Models/World/InstanceModel.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public struct Instance: Sendable, Identifiable, Hashable, Decodable {
2828
public let userCount: Int
2929
public let world: World
3030

31-
@MemberwiseInit(.public)
3231
public struct Platforms: Sendable, Hashable, Codable {
3332
@Init(default: 0) public let android: Int
3433
@Init(default: 0) public let ios: Int
@@ -93,6 +92,18 @@ public extension Instance {
9392
}
9493
}
9594

95+
public extension Instance.Platforms {
96+
/// Initialize from an array of UserPlatform
97+
/// - Parameter platforms: An array of UserPlatform
98+
init(_ platforms: [UserPlatform]) {
99+
self.init(
100+
android: platforms.contains(.android) ? 1 : 0,
101+
ios: platforms.contains(.ios) ? 1 : 0,
102+
standalonewindows: platforms.contains(.standalonewindows) ? 1 : 0
103+
)
104+
}
105+
}
106+
96107
extension Instance.GroupAccessType {
97108
var typeDescription: Instance.InstanceTypeAlias {
98109
switch self {

Sources/VRCKit/Protocols/AuthenticationServiceProtocol.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ public protocol AuthenticationServiceProtocol: Sendable {
1212
/// - Returns: A boolean indicating if the user exists.
1313
func exists(userId: String) async throws -> Bool
1414

15-
/// Fetches the authenticated user's information or determines if two-factor authentication (2FA) verification is required.
16-
/// - Returns: An `Either<User, VerifyType>` result, which is `.left(User)` if the user is successfully authenticated,
17-
/// - Throws: An error if the request fails or if the response cannot be decoded. If an unexpected decoding issue occurs,
18-
/// it throws `VRCKitError.unexpected`.
15+
/// Fetches the authenticated user's information or determines if 2FA verification is required.
16+
/// - Returns: An `Either<User, VerifyType>` result.
17+
/// - Throws: An error if the request fails or if the response cannot be decoded.
18+
/// If an unexpected decoding issue occurs,it throws `VRCKitError.unexpected`.
1919
func loginUserInfo() async throws -> Either<User, VerifyType>
2020

2121
/// Verifies 2-factor authentication using either TOTP or Email OTP.

Sources/VRCKit/Protocols/ImageUrlRepresentableProtocol.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public protocol ImageUrlRepresentable: Sendable {
1212
///
1313
/// - Parameters:
1414
/// - url: The original image URL to modify.
15-
/// - resolution: The desired image resolution as an `ImageResolution` value. The original resolution is `.origin`.
15+
/// - resolution: The desired image resolution as an `ImageResolution` value.
16+
/// The original resolution is `.origin`.
1617
///
1718
/// - Returns: A new URL with the last numeric component replaced by the specified resolution.
1819
func imageUrl(_ resolution: ImageResolution) -> URL?

Sources/VRCKit/Services/AuthenticationService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public final actor AuthenticationService: APIService, AuthenticationServiceProto
3030
} catch _ as DecodingError {
3131
let result: RequiresTwoFactorAuthResponse = try Serializer.shared.decode(response.data)
3232
guard let requires = result.requires else {
33-
throw VRCKitError.invalidResponse("\(result.requires?.rawValue)")
33+
throw VRCKitError.invalidResponse(String(describing: result.requires?.rawValue))
3434
}
3535
return .right(requires)
3636
}

0 commit comments

Comments
 (0)