Skip to content

Commit

Permalink
Merge pull request #182 from makinosp/develop
Browse files Browse the repository at this point in the history
update: bump up to 0.9.7
  • Loading branch information
makinosp authored Nov 2, 2024
2 parents 5a64664 + 851f70a commit 5582a17
Show file tree
Hide file tree
Showing 22 changed files with 169 additions and 124 deletions.
4 changes: 2 additions & 2 deletions Harmonie.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.9.6;
MARKETING_VERSION = 0.9.7;
PRODUCT_BUNDLE_IDENTIFIER = jp.mknn.harmonie;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -510,7 +510,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.9.6;
MARKETING_VERSION = 0.9.7;
PRODUCT_BUNDLE_IDENTIFIER = jp.mknn.harmonie;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"location" : "https://github.com/makinosp/vrckit",
"state" : {
"branch" : "develop",
"revision" : "b2c6886ea0e8e9ee836dd62450caa619e293f3f1"
"revision" : "7c88c46ceaf6d12b048cd03220c844de07206ec2"
}
}
],
Expand Down
10 changes: 10 additions & 0 deletions harmonie/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
}
}
},
"All" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "全て"
}
}
}
},
"App Name" : {
"localizations" : {
"ja" : {
Expand Down
11 changes: 2 additions & 9 deletions harmonie/Models/SegmentModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@

import SwiftUI

enum FavoriteViewSegment: String {
case all, friends, world
enum FavoriteViewSegment: String, CaseIterable {
case friends, world
}

extension FavoriteViewSegment: Identifiable {
var id: Int { hashValue }
}

extension FavoriteViewSegment: CaseIterable {
var allCases: [Self] {
[.all, .friends, .world]
}
}

extension FavoriteViewSegment: CustomStringConvertible {
var localizedString: LocalizedStringResource {
LocalizedStringResource(stringLiteral: rawValue.capitalized)
Expand All @@ -34,7 +28,6 @@ extension FavoriteViewSegment: CustomStringConvertible {
extension FavoriteViewSegment {
var icon: Iconizable {
switch self {
case .all: IconSet.favoriteSquares
case .friends: IconSet.friends
case .world: IconSet.world
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import Foundation
import VRCKit

extension PreviewDataProvider {
typealias FriendSet = (friend: Friend, userDetail: UserDetail)
struct FriendSet {
let friend: Friend
let userDetail: UserDetail
}

var onlineFriends: [Friend] {
friends.filter { $0.status != .offline }
Expand All @@ -19,26 +22,24 @@ extension PreviewDataProvider {
friends.filter { $0.status == .offline }
}

static func friend(id: UUID, location: Location, status: UserStatus) -> Friend {
Friend(id: id, location: location, status: status)
}

static var friend: Friend {
Friend(id: UUID(), location: .offline, status: .offline)
}
}

static func friendSet(
extension PreviewDataProvider.FriendSet {
init(
id: UUID,
location: Location,
status: UserStatus
) -> FriendSet {
(
Friend(
) {
self.init(
friend: Friend(
id: id,
location: location,
status: status
),
PreviewDataProvider.userDetail(
userDetail: PreviewDataProvider.userDetail(
id: id,
location: location,
state: status == .offline ? .offline : .active,
Expand All @@ -51,26 +52,27 @@ extension PreviewDataProvider {
private extension Friend {
init(
id: UUID,
avatarImageUrl: URL? = PreviewDataProvider.iconImageUrl,
displayName: String = PreviewString.Name.randomValue,
location: Location,
status: UserStatus
) {
self.init(
bio: "Biography",
bioLinks: SafeDecodingArray(),
avatarImageUrl: PreviewDataProvider.iconImageUrl,
avatarThumbnailUrl: PreviewDataProvider.iconImageUrl,
avatarImageUrl: avatarImageUrl,
avatarThumbnailUrl: avatarImageUrl,
displayName: displayName,
id: "usr_\(id.uuidString)",
isFriend: true,
lastLogin: Date(),
lastPlatform: "standalonewindows",
platform: .blank,
profilePicOverride: PreviewDataProvider.iconImageUrl,
profilePicOverride: nil,
status: status,
statusDescription: "",
tags: UserTags(),
userIcon: PreviewDataProvider.iconImageUrl,
userIcon: nil,
location: location,
friendKey: ""
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,28 @@ import VRCKit

extension PreviewDataProvider {
static func instance(worldId: UUID, instanceId: Int) -> Instance {
Instance(worldId: worldId, instanceId: instanceId)
Instance(world: bar)
}

static func instance() -> Instance {
Instance(worldId: UUID(), instanceId: 0)
Instance(world: bar)
}

static let instance1 = Instance(world: bar)
static let instance2 = Instance(world: casino)
}

private extension Instance {
init(worldId: UUID, instanceId: Int) {
init(world: World, instanceId: Int = 0) {
self.init(
active: true,
capacity: 32,
full: false,
groupAccessType: nil,
id: "wrld_\(worldId):\(instanceId)",
id: "\(world.id):\(instanceId)",
instanceId: instanceId.description,
location: .id("wrld_\(worldId.uuidString)"),
name: "DummyInstance_\(instanceId)",
location: .id(world.id),
name: world.name,
ownerId: "usr_\(UUID().uuidString)",
permanent: false,
platforms: Platforms(),
Expand All @@ -37,7 +40,7 @@ private extension Instance {
tags: [],
type: [.public, .friends].randomElement() ?? .public,
userCount: 0,
world: PreviewDataProvider.generateWorld(worldId: worldId)
world: world
)
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,31 @@ import Foundation
import VRCKit

extension PreviewDataProvider {
static var world: World {
generateWorld(worldId: UUID())
}
static let bar = World(
id: UUID(),
name: "Bar",
description: "Bar",
imageUrl: URL(string: "\(imageBaseURL)/7a/95/kLHkm3Ez_o.jpg"),
thumbnailImageUrl: URL(string: "\(imageBaseURL)/7a/95/kLHkm3Ez_o.jpg"),
organization: "",
favorites: 50,
visits: 100,
popularity: 10,
heat: 4
)

static func generateWorld(worldId: UUID) -> World {
World(
id: worldId,
name: "Dummy World",
description: "Dummy World",
imageUrl: Const.privateWorldImageUrl,
thumbnailImageUrl: Const.privateWorldImageUrl,
organization: "",
favorites: 1,
visits: 1,
popularity: 1,
heat: 1
)
}
static let casino = World(
id: UUID(),
name: "Casino",
description: "Casino",
imageUrl: URL(string: "\(imageBaseURL)/83/48/NtBOJpF1_o.jpg"),
thumbnailImageUrl: URL(string: "\(imageBaseURL)/83/48/NtBOJpF1_o.jpg"),
organization: "",
favorites: 50,
visits: 75,
popularity: 5,
heat: 3
)
}

extension World {
Expand Down
25 changes: 14 additions & 11 deletions harmonie/Previews/PreviewDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,36 @@ final class PreviewDataProvider: Sendable {
private let previewUserId = UUID()
let friends: [Friend]
let userDetails: [UserDetail]
let instances: [Instance]

static let iconImageUrl = URL(string: "https://www.mediafire.com/convkey/e2dd/ksfjh96ukjtwhuczg.jpg")
static let imageBaseURL = "https://images2.imgbox.com"
static let iconImageUrl = URL(string: "\(imageBaseURL)/44/8f/IQToHkKa_o.jpg")

private init() {
let instance = Self.instance(worldId: UUID(), instanceId: 0)
let onlineFriendsSet: [FriendSet] = (0..<50).map { count in
let id = UUID()
return switch count {
case ..<5:
FriendSet(id: id, location: .id(Self.instance1.id), status: .active)
case ..<10:
Self.friendSet(id: id, location: .id(instance.id), status: .active)
FriendSet(id: id, location: .id(Self.instance2.id), status: .active)
case ..<15:
FriendSet(id: id, location: .id(Self.instance2.id), status: .joinMe)
case ..<20:
Self.friendSet(id: id, location: .private, status: .askMe)
FriendSet(id: id, location: .private, status: .askMe)
case ..<25:
FriendSet(id: id, location: .id(Self.instance1.id), status: .joinMe)
case ..<30:
Self.friendSet(id: id, location: .id(instance.id), status: .joinMe)
case ..<40:
Self.friendSet(id: id, location: .private, status: .busy)
FriendSet(id: id, location: .private, status: .busy)
default:
Self.friendSet(id: id, location: .offline, status: .offline)
FriendSet(id: id, location: .offline, status: .offline)
}
}

var userDetails = onlineFriendsSet.map(\.userDetail)
userDetails.append(PreviewDataProvider.previewUserDetail(id: previewUserId, instance: instance))
userDetails.append(PreviewDataProvider.previewUserDetail(id: previewUserId, instance: Self.instance1))

self.userDetails = userDetails
self.friends = onlineFriendsSet.map(\.friend)
self.instances = [instance]
}

var previewUser: User {
Expand Down
6 changes: 2 additions & 4 deletions harmonie/Previews/Services/AuthenticationPreviewService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
// Created by makinosp on 2024/07/06.
//

import MemberwiseInit
import VRCKit

@MemberwiseInit
final actor AuthenticationPreviewService: APIService, AuthenticationServiceProtocol {
let client: APIClient

init(client: APIClient) {
self.client = client
}

func exists(userId: String) async throws -> Bool { true }

func loginUserInfo() async throws -> Either<User, VerifyType> {
Expand Down
4 changes: 4 additions & 0 deletions harmonie/Previews/Services/FavoritePreviewService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ final actor FavoritePreviewService: APIService, FavoriteServiceProtocol {
}
}

func listFavorites(n: Int, offset: Int, type: FavoriteType, tag: String?) async throws -> [Favorite] {
[]
}

func fetchFavoriteList(favoriteGroups: [FavoriteGroup], type: FavoriteType) async throws -> [FavoriteList] {
[]
}
Expand Down
6 changes: 2 additions & 4 deletions harmonie/Previews/Services/FriendPreviewService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
// Created by makinosp on 2024/07/07.
//

import MemberwiseInit
import VRCKit

@MemberwiseInit
final actor FriendPreviewService: APIService, FriendServiceProtocol {
let client: APIClient

init(client: APIClient) {
self.client = client
}

func fetchFriends(offset: Int, n: Int, offline: Bool) async throws -> [Friend] {
offline ? PreviewDataProvider.shared.offlineFriends : PreviewDataProvider.shared.onlineFriends
}
Expand Down
24 changes: 18 additions & 6 deletions harmonie/Previews/Services/InstancePreviewService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,32 @@
// Created by makinosp on 2024/07/09.
//

import MemberwiseInit
import VRCKit

@MemberwiseInit
final actor InstancePreviewService: APIService, InstanceServiceProtocol {
let client: APIClient

init(client: APIClient) {
self.client = client
}

func fetchInstance(location: String) async throws -> Instance {
PreviewDataProvider.shared.instances[0]
switch location {
case PreviewDataProvider.instance1.id:
PreviewDataProvider.instance1
case PreviewDataProvider.instance2.id:
PreviewDataProvider.instance2
default:
PreviewDataProvider.instance1
}
}

func fetchInstance(worldId: String, instanceId: String) async throws -> Instance {
PreviewDataProvider.shared.instances[0]
switch instanceId {
case PreviewDataProvider.instance1.instanceId:
PreviewDataProvider.instance1
case PreviewDataProvider.instance2.instanceId:
PreviewDataProvider.instance2
default:
PreviewDataProvider.instance1
}
}
}
6 changes: 2 additions & 4 deletions harmonie/Previews/Services/UserNotePreviewService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
//

import Foundation
import MemberwiseInit
import VRCKit

@MemberwiseInit
final actor UserNotePreviewService: APIService, UserNoteServiceProtocol {
let client: APIClient

init(client: APIClient) {
self.client = client
}

func updateUserNote(
targetUserId: String,
note: String
Expand Down
Loading

0 comments on commit 5582a17

Please sign in to comment.