Skip to content

Commit

Permalink
Release Version 1.6.3 (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
wngus4296 authored Sep 23, 2024
2 parents 9d35e4f + e813e2a commit 4b4f858
Show file tree
Hide file tree
Showing 52 changed files with 2,912 additions and 117 deletions.
171 changes: 163 additions & 8 deletions Boolti/Boolti.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions Boolti/Boolti/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import FirebaseMessaging

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

private let pushNotificationRepository = PushNotificationRepository(networkService: NetworkProvider())

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
RxKakaoSDK.initSDK(appKey: Environment.KAKAO_NATIVE_APP_KEY)
FirebaseApp.configure()

/// μ•± μ‹€ν–‰ μ‹œ μ•Œλ¦Ό ν—ˆμš© κΆŒν•œ λ°›κΈ° 및 ν•„μš”ν•œ κΆŒν•œ μ„€μ •
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
Expand All @@ -29,59 +29,59 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
completionHandler: { _, _ in }
)
application.registerForRemoteNotifications()

/// λ©”μ‹œμ§€ λŒ€λ¦¬μž μ„€μ •
Messaging.messaging().delegate = self

/// μžλ™ μ΄ˆκΈ°ν™” 방지
Messaging.messaging().isAutoInitEnabled = true

/// νƒ­ Bar index μ΄ˆκΈ°ν™”ν•˜κΈ°/destination μ΄ˆκΈ°ν™”ν•˜κΈ°
UserDefaults.tabBarIndex = 0
UserDefaults.landingDestination = nil

return true
}

/// fcm에 device token 등둝
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { }
}

// MARK: - MessagingDelegate

extension AppDelegate: MessagingDelegate {

/// 토큰 κ°±μ‹  λͺ¨λ‹ˆν„°λ§ & 토큰 κ°€μ Έμ˜€κΈ°
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
guard let fcmToken else { return }
debugPrint(fcmToken)
self.registerSubject()

// 토큰이 갱신될 경우
self.pushNotificationRepository.registerDeviceToken()
}

private func registerSubject() {
/// 주제 ꡬ독
let defaultTopic: String

#if DEBUG
#if DEBUG
defaultTopic = "dev"
#elseif RELEASE
#elseif RELEASE
defaultTopic = "prod"
#endif

#endif
Messaging.messaging().subscribe(toTopic: defaultTopic) { error in
if let error {
debugPrint(error)
Expand All @@ -95,30 +95,30 @@ extension AppDelegate: MessagingDelegate {
// MARK: - UNUserNotificationCenterDelegate

extension AppDelegate: UNUserNotificationCenterDelegate {

/// ν‘Έμ‹œ ν΄λ¦­μ‹œ
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {

let userInfo = response.notification.request.content.userInfo

if let notificationMessage = titleData(from: userInfo) {
self.configureDestination(with: notificationMessage)
}
completionHandler()
}

/// Foreground에 ν‘Έμ‹œμ•Œλ¦Όμ΄ 올 λ•Œ μ‹€ν–‰λ˜λŠ” λ©”μ„œλ“œ
func userNotificationCenter(_ center: UNUserNotificationCenter,willPresent notification: UNNotification,withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.badge, .sound, .list, .banner])
}

private func titleData(from userInfo: [AnyHashable : Any]) -> NotificationMessage? {
guard let messageType = userInfo["type"] as? String else { return nil }
return NotificationMessage(messageType)
}

private func configureDestination(with notificationMessage: NotificationMessage) {
UserDefaults.tabBarIndex = notificationMessage.tabBarIndex
NotificationCenter.default.post(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "add_circle.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "camera.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "link.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "pencil.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
13 changes: 13 additions & 0 deletions Boolti/Boolti/Sources/Entities/Auth/ProfileEntity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ProfileEntity.swift
// Boolti
//
// Created by Juhyeon Byun on 9/7/24.
//

struct ProfileEntity {
let profileImageURL: String
let nickname: String
let introduction: String
var links: [LinkEntity]
}
34 changes: 30 additions & 4 deletions Boolti/Boolti/Sources/Network/APIs/AuthAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ enum AuthAPI {
case refresh(requestDTO: TokenRefreshRequestDTO)
case resign(requestDTO: ResignRequestDTO)
case user
case editProfile(requestDTO: EditProfileRequestDTO)
case getUploadImageURL
case uploadProfileImage(data: UploadProfileImageRequestDTO)
}

extension AuthAPI: ServiceAPI {

var baseURL: URL {
switch self {
case .uploadProfileImage(let data):
return URL(string: data.uploadUrl)!
default:
return URL(string: Environment.BASE_URL)!
}
}

var path: String {
switch self {
case .login(let provider, _):
Expand All @@ -31,8 +43,12 @@ extension AuthAPI: ServiceAPI {
return "/papi/v1/signup/sns"
case .refresh:
return "/papi/v1/login/refresh"
case .resign, .user:
case .resign, .user, .editProfile:
return "/api/v1/user"
case .getUploadImageURL:
return "/api/v1/user/profile-images/upload-urls"
case .uploadProfileImage:
return ""
}
}

Expand All @@ -42,17 +58,23 @@ extension AuthAPI: ServiceAPI {
return .delete
case .user:
return .get
case .editProfile:
return .patch
case .uploadProfileImage:
return .put
default:
return .post
}
}

var headers: [String : String]? {
switch self {
case .logout, .user:
case .logout, .user, .getUploadImageURL:
return nil
case .login, .refresh, .signup, .resign:
case .login, .refresh, .signup, .resign, .editProfile:
return ["Content-Type": "application/json"]
case .uploadProfileImage:
return ["Content-Type": "image/jpeg"]
}
}

Expand All @@ -67,14 +89,18 @@ extension AuthAPI: ServiceAPI {
params = ["idToken": DTO.accessToken]
}
return .requestParameters(parameters: params, encoding: JSONEncoding.prettyPrinted)
case .logout, .user:
case .logout, .user, .getUploadImageURL:
return .requestPlain
case .signup(let DTO):
return .requestJSONEncodable(DTO)
case .refresh(let DTO):
return .requestJSONEncodable(DTO)
case .resign(let DTO):
return .requestJSONEncodable(DTO)
case .editProfile(let DTO):
return .requestJSONEncodable(DTO)
case .uploadProfileImage(let DTO):
return .requestData(DTO.imageData.jpegData(compressionQuality: 0.8) ?? Data())
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// EditProfileRequestDTO.swift
// Boolti
//
// Created by Juhyeon Byun on 9/5/24.
//

struct EditProfileRequestDTO: Encodable {
let nickname: String
let profileImagePath: String
let introduction: String
let link: [LinkEntity]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// UploadProfileImageRequestDTO.swift
// Boolti
//
// Created by Juhyeon Byun on 9/6/24.
//

import UIKit

struct UploadProfileImageRequestDTO {

let uploadUrl: String
let imageData: UIImage

init(uploadUrl: String, image: UIImage) {
self.uploadUrl = uploadUrl
self.imageData = image
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// GetUploadURLReponseDTO.swift
// Boolti
//
// Created by Juhyeon Byun on 9/6/24.
//

struct GetUploadURLReponseDTO: Decodable {

let uploadUrl: String
let expectedUrl: String

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ struct UserResponseDTO: Decodable {
let userCode: String?
let email: String?
let imgPath: String?
let introduction: String?
let link: [LinkEntity]?

}

struct LinkEntity: Codable, Equatable {
let title: String
let link: String
}
12 changes: 8 additions & 4 deletions Boolti/Boolti/Sources/Network/Foundation/AuthInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ final class AuthInterceptor: RequestInterceptor {

var urlRequest = urlRequest

urlRequest.headers.add(.authorization(bearerToken: UserDefaults.accessToken))

debugPrint("πŸ”₯ μš”μ²­ν•œ AccessToken: \(UserDefaults.accessToken) πŸ”₯")
debugPrint("πŸ”₯ μš”μ²­ν•œ userId: \(UserDefaults.userId) πŸ”₯")
if urlRequest.method == .put {
debugPrint("πŸ”₯ 이미지 μ—…λ‘œλ“œ μš”μ²­ πŸ”₯")
} else {
urlRequest.headers.add(.authorization(bearerToken: UserDefaults.accessToken))

debugPrint("πŸ”₯ μš”μ²­ν•œ AccessToken: \(UserDefaults.accessToken) πŸ”₯")
debugPrint("πŸ”₯ μš”μ²­ν•œ userId: \(UserDefaults.userId) πŸ”₯")
}

completion(.success(urlRequest))
}
Expand Down
Loading

0 comments on commit 4b4f858

Please sign in to comment.