Skip to content

Commit 1ae2344

Browse files
authored
Merge pull request #100 from EAT-SSU/develop
[QA] v2.1.0 ์„ ํ…Œ์ŠคํŠธ ํ”Œ๋ผ์ดํŠธ์— ์˜ฌ๋ฆฝ๋‹ˆ๋‹ค.
2 parents 026cc3d + becb3a2 commit 1ae2344

File tree

290 files changed

+1412
-1349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+1412
-1349
lines changed

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Resources/Images.xcassets/version1/Contents.json renamed to โ€ŽEATSSU_MVC/EATSSU_MVC/Resources/Assets/Images.xcassets/version2/Contents.json

+3
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"info" : {
33
"author" : "xcode",
44
"version" : 1
5+
},
6+
"properties" : {
7+
"provides-namespace" : true
58
}
69
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "KakaoLoginButton.svg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "LookAroundButton.svg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "Unsubscribe.png",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Resources/Images.xcassets/version2/KakaoLoginButton.imageset/Contents.json

-21
This file was deleted.

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Resources/Images.xcassets/version2/LookAroundButton.imageset/Contents.json

-21
This file was deleted.

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Resources/SplashEvent.png

-25.7 KB
Binary file not shown.

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Utility/Firebase/NoticeViewController.swift renamed to โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Data/Firebase/NoticeViewController.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import UIKit
99

1010
import SnapKit
1111

12-
class NoticeViewController:BaseViewController {
12+
/// FirebaseRemoteConfig ๊ด€๋ จ ViewController
13+
class NoticeViewController: BaseViewController {
1314

1415
// MARK: - Properties
1516
var noticeMessage: String

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Network/LocalDB/RealmService.swift renamed to โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Data/LocalDB/RealmService.swift

+14-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class RealmService{
1313
static let shared = RealmService()
1414

1515
let realm = try! Realm()
16+
17+
init() {
18+
print("Realm Location: ", realm.configuration.fileURL ?? "cannot find location.")
19+
}
1620

1721
func addToken(accessToken:String,refreshToken:String) {
1822
let token = Token(accessToken: accessToken,refreshToken: refreshToken)
@@ -40,20 +44,19 @@ class RealmService{
4044
try! realm.write {
4145
realm.deleteAll()
4246
}
43-
4447
}
45-
46-
func addUser(accessToken: String, nickName: String) {
47-
let nickName = NickName(accessToken: accessToken, nickName: nickName)
48-
try! realm.write {
49-
realm.add(nickName)
48+
49+
func deleteAll<T: Object>(_ objectType: T.Type) {
50+
do {
51+
let objects = realm.objects(objectType)
52+
try realm.write {
53+
realm.delete(objects)
54+
print("Successfully deleted all objects of type \(objectType)")
55+
}
56+
} catch let error {
57+
print(error)
5058
}
5159
}
52-
53-
init() {
54-
print("Realm Location: ", realm.configuration.fileURL ?? "cannot find location.")
55-
}
56-
5760
}
5861

5962

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// UserInfo.swift
3+
// EatSSU-iOS
4+
//
5+
// Created by ๋ฐ•์œค๋นˆ on 2023/08/02.
6+
//
7+
8+
import RealmSwift
9+
import Realm
10+
11+
class UserInfo: Object {
12+
13+
@Persisted(primaryKey: true) var id: String = UUID().uuidString
14+
@Persisted var nickname: String = ""
15+
@Persisted private var accountTypeRaw: String?
16+
17+
var accountType: AccountType? {
18+
get {
19+
guard let rawValue = accountTypeRaw else { return nil }
20+
return AccountType(rawValue: rawValue)
21+
}
22+
set {
23+
accountTypeRaw = newValue?.rawValue
24+
}
25+
}
26+
27+
convenience init(accountType: AccountType) {
28+
self.init()
29+
self.accountType = accountType
30+
}
31+
32+
func updateNickname(_ nickname: String) {
33+
self.nickname = nickname
34+
}
35+
36+
enum AccountType: String {
37+
case apple = "Apple"
38+
case kakao = "Kakao"
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// UserInfoManager.swift
3+
// EATSSU
4+
//
5+
// Created by ์ตœ์ง€์šฐ on 9/19/24.
6+
//
7+
8+
import RealmSwift
9+
10+
class UserInfoManager {
11+
static let shared = UserInfoManager()
12+
private init() {}
13+
14+
private var realm: Realm {
15+
do {
16+
return try Realm()
17+
} catch {
18+
fatalError("Realm์„ ์ดˆ๊ธฐํ™”ํ•˜๋Š”๋ฐ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค: \(error)")
19+
}
20+
}
21+
22+
func createUserInfo(accountType: UserInfo.AccountType) -> UserInfo {
23+
let userInfo = UserInfo(accountType: accountType)
24+
do {
25+
try realm.write {
26+
realm.add(userInfo)
27+
}
28+
return userInfo
29+
} catch {
30+
print("UserInfo ์ƒ์„ฑ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ: \(error)")
31+
return userInfo
32+
}
33+
}
34+
35+
func updateNickname(for userInfo: UserInfo, nickname: String) {
36+
do {
37+
try realm.write {
38+
userInfo.updateNickname(nickname)
39+
}
40+
} catch {
41+
print("๋‹‰๋„ค์ž„ ์—…๋ฐ์ดํŠธ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ: \(error)")
42+
}
43+
}
44+
45+
func getCurrentUserInfo() -> UserInfo? {
46+
return realm.objects(UserInfo.self).first
47+
}
48+
}

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Network/LocalDB/NickName.swift

-21
This file was deleted.

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Notification/NotificationManager.swift

+50-48
Original file line numberDiff line numberDiff line change
@@ -9,63 +9,65 @@ import Foundation
99
import UserNotifications
1010

1111
class NotificationManager {
12-
13-
// MARK: - Properties
14-
15-
static let shared = NotificationManager()
12+
// MARK: - Properties
1613

17-
// MARK: - Methods
14+
static let shared = NotificationManager()
1815

19-
/// ํ‰์ผ 11์‹œ์— ์•ฑ์˜ ์œ ์ž…์„ ์œ ๋„ํ•˜๋Š” ์•Œ๋ฆผ์„ ๋ฐœ์†กํ•˜๋Š” ๋ฉ”์†Œ๋“œ
20-
///
21-
/// - Title : ๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ
22-
/// - Body : ์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”!
23-
func scheduleWeekday11AMNotification() {
24-
let center = UNUserNotificationCenter.current()
16+
// MARK: - Methods
2517

26-
// ์•Œ๋ฆผ ์ฝ˜ํ…์ธ  ์„ค์ •
27-
let content = UNMutableNotificationContent()
18+
/// ํ‰์ผ 11์‹œ์— ์•ฑ์˜ ์œ ์ž…์„ ์œ ๋„ํ•˜๋Š” ํ‘ธ์‹œ ์•Œ๋ฆผ์„ ๋ฐœ์†กํ•˜๋Š” ๋ฉ”์†Œ๋“œ
19+
///
20+
/// - Title : ๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ
21+
/// - Body : ์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”!
22+
func scheduleWeekday11AMNotification() {
23+
let center = UNUserNotificationCenter.current()
2824

29-
content.title = TextLiteral.Notification.dailyWeekdayNotificationTitle
30-
content.body = TextLiteral.Notification.dailyWeekdayNotificationBody
31-
content.sound = .default
25+
// ์•Œ๋ฆผ ์ฝ˜ํ…์ธ  ์„ค์ •
26+
let content = UNMutableNotificationContent()
3227

33-
// ๋ฐ˜๋ณตํ•  ์š”์ผ ๋ฐ ์‹œ๊ฐ„ ์„ค์ • (ํ‰์ผ ์˜ค์ „ 11์‹œ)
34-
let calendar = Calendar.current
35-
let weekdays = [2, 3, 4, 5, 6] // ์›”, ํ™”, ์ˆ˜, ๋ชฉ, ๊ธˆ (Calendar์—์„œ 1์ด ์ผ์š”์ผ)
28+
content.title = TextLiteral.Notification.dailyWeekdayNotificationTitle
29+
content.body = TextLiteral.Notification.dailyWeekdayNotificationBody
30+
content.sound = .default
3631

37-
for weekday in weekdays {
38-
var dateComponents = DateComponents()
39-
dateComponents.hour = 11
40-
dateComponents.minute = 0
41-
dateComponents.weekday = weekday
32+
// ๋ฐ˜๋ณตํ•  ์š”์ผ ๋ฐ ์‹œ๊ฐ„ ์„ค์ • (ํ‰์ผ ์˜ค์ „ 11์‹œ)
33+
let weekdays = [2, 3, 4, 5, 6] // ์›”, ํ™”, ์ˆ˜, ๋ชฉ, ๊ธˆ (Calendar์—์„œ 1์ด ์ผ์š”์ผ)
4234

43-
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
35+
for weekday in weekdays {
36+
var dateComponents = DateComponents()
37+
dateComponents.hour = 11
38+
dateComponents.minute = 0
39+
dateComponents.weekday = weekday
4440

45-
// ๊ณ ์œ ํ•œ ์‹๋ณ„์ž๋ฅผ ์œ„ํ•ด weekday๋ฅผ ์‚ฌ์šฉ
46-
let identifier = "weekdayNotification-\(weekday)"
47-
let request = UNNotificationRequest(
48-
identifier: identifier, content: content, trigger: trigger)
41+
let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
4942

50-
// ์•Œ๋ฆผ ๋“ฑ๋ก
51-
center.add(request) { error in
52-
if let error = error {
53-
print("์•Œ๋ฆผ ๋“ฑ๋ก ๊ฐ„ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€: \(error.localizedDescription)")
54-
}
55-
}
56-
}
57-
}
43+
// ๊ณ ์œ ํ•œ ์‹๋ณ„์ž๋ฅผ ์œ„ํ•ด weekday๋ฅผ ์‚ฌ์šฉ
44+
let identifier = "weekdayNotification-\(weekday)"
45+
let request = UNNotificationRequest(
46+
identifier: identifier, content: content, trigger: trigger)
5847

59-
/// ์•ฑ ์‹คํ–‰ ์‹œ ์•Œ๋ฆผ ๋ฐœ์†ก ๊ถŒํ•œ์„ ์š”์ฒญํ•˜๋Š” ํŒ์—… ํ˜ธ์ถœ ๋ฉ”์†Œ๋“œ
60-
func requestNotificationPermission() {
61-
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
62-
granted, error in
63-
if granted {
64-
print("์•Œ๋ฆผ ๊ถŒํ•œ ์Šน์ธ๋จ")
65-
} else {
66-
print("์•Œ๋ฆผ ๊ถŒํ•œ ๊ฑฐ๋ถ€๋จ")
67-
}
68-
}
69-
}
48+
// ์•Œ๋ฆผ ๋“ฑ๋ก
49+
center.add(request) { error in
50+
if let error = error {
51+
print("์•Œ๋ฆผ ๋“ฑ๋ก ๊ฐ„ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€: \(error.localizedDescription)")
52+
}
53+
}
54+
}
55+
}
7056

57+
/// ํ‰์ผ 11์‹œ์— ์•ฑ์˜ ์œ ์ž…์„ ์œ ๋„ํ•˜๋Š” ํ‘ธ์‹œ ์•Œ๋ฆผ์„ ์ทจ์†Œํ•˜๋Š” ๋ฉ”์†Œ๋“œ
58+
func cancelWeekday11AMNotification() {
59+
let weekday = [2, 3, 4, 5, 6]
60+
let identifier = "weekdayNotification-\(weekday)"
61+
62+
let center = UNUserNotificationCenter.current()
63+
center.removePendingNotificationRequests(withIdentifiers: [identifier])
64+
}
65+
66+
/// ์•ฑ ์‹คํ–‰ ์‹œ ์•Œ๋ฆผ ๋ฐœ์†ก ๊ถŒํ•œ์„ ์š”์ฒญํ•˜๋Š” ํŒ์—… ํ˜ธ์ถœ ๋ฉ”์†Œ๋“œ
67+
func requestNotificationPermission(completion: @escaping (_ granted : Bool) -> Void) {
68+
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
69+
granted, _ in
70+
completion(granted)
71+
}
72+
}
7173
}

Diff for: โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Screen/Auth/ViewController/LoginViewController.swift renamed to โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Presentation/Auth/ViewController/LoginViewController.swift

+5
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ final class LoginViewController: BaseViewController {
135135
case nil:
136136
self.pushToNicknameVC()
137137
default:
138+
if let currentUserInfo = UserInfoManager.shared.getCurrentUserInfo() {
139+
UserInfoManager.shared.updateNickname(for: currentUserInfo, nickname: info.nickname ?? "")
140+
}
138141
self.changeIntoHomeViewController()
139142
}
140143
}
@@ -194,6 +197,7 @@ extension LoginViewController {
194197
let responseData = try moyaResponse.map(BaseResponse<SignResponse>.self)
195198
self.addTokenInRealm(accessToken: responseData.result.accessToken,
196199
refreshToken: responseData.result.refreshToken)
200+
let userInfo = UserInfoManager.shared.createUserInfo(accountType: .kakao)
197201
self.getMyInfo()
198202
} catch(let err) {
199203
self.presentBottomAlert(err.localizedDescription)
@@ -231,6 +235,7 @@ extension LoginViewController {
231235
let responseData = try JSONDecoder().decode(BaseResponse<SignResponse>.self, from: moyaResponse.data)
232236
self.addTokenInRealm(accessToken: responseData.result.accessToken,
233237
refreshToken: responseData.result.refreshToken)
238+
let userInfo = UserInfoManager.shared.createUserInfo(accountType: .apple)
234239
self.getMyInfo()
235240
} catch(let err) {
236241
self.presentBottomAlert(err.localizedDescription)

0 commit comments

Comments
ย (0)