Skip to content

Commit

Permalink
Merge pull request #606 from DeveloperAcademy-POSTECH/release/v1.7.0_1
Browse files Browse the repository at this point in the history
[CHORE] v1.7.0 출시에 따라 main 브랜치를 업데이트합니다.
  • Loading branch information
MMMIIIN authored Nov 24, 2023
2 parents 9b0da19 + 895fa87 commit 94b46e3
Show file tree
Hide file tree
Showing 390 changed files with 10,167 additions and 5,745 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/XCTestBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
branches: [ develop, release, hotfix, feature, main ]
jobs:
build:
runs-on: self-hosted
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

Expand Down
1,244 changes: 867 additions & 377 deletions Manito/Manito.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

35 changes: 18 additions & 17 deletions Manito/Manito/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,43 @@

import AuthenticationServices
import UIKit
import UserNotifications

import Firebase
import UserNotifications
import MTResource

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
getCredentialState()
FirebaseApp.configure()

Messaging.messaging().delegate = self
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]

UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { _, _ in }
application.registerForRemoteNotifications()
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
Expand All @@ -51,17 +52,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
print("applicationWillEnterForeground")
getCredentialState()
}

func applicationDidBecomeActive(_ application: UIApplication) {
print("applicationDidBecomeActive")
getCredentialState()
}

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
print("[Log] deviceToken :", deviceTokenString)
let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
print("[Log] deviceToken :", deviceTokenString)

Messaging.messaging().apnsToken = deviceToken
Messaging.messaging().apnsToken = deviceToken
}
}

Expand Down Expand Up @@ -93,14 +94,14 @@ extension AppDelegate: MessagingDelegate {
print("파이어베이스 토큰: \(fcmToken ?? "")")
guard let token = fcmToken else { return }
UserDefaultHandler.setFcmToken(fcmToken: token)
}
}
}

extension AppDelegate: UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.badge, .sound])
}
}

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate
as? SceneDelegate else { return }
Expand Down
28 changes: 15 additions & 13 deletions Manito/Manito/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,37 @@
import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
let window = UIWindow(windowScene: windowScene)
let storyboard = UIStoryboard(name: "Splash", bundle: nil)
guard let viewController = storyboard.instantiateViewController(withIdentifier: SplashViewController.className) as? SplashViewController else { return }

window.rootViewController = viewController
let usecase = SplashUsecaseImpl()
let viewModel = SplashViewModel(usecase: usecase)
window.rootViewController = SplashViewController(viewModel: viewModel)
self.window = window
window.makeKeyAndVisible()
}

func sceneDidDisconnect(_ scene: UIScene) { }

func sceneDidBecomeActive(_ scene: UIScene) { }

func sceneWillResignActive(_ scene: UIScene) { }

func sceneWillEnterForeground(_ scene: UIScene) { }

func sceneDidEnterBackground(_ scene: UIScene) { }
}

extension SceneDelegate {
func moveToLoginViewController() {
let viewController = UINavigationController(rootViewController: LoginViewController())
window?.rootViewController = viewController
let repository = LoginRepositoryImpl()
let usecase = LoginUsecaseImpl(repository: repository)
let viewModel = LoginViewModel(usecase: usecase)
let viewController = LoginViewController(viewModel: viewModel)
window?.rootViewController = UINavigationController(rootViewController: viewController)
}

func changeRootViewWithLetterView(roomId: Int) {
Expand Down
22 changes: 22 additions & 0 deletions Manito/Manito/Data/DTO/Response/FriendListDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,39 @@

import Foundation

///
/// 방에 참여한 멤버들의 정보를 반환하는 데이터 모델 DTO입니다.
///

struct FriendListDTO: Decodable {
/// 멤버 수
let count: Int?
/// 멤버들 정보
let members: [MemberInfoDTO]?
}

extension FriendListDTO {
func toFriendList() -> FriendList {
return FriendList(count: self.count ?? 0,
members: self.members?.compactMap { $0.toMemberInfo() } ?? [])
}
}

struct MemberInfoDTO: Decodable {
/// 닉네임
let nickname: String?
/// 선택한 컬러 인덱스
let colorIndex: Int?

enum CodingKeys: String, CodingKey {
case nickname
case colorIndex = "colorIdx"
}
}

extension MemberInfoDTO {
func toMemberInfo() -> MemberInfo {
return MemberInfo(nickname: self.nickname ?? "",
colorIndex: self.colorIndex ?? 0)
}
}
12 changes: 12 additions & 0 deletions Manito/Manito/Data/DTO/Response/LoginDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ struct LoginDTO: Decodable {
let isNewMember: Bool?
let userSettingDone: Bool?
}

extension LoginDTO {
func toLoginInfo() -> LoginInfo {
return LoginInfo(
accessToken: self.accessToken ?? "",
refreshToken: self.refreshToken ?? "",
nickname: self.nickname ?? "",
isNewMember: self.isNewMember ?? true,
userSettingDone: self.userSettingDone ?? false
)
}
}
29 changes: 29 additions & 0 deletions Manito/Manito/Data/DTO/Response/MemoryDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,41 @@

import Foundation

///
/// 함께 했던 기억 화면 관련 내용을 반환하는
/// 데이터 모델 DTO입니다.
///

struct MemoryDTO: Decodable {
/// 마니또와의 추억
let memoriesWithManitto: MemoryItemDTO?
/// 마니띠와의 추억
let memoriesWithManittee: MemoryItemDTO?
}

extension MemoryDTO {
func toMemory() async -> Memory {
return await Memory(memoriesWithManitto: (self.memoriesWithManitto?.toMemoryItem())!,
memoriesWithManittee: (self.memoriesWithManittee?.toMemoryItem())!)
}
}

struct MemoryItemDTO: Decodable {
/// 마니또나 마니띠의 정보
let member: MemberInfoDTO?
/// 마니또, 마니띠와 주고 받았던 쪽지 내용
let messages: [MessageListItemDTO]?
}

extension MemoryItemDTO {
func toMemoryItem() async -> MemoryItem {
let memberInfo = MemberInfo(nickname: member?.nickname ?? "",
colorIndex: member?.colorIndex ?? 0)
var resultMessages: [MessageListItem] = []
for message in self.messages ?? [] {
resultMessages.append(await message.toMessageListItem(canReport: false))
}
return MemoryItem(member: memberInfo,
messages: resultMessages)
}
}
26 changes: 23 additions & 3 deletions Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,32 @@ struct MessageListItemDTO: Decodable {
}

extension MessageListItemDTO {
func toMessageListItem(canReport: Bool) -> MessageListItem {
return MessageListItem(id: self.id ?? 0,
func toMessageListItem(canReport: Bool) async -> MessageListItem {
return await MessageListItem(id: self.id ?? 0,
content: self.content,
imageUrl: self.imageUrl,
imageUrl: self.verifiedImageURL(),
createdDate: self.createdDate ?? "",
missionInfo: self.missionInfo,
canReport: canReport)
}

// MARK: - Private - func

/// DB에 이미지가 없는 imageURL를 걸러내고 검증된 imageURL만 반환
private func verifiedImageURL() async -> String? {
do {
guard let imageURL = self.imageUrl else { return nil }
guard let url = URL(string: imageURL) else { return nil }

let (_, response) = try await URLSession.shared.data(from: url)
guard let urlResponse = response as? HTTPURLResponse else { return nil }

switch urlResponse.statusCode {
case 200..<300: return self.imageUrl
default: return nil
}
} catch {
return nil
}
}
}
21 changes: 21 additions & 0 deletions Manito/Manito/Data/DTO/Response/ParticipatedRoomInfoDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,32 @@

import Foundation

///
/// 방 참가시 그 방의 정보들을 반환하는 데이터 모델 DTO 입니다.
///

struct ParticipatedRoomInfoDTO: Decodable {
/// 방 id
let id: Int?
/// 방 제목
let title: String?
/// 방 참여 가능 인원 수
let capacity: Int?
/// 현재 방 참가 인원 수
let participatingCount: Int?
/// 방 시작 날짜
let startDate: String?
/// 방 종료 날짜
let endDate: String?
}

extension ParticipatedRoomInfoDTO {
func toParticipateRoomInfo() -> ParticipatedRoomInfo {
return ParticipatedRoomInfo(id: self.id ?? 0,
title: self.title ?? "",
capacity: self.capacity ?? 0,
participatingCount: self.participatingCount ?? 0,
startDate: self.startDate ?? "",
endDate: self.endDate ?? "")
}
}
35 changes: 34 additions & 1 deletion Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ extension RoomInfoDTO {
}
}

extension RoomInfoDTO: Equatable {
static let testDummyRoomDTO = RoomInfoDTO(
roomInformation: RoomListItemDTO.testDummyRoomListItemDTO,
participants: ParticipantListDTO.testDummyParticipantListDTO,
manittee: UserInfoDTO.testDummyUserManittee,
manitto: UserInfoDTO.testDummyUserManitto,
invitation: InvitationCodeDTO.testDummyInvitationCodeDTO,
didViewRoulette: false,
mission: IndividualMissionDTO.testDummyIndividualMissionDTO,
admin: false,
messages: MessageCountInfoDTO.testDummyMessageInfoDTO
)
}

struct ParticipantListDTO: Decodable {
let count: Int?
let members: [UserInfoDTO]?
Expand All @@ -64,6 +78,13 @@ extension ParticipantListDTO {
}
}

extension ParticipantListDTO: Equatable {
static let testDummyParticipantListDTO = ParticipantListDTO(
count: 5,
members: UserInfoDTO.testDummyUserList
)
}

struct InvitationCodeDTO: Decodable {
let code: String?
}
Expand All @@ -74,6 +95,10 @@ extension InvitationCodeDTO {
}
}

extension InvitationCodeDTO: Equatable {
static let testDummyInvitationCodeDTO = InvitationCodeDTO(code: "ABCDEF")
}

/// 개별 미션에 대한 정보들을 반환하는 데이터 모델 DTO입니다.
struct IndividualMissionDTO: Decodable, Hashable {
/// 개별 미션 identifier
Expand All @@ -88,12 +113,20 @@ extension IndividualMissionDTO {
}
}

extension IndividualMissionDTO: Equatable {
static let testDummyIndividualMissionDTO = IndividualMissionDTO(id: 1, content: "테스트미션")
}

struct MessageCountInfoDTO: Decodable {
let count: Int?
}

extension MessageCountInfoDTO: Equatable {
extension MessageCountInfoDTO {
func toMessageCountInfo() -> MessageCountInfo {
return MessageCountInfo(count: self.count ?? 0)
}
}

extension MessageCountInfoDTO: Equatable {
static let testDummyMessageInfoDTO = MessageCountInfoDTO(count: 3)
}
Loading

0 comments on commit 94b46e3

Please sign in to comment.