Skip to content

Commit

Permalink
Feature/improvement profile/main (#72)
Browse files Browse the repository at this point in the history
* Feature/improvement profile/my profile view (#69)

* feat: delete existing view

* feat: delete myprofileview navigation

* fix: DI

* fix: DI

* feat: present profileview

* feat: pass binding

* feat: draggable profile view

* Feature/improvement profile/view UI (#70)

* feat

* feat

* feat

* feat

* feat

* feat

* chore

* Feature/improvement profile/view UI (#71)

* feat

* feat

* feat

* feat

* feat

* feat

* chore

* feat

* feat

* feat

* feat: friend loading

* chore

* feat: FullScreenImageView

* feat: binding url

* feat

* delete friend profile view

* feat

* feat

* feat: navigation

* chore

* chore

* chore

* chore

* feat: MyProfileEditView

* feat: DI

* feat: viewModel

* feat: BackgroundImageView

* feat: refactor name

* feat: DI

* feat: PhotosPicker

* feat: delete legacy

* feat: init background image

* feat: update background photo

* feat: add cancel button

* feat: configure user image

* feat: profile image view

* chore

* feat: WhiteUnderlineTextLabel

* feat: displaying display name

* feat: ProfileTextInputView

* feat: focus

* feat: edit profile

* chore: update fastlane

* feat: change ui

* fix: animation

* fix: animation

* fix: animation

* fix: animation

* feat: present fullscreen image on friend profile

* feat: fetch link

* feat: ui

* feat: MakeStringFromURLUsecase

* feat: delete background image

* feat: delete photo

* chore

* feat: update profile

* chore

* chore

* fix test

* Feature/improvement profile/button (#73)

* myview

* fix: friend list

* chore
  • Loading branch information
donggyushin authored Aug 4, 2024
1 parent dfd32d8 commit b2618e5
Show file tree
Hide file tree
Showing 43 changed files with 1,636 additions and 553 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

source "https://rubygems.org"

gem "fastlane", "~>2.221.0"
gem "fastlane", "~>2.222.0"
# TODO: update ruby version
30 changes: 15 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.947.0)
aws-sdk-core (3.199.0)
aws-partitions (1.961.0)
aws-sdk-core (3.201.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.87.0)
aws-sdk-core (~> 3, >= 3.199.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.154.0)
aws-sdk-core (~> 3, >= 3.199.0)
aws-sdk-kms (1.88.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.157.0)
aws-sdk-core (~> 3, >= 3.201.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.9.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
Expand All @@ -38,7 +38,7 @@ GEM
domain_name (0.6.20240107)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.110.0)
excon (0.111.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand All @@ -60,15 +60,15 @@ GEM
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http (1.0.2)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.221.1)
fastlane (2.222.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -154,7 +154,7 @@ GEM
json (2.7.2)
jwt (2.8.2)
base64
mini_magick (4.13.1)
mini_magick (4.13.2)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.4.1)
Expand All @@ -164,7 +164,7 @@ GEM
optparse (0.5.0)
os (1.1.4)
plist (3.7.1)
public_suffix (6.0.0)
public_suffix (6.0.1)
rake (13.2.1)
representable (3.2.0)
declarative (< 0.1.0)
Expand Down Expand Up @@ -214,7 +214,7 @@ PLATFORMS
ruby

DEPENDENCIES
fastlane (~> 2.221.0)
fastlane (~> 2.222.0)

BUNDLED WITH
2.5.9
24 changes: 24 additions & 0 deletions dg-muscle-ios/Tests/User/MakeStringFromURLUsecaseTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// MakeStringFromURLUsecaseTests.swift
// AppTests
//
// Created by 신동규 on 8/3/24.
//

import XCTest
import Domain

final class MakeStringFromURLUsecaseTests: XCTestCase {

let usecase = MakeStringFromURLUsecase()

func testHttps() {
let url = URL(string: "https://www.naver.com")!
XCTAssertEqual("www.naver.com", usecase.implement(url: url))
}

func testHttp() {
let url = URL(string: "http://www.naver.com")!
XCTAssertEqual("www.naver.com", usecase.implement(url: url))
}
}
31 changes: 31 additions & 0 deletions dg-muscle-ios/Tests/User/MakeURLFromStringUsecaseTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// MakeURLFromStringUsecaseTests.swift
// AppTests
//
// Created by 신동규 on 8/3/24.
//

import XCTest
import Domain

final class MakeURLFromStringUsecaseTests: XCTestCase {

let usecase = MakeURLFromStringUsecase()

func testWithoutPrefix() {
XCTAssertNotNil(usecase.implement(link: "www.naver.com"))
}

func testWithPrefix() {
XCTAssertNotNil(usecase.implement(link: "https://www.naver.com"))
XCTAssertNotNil(usecase.implement(link: "http://www.naver.com"))
}

func testEmpty() {
XCTAssertNil(usecase.implement(link: ""))
}

func testFail() {
XCTAssertNil(usecase.implement(link: " "))
}
}
17 changes: 17 additions & 0 deletions dg-muscle-ios/sources/App/DI/HistoryAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ import Presentation
public struct HistoryAssembly: Assembly {

public func assemble(container: Swinject.Container) {

container.register(HistoryListView.self) { (resolver, today: Date) in

let historyRepository = resolver.resolve(HistoryRepository.self)!
let exerciseRepository = resolver.resolve(ExerciseRepository.self)!
let heatMapRepository = resolver.resolve(HeatMapRepository.self)!
let userRepository = resolver.resolve(UserRepository.self)!

return HistoryListView(
today: today,
historyRepository: historyRepository,
exerciseRepository: exerciseRepository,
heatMapRepository: heatMapRepository,
userRepository: userRepository
)
}

container.register(HeatMapColorSelectView.self) { resolver in
let userRepository = resolver.resolve(UserRepository.self)!
return HeatMapColorSelectView(userRepository: userRepository)
Expand Down
16 changes: 5 additions & 11 deletions dg-muscle-ios/sources/App/DI/HomeAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,18 @@ import Swinject
import Domain
import Presentation
import Foundation
import My
import History

public struct HomeAssembly: Assembly {
public func assemble(container: Swinject.Container) {
container.register(HomeView.self) { (resolver, today: Date) in

let historyRepository = resolver.resolve(HistoryRepository.self)!
let exerciseRepository = resolver.resolve(ExerciseRepository.self)!
let heatMapRepository = resolver.resolve(HeatMapRepository.self)!
let userRepository = resolver.resolve(UserRepository.self)!
let logRepository = resolver.resolve(LogRepository.self)!

return HomeView(
today: today,
historyRepository: historyRepository,
exerciseRepository: exerciseRepository,
heatMapRepository: heatMapRepository,
userRepository: userRepository,
logRepository: logRepository
historyListFactory: { today in resolver.resolve(HistoryListView.self, argument: today)! },
myViewFactory: { presentProfileAction in resolver.resolve(MyView.self, argument: presentProfileAction)! },
myProfileViewFactory: { shows in resolver.resolve(MyProfileView.self, argument: shows)! }
)
}
}
Expand Down
1 change: 0 additions & 1 deletion dg-muscle-ios/sources/App/DI/MainAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public struct MainAssembly: Assembly {
setDurationFactory: { duration in resolver.resolve(SetDurationView.self, argument: duration)! },
manageMemoFactory: { memo in resolver.resolve(ManageMemoView.self, argument: memo)! },
dateToSelectHistoryFactory: { resolver.resolve(DateToSelectHistoryView.self)! },
myProfileFactory: { resolver.resolve(MyProfileView.self)! },
deleteAccountConfirmFactory: { resolver.resolve(DeleteAccountConfirmView.self)! },
logsFactory: { resolver.resolve(LogsView.self)! },
friendMainFactory: { anchor in resolver.resolve(FriendMainView.self, argument: anchor)! },
Expand Down
37 changes: 27 additions & 10 deletions dg-muscle-ios/sources/App/DI/MyAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,45 @@ import Swinject
import Domain
import Presentation
import My
import SwiftUI

public struct MyAssembly: Assembly {
public func assemble(container: Swinject.Container) {
container.register(MyProfileView.self) { resolver in
container.register(MyView.self) { (resolver, presentProfileViewAction: (() -> Void)?) in

let userRepository = resolver.resolve(UserRepository.self)!

return MyProfileView(userRepository: userRepository)
let logRepository = resolver.resolve(LogRepository.self)!

return MyView(
userRepository: userRepository,
logRepository: logRepository,
presentProfileViewAction: presentProfileViewAction
)
}


container.register(MyProfileView.self) { (resolver, shows: Binding<Bool>) in
let userRepository = resolver.resolve(UserRepository.self)!
return MyProfileView(
shows: shows,
userRepository: userRepository,
myProfileEditFactory: { isEditing in
MyProfileEditView(userRepository: userRepository, isEditing: isEditing)
}
)
}

container.register(DeleteAccountConfirmView.self) { resolver in

let userRepository = resolver.resolve(UserRepository.self)!

return DeleteAccountConfirmView(userRepository: userRepository)
}

container.register(LogsView.self) { resolver in

let logRepository = resolver.resolve(LogRepository.self)!
let friendRepository = resolver.resolve(FriendRepository.self)!

return LogsView(
logRepository: logRepository,
friendRepository: friendRepository
Expand Down
2 changes: 0 additions & 2 deletions dg-muscle-ios/sources/App/Delegate/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class SceneDelegate: NSObject, UIWindowSceneDelegate {
case "friendhistory":
guard let friendId = URLManager.shared.getParameter(url: url, name: "id") else { return }
coordinator?.friend.friendHistory(friendId: friendId)
case "profile":
coordinator?.my.profile()
case "exercisemanage":
coordinator?.exercise.exerciseManage()
case "heatmapcolorselect":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import Combine
public final class FriendRepositoryImpl: FriendRepository {
public static let shared = FriendRepositoryImpl()

public var loading: AnyPublisher<Bool, Never> { $_loading.eraseToAnyPublisher() }
@Published var _loading: Bool = true

public var friends: AnyPublisher<[Domain.User], Never> { $_friends.eraseToAnyPublisher() }
@Published var _friends: [Domain.User] = []

Expand Down Expand Up @@ -142,12 +145,14 @@ public final class FriendRepositoryImpl: FriendRepository {

self._friends = friends
self._requests = requests
self._loading = false

let friendIds = friends.map({ $0.uid })

for id in friendIds {
Task {
try? await getHistories(friendId: id)
let _ = try? await getHistories(friendId: id)
let _ = try? await getExercises(friendId: id)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public final class RapidRepositoryImpl: RapidRepository {
logRepository: LogRepositoryImpl.shared,
userRepository: UserRepositoryImpl.shared
)
.implement(message: error.localizedDescription, category: .error)
.implement(message: """
location is RapidRepositoryImpl
\(error.localizedDescription)
""", category: .error)
}
_exercisesLoading = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation
import Combine

public protocol FriendRepository {
var loading: AnyPublisher<Bool, Never> { get }
var friends: AnyPublisher<[User], Never> { get }
var requests: AnyPublisher<[FriendRequest], Never> { get }
var users: AnyPublisher<[User], Never> { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ public final class SearchUsersExceptForMyFriendsUsecase {

users = users
.filter({ !excludeIds.contains($0.uid) })
.filter({ $0.displayName?.isEmpty == false })
.sorted(by: { user1, user2 in
if user1.photoURL != nil && user2.photoURL == nil {
return true
}

if user1.displayName != nil && user2.displayName == nil {
if (user1.displayName?.isEmpty == false) && (user2.displayName?.isEmpty != false) {
return true
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// SubscribeFetchingFriendLoadingUsecase.swift
// Domain
//
// Created by 신동규 on 7/29/24.
//

import Foundation
import Combine

public final class SubscribeFetchingFriendLoadingUsecase {
let friendRepository: FriendRepository

public init(friendRepository: FriendRepository) {
self.friendRepository = friendRepository
}

public func implement() -> AnyPublisher<Bool, Never> {
friendRepository.loading
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// MakeStringFromURLUsecase.swift
// Domain
//
// Created by 신동규 on 8/3/24.
//

import Foundation

public final class MakeStringFromURLUsecase {
public init() { }

public func implement(url: URL) -> String {
var result: String = url.absoluteString

let http = "http://"
let https = "https://"

var prefix: String?

if result.hasPrefix(http) {
prefix = http
}

if result.hasPrefix(https) {
prefix = https
}

if let prefix {
result.removeFirst(prefix.count)
}

return result
}
}
Loading

0 comments on commit b2618e5

Please sign in to comment.