Skip to content
Merged
12 changes: 0 additions & 12 deletions Wable-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
DE70048D2D8EA85400B7AB71 /* NewsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE70048C2D8EA85400B7AB71 /* NewsViewController.swift */; };
DE7004902D8EA93A00B7AB71 /* NewsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE70048F2D8EA93A00B7AB71 /* NewsCell.swift */; };
DE7004922D8EB5CF00B7AB71 /* NewsHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7004912D8EB5CF00B7AB71 /* NewsHeaderView.swift */; };
DE7004952D8EBA9100B7AB71 /* GameScheduleEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7004942D8EBA9100B7AB71 /* GameScheduleEmptyView.swift */; };
DE72BB102D93CC68008E5774 /* NotificationPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE72BB0F2D93CC68008E5774 /* NotificationPageView.swift */; };
DE72BB132D93CD9D008E5774 /* WableSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE72BB122D93CD9D008E5774 /* WableSegmentedControl.swift */; };
DE72BB182D93D4E1008E5774 /* NotificationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE72BB172D93D4E1008E5774 /* NotificationCell.swift */; };
Expand Down Expand Up @@ -480,7 +479,6 @@
DE70048C2D8EA85400B7AB71 /* NewsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsViewController.swift; sourceTree = "<group>"; };
DE70048F2D8EA93A00B7AB71 /* NewsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsCell.swift; sourceTree = "<group>"; };
DE7004912D8EB5CF00B7AB71 /* NewsHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsHeaderView.swift; sourceTree = "<group>"; };
DE7004942D8EBA9100B7AB71 /* GameScheduleEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScheduleEmptyView.swift; sourceTree = "<group>"; };
DE72BB0F2D93CC68008E5774 /* NotificationPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationPageView.swift; sourceTree = "<group>"; };
DE72BB122D93CD9D008E5774 /* WableSegmentedControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WableSegmentedControl.swift; sourceTree = "<group>"; };
DE72BB172D93D4E1008E5774 /* NotificationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1510,14 +1508,6 @@
path = Cell;
sourceTree = "<group>";
};
DE7004932D8EBA8000B7AB71 /* Subview */ = {
isa = PBXGroup;
children = (
DE7004942D8EBA9100B7AB71 /* GameScheduleEmptyView.swift */,
);
path = Subview;
sourceTree = "<group>";
};
DE72BB0C2D93CAA6008E5774 /* Page */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1682,7 +1672,6 @@
isa = PBXGroup;
children = (
DEAFE0502D8C44810097E91C /* GameScheduleListViewController.swift */,
DE7004932D8EBA8000B7AB71 /* Subview */,
DEAFE0542D8C44940097E91C /* Cell */,
);
path = View;
Expand Down Expand Up @@ -2015,7 +2004,6 @@
DD2968692D6DAD5500143851 /* CommentTargetType.swift in Sources */,
DD29686A2D6DAD5500143851 /* ContentLikedTargetType.swift in Sources */,
DD29686B2D6DAD5500143851 /* CommunityTargetType.swift in Sources */,
DE7004952D8EBA9100B7AB71 /* GameScheduleEmptyView.swift in Sources */,
DD29686C2D6DAD5500143851 /* ProfileTargetType.swift in Sources */,
DD29686D2D6DAD5500143851 /* AccountTargetType.swift in Sources */,
DD514D102D8CA3780095021D /* AttributedString+.swift in Sources */,
Expand Down
4 changes: 1 addition & 3 deletions Wable-iOS/App/AppDelegate+InjectDependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ extension AppDelegate {
var diContainer: AppDIContainer { AppDIContainer.shared }

func injectDependency() {

// TODO: 객체를 주입

diContainer.register(for: InformationRepository.self, object: InformationRepositoryImpl())
}
}
4 changes: 2 additions & 2 deletions Wable-iOS/Data/Mapper/InformationMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum InformationMapper {
Announcement(
id: dto.newsID,
title: dto.newsTitle,
imageURL: URL(string: dto.newsImageURL),
imageURL: URL(string: dto.newsImageURL ?? ""),
text: dto.newsText,
createdDate: dateFormatter.date(from: dto.time)
)
Expand All @@ -73,7 +73,7 @@ enum InformationMapper {
Announcement(
id: dto.noticeID,
title: dto.noticeTitle,
imageURL: URL(string: dto.noticeImageURL),
imageURL: URL(string: dto.noticeImageURL ?? ""),
text: dto.noticeText,
createdDate: dateFormatter.date(from: dto.time)
)
Expand Down
153 changes: 0 additions & 153 deletions Wable-iOS/Data/RepositoryImpl/InformationRepositoryImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,156 +69,3 @@ final class InformationRepositoryImpl: InformationRepository {
.mapWableError()
}
}

struct MockInformationRepositoryImpl: InformationRepository {
func fetchGameCategory() -> AnyPublisher<String, WableError> {
return .just("2025 LCK SPRING")
.delay(for: .seconds(randomDelaySecond), scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}

func fetchGameSchedules() -> AnyPublisher<[GameSchedule], WableError> {
let mockGameSchedules: [GameSchedule] = [
GameSchedule(date: Date(), games: [
Game(date: Date(), homeTeam: .t1, homeScore: 1, awayTeam: .gen, awayScore: 2, status: .scheduled),
Game(date: Date(), homeTeam: .hle, homeScore: 3, awayTeam: .dk, awayScore: 4, status: .scheduled),
Game(date: Date(), homeTeam: .kt, homeScore: 5, awayTeam: .ns, awayScore: 6, status: .scheduled),
Game(date: Date(), homeTeam: .drx, homeScore: 7, awayTeam: .bro, awayScore: 8, status: .scheduled),
Game(date: Date(), homeTeam: .bfx, homeScore: 9, awayTeam: .dnf, awayScore: 10, status: .scheduled)
]),
GameSchedule(date: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, games: [
Game(date: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, homeTeam: .t1, homeScore: 1, awayTeam: .gen, awayScore: 2, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, homeTeam: .hle, homeScore: 3, awayTeam: .dk, awayScore: 4, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, homeTeam: .kt, homeScore: 5, awayTeam: .ns, awayScore: 6, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, homeTeam: .drx, homeScore: 7, awayTeam: .bro, awayScore: 8, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 1, to: Date())!, homeTeam: .bfx, homeScore: 9, awayTeam: .dnf, awayScore: 10, status: .scheduled)
]),
GameSchedule(date: Calendar.current.date(byAdding: .day, value: 2, to: Date())!, games: [
Game(date: Calendar.current.date(byAdding: .day, value: 2, to: Date())!, homeTeam: .t1, homeScore: 1, awayTeam: .gen, awayScore: 2, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 2, to: Date())!, homeTeam: .hle, homeScore: 3, awayTeam: .dk, awayScore: 4, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 2, to: Date())!, homeTeam: .kt, homeScore: 5, awayTeam: .ns, awayScore: 6, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 2, to: Date())!, homeTeam: .drx, homeScore: 7, awayTeam: .bro, awayScore: 8, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 2, to: Date())!, homeTeam: .bfx, homeScore: 9, awayTeam: .dnf, awayScore: 10, status: .scheduled)
]),
GameSchedule(date: Calendar.current.date(byAdding: .day, value: 3, to: Date())!, games: [
Game(date: Calendar.current.date(byAdding: .day, value: 3, to: Date())!, homeTeam: .t1, homeScore: 1, awayTeam: .gen, awayScore: 2, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 3, to: Date())!, homeTeam: .hle, homeScore: 3, awayTeam: .dk, awayScore: 4, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 3, to: Date())!, homeTeam: .kt, homeScore: 5, awayTeam: .ns, awayScore: 6, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 3, to: Date())!, homeTeam: .drx, homeScore: 7, awayTeam: .bro, awayScore: 8, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 3, to: Date())!, homeTeam: .bfx, homeScore: 9, awayTeam: .dnf, awayScore: 10, status: .scheduled)
]),
GameSchedule(date: Calendar.current.date(byAdding: .day, value: 4, to: Date())!, games: [
Game(date: Calendar.current.date(byAdding: .day, value: 4, to: Date())!, homeTeam: .t1, homeScore: 1, awayTeam: .gen, awayScore: 2, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 4, to: Date())!, homeTeam: .hle, homeScore: 3, awayTeam: .dk, awayScore: 4, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 4, to: Date())!, homeTeam: .kt, homeScore: 5, awayTeam: .ns, awayScore: 6, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 4, to: Date())!, homeTeam: .drx, homeScore: 7, awayTeam: .bro, awayScore: 8, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 4, to: Date())!, homeTeam: .bfx, homeScore: 9, awayTeam: .dnf, awayScore: 10, status: .scheduled)
]),
GameSchedule(date: Calendar.current.date(byAdding: .day, value: 5, to: Date())!, games: [
Game(date: Calendar.current.date(byAdding: .day, value: 5, to: Date())!, homeTeam: .t1, homeScore: 1, awayTeam: .gen, awayScore: 2, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 5, to: Date())!, homeTeam: .hle, homeScore: 3, awayTeam: .dk, awayScore: 4, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 5, to: Date())!, homeTeam: .kt, homeScore: 5, awayTeam: .ns, awayScore: 6, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 5, to: Date())!, homeTeam: .drx, homeScore: 7, awayTeam: .bro, awayScore: 8, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 5, to: Date())!, homeTeam: .bfx, homeScore: 9, awayTeam: .dnf, awayScore: 10, status: .scheduled)
]),
GameSchedule(date: Calendar.current.date(byAdding: .day, value: 6, to: Date())!, games: [
Game(date: Calendar.current.date(byAdding: .day, value: 6, to: Date())!, homeTeam: .t1, homeScore: 1, awayTeam: .gen, awayScore: 2, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 6, to: Date())!, homeTeam: .hle, homeScore: 3, awayTeam: .dk, awayScore: 4, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 6, to: Date())!, homeTeam: .kt, homeScore: 5, awayTeam: .ns, awayScore: 6, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 6, to: Date())!, homeTeam: .drx, homeScore: 7, awayTeam: .bro, awayScore: 8, status: .scheduled),
Game(date: Calendar.current.date(byAdding: .day, value: 6, to: Date())!, homeTeam: .bfx, homeScore: 9, awayTeam: .dnf, awayScore: 10, status: .scheduled)
])
]

return .just(mockGameSchedules)
.delay(for: .seconds(randomDelaySecond), scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}

func fetchTeamRanks() -> AnyPublisher<[LCKTeamRank], WableError> {
let mockLCKTeamRanks: [LCKTeamRank] = [
LCKTeamRank(team: .t1, rank: 1, winCount: 15, defeatCount: 3, winningRate: 83, scoreGap: +20),
LCKTeamRank(team: .gen, rank: 2, winCount: 14, defeatCount: 4, winningRate: 78, scoreGap: +18),
LCKTeamRank(team: .dk, rank: 3, winCount: 12, defeatCount: 6, winningRate: 67, scoreGap: +12),
LCKTeamRank(team: .hle, rank: 4, winCount: 11, defeatCount: 7, winningRate: 61, scoreGap: +9),
LCKTeamRank(team: .kt, rank: 5, winCount: 10, defeatCount: 8, winningRate: 56, scoreGap: +5),
LCKTeamRank(team: .drx, rank: 6, winCount: 8, defeatCount: 10, winningRate: 44, scoreGap: -2),
LCKTeamRank(team: .ns, rank: 7, winCount: 7, defeatCount: 11, winningRate: 39, scoreGap: -5),
LCKTeamRank(team: .bro, rank: 8, winCount: 5, defeatCount: 13, winningRate: 28, scoreGap: -10),
LCKTeamRank(team: .bfx, rank: 9, winCount: 4, defeatCount: 14, winningRate: 22, scoreGap: -15),
LCKTeamRank(team: .dnf, rank: 10, winCount: 3, defeatCount: 15, winningRate: 17, scoreGap: -18)
]

return .just(mockLCKTeamRanks)
.delay(for: .seconds(randomDelaySecond), scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}

func fetchNews(cursor: Int) -> AnyPublisher<[Announcement], WableError> {
let range: ClosedRange<Int>

switch cursor {
case -1:
range = 1...15
case 15:
range = 16...30
case 30:
range = 31...33
default:
return .just([])
.delay(for: .seconds(randomDelaySecond), scheduler: RunLoop.main)
.eraseToAnyPublisher()
}

return .just(range.map { id in
Announcement(
id: id,
title: "공지사항 \(id)",
imageURL: URL(string: Constant.imageURLText),
text: "이것은 공지사항 \(id)입니다.",
createdDate: Calendar.current.date(byAdding: .day, value: -id, to: Date())
)
})
.delay(for: .seconds(randomDelaySecond), scheduler: RunLoop.main)
.eraseToAnyPublisher()
}

func fetchNotice(cursor: Int) -> AnyPublisher<[Announcement], WableError> {
let range: ClosedRange<Int>

switch cursor {
case -1:
range = 1...15
case 15:
range = 16...30
case 30:
range = 31...33
default:
return .just([])
.delay(for: .seconds(randomDelaySecond), scheduler: RunLoop.main)
.eraseToAnyPublisher()
}

return .just(range.map { id in
Announcement(
id: id,
title: "공지사항 \(id)",
imageURL: URL(string: Constant.imageURLText),
text: "이것은 공지사항 \(id)입니다.",
createdDate: Calendar.current.date(byAdding: .day, value: -id, to: Date())
)
})
.delay(for: .seconds(randomDelaySecond), scheduler: RunLoop.main)
.eraseToAnyPublisher()
}

func fetchNewsNoticeNumber() -> AnyPublisher<(newsNumber: Int, noticeNumber: Int), WableError> {
return .fail(.networkError)
}

private var randomDelaySecond: Double { .random(in: 0.3...1.0) }

private enum Constant {
static let imageURLText: String = "https://private-user-images.githubusercontent.com/98076050/396859961-b02e03eb-6f64-4a44-88e2-88badb3d3b10.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDI4MzUxNzYsIm5iZiI6MTc0MjgzNDg3NiwicGF0aCI6Ii85ODA3NjA1MC8zOTY4NTk5NjEtYjAyZTAzZWItNmY2NC00YTQ0LTg4ZTItODhiYWRiM2QzYjEwLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAzMjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMzI0VDE2NDc1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzZWE1OTlhNDFhYzk5MGYwYWZiNDg4MGMwNDllOTMzNGE5MTFlZGQ2NDY5MmViZTgzZDhiMTM3YWE1ODY5NmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.LO8fsMErFZAKahjnYeQk8nHpzc3Cpug0n_-6fq3R4K4"
}
}
Loading