Skip to content

Commit

Permalink
✨[feat]: 명언 알리이 추가 해서 명언을 핸덤하게 알림으로 보내준거 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy-wonji committed Dec 24, 2023
1 parent 7d514a6 commit 66b01f7
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import ProjectDescription
import Foundation




public extension Project {
public static func makeAppModule(
name: String,
Expand Down Expand Up @@ -54,7 +51,6 @@ public extension Project {

)


let testTarget = Target(
name: "\(name)Tests",
platform: platform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ extension Settings {
"MARKETING_VERSION": .string(.appVersion()),
"CURRENT_PROJECT_VERSION": .string(.appBuildVersion()),
"CODE_SIGN_STYLE": "Automatic",
"DEVELOPMENT_TEAM": "N94CS4N6VR", "DEBUG_INFORMATION_FORMAT": "DWARF with dSYM File"],configurations: [
"DEVELOPMENT_TEAM": "N94CS4N6VR",
"DEBUG_INFORMATION_FORMAT": "DWARF with dSYM File"],
configurations: [
.debug(name: .debug, settings: [
"PRODUCT_NAME": "PingPong",
"OTHER_LDFLAGS": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class CommonViewViewModel: ObservableObject {

}
@AppStorage("isFirstUserPOPUP") public var isFirstUserPOPUP: Bool = true
@Published public var randomQuoteBodyNotification: String = ""
@Published public var randomQuoteTitleNotification: String = ""

@Published public var isLoginCheck: Bool = false {
didSet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ public struct CoreView: View {
@StateObject var authViewModel: AuthorizationViewModel
@StateObject var viewModel: CommonViewViewModel
@StateObject var homeViewModel: HomeViewViewModel = HomeViewViewModel()
@StateObject var profileViewModel: ProfileViewModel = ProfileViewModel()

public init(
viewModel: CommonViewViewModel,
authViewModel: AuthorizationViewModel,
isFistUserPOPUP: Binding<Bool>
isFistUserPOPUP: Binding<Bool>
) {

self._viewModel = StateObject(wrappedValue: viewModel)
Expand All @@ -54,15 +55,15 @@ public struct CoreView: View {
.ignoresSafeArea(.keyboard)
}
.modal(with: sheetManager, viewModel: viewModel)

.popup(isPresented: $viewModel.isFirstUserPOPUP) {
CustomPOPUP(
image: .empty,
title: "좌우를 넘기며",
title1: "명언을 확인해보세요",
subTitle: "", useGif: true, confirmAction: {
isFistUserPOPUP = false
// viewModel.isFirstUserPOPUP = true
// viewModel.isFirstUserPOPUP = true
})
} customize: { popup in
popup
Expand Down Expand Up @@ -129,7 +130,17 @@ public struct CoreView: View {
}
}

})
}, notificationBodyContent: self.viewModel.randomQuoteBodyNotification, notificationTitleContent: self.viewModel.randomQuoteTitleNotification,
notificationChange: {
homeViewModel.randomQuoteRequest(userID: authViewModel.userid ) { model in
let randomQuote = model.data?.content.randomElement()
self.viewModel.randomQuoteBodyNotification = randomQuote?.content ?? ""
self.viewModel.randomQuoteTitleNotification = randomQuote?.author ?? ""
print("핸덤 컨테츠, \(randomQuote?.content), \(viewModel.randomQuoteBodyNotification)")

}
}
)
.environmentObject(sheetManager)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import SwiftUI
import PopupView

struct ChangeNickNameView: View {
@ObservedObject private var viewModel: ProfileViewViewModel
@ObservedObject private var viewModel: ProfileViewModel
@ObservedObject private var authViewModel: AuthorizationViewModel

var closeSheet: () -> Void



init(
viewModel: ProfileViewViewModel,
viewModel: ProfileViewModel,
authViewModel: AuthorizationViewModel,
closeSheet: @escaping () -> Void
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,37 @@ import PopupView
public struct ProfileView: View {
@StateObject private var appState: AppState
@StateObject private var viewModel: CommonViewViewModel
@StateObject private var profileViewModel: ProfileViewViewModel = ProfileViewViewModel()
@StateObject private var profileViewModel: ProfileViewModel = ProfileViewModel()
@StateObject var authViewModel: AuthorizationViewModel

@Environment(\.presentationMode) var presentationMode
@EnvironmentObject var sheetManager: SheetManager

var backAction: () -> Void
var cardChange: () -> Void
var notificationChange: () -> Void
var notificationBodyContent: String
var notificationTitleContent: String

public init(
viewModel: CommonViewViewModel,
appState: AppState,
backAction: @escaping () -> Void,
authViewModel: AuthorizationViewModel,
cardChange: @escaping() -> Void
cardChange: @escaping() -> Void,
notificationBodyContent: String,
notificationTitleContent: String,
notificationChange: @escaping() -> Void

) {
self._appState = StateObject(wrappedValue: appState)
self._viewModel = StateObject(wrappedValue: viewModel)
self.backAction = backAction
self._authViewModel = StateObject(wrappedValue: authViewModel)
self.cardChange = cardChange
self.notificationBodyContent = notificationBodyContent
self.notificationTitleContent = notificationTitleContent
self.notificationChange = notificationChange
}


Expand Down Expand Up @@ -116,7 +125,13 @@ public struct ProfileView: View {
}

.navigationDestination(isPresented: $profileViewModel.gotoNotificationQuoteView) {
NotificationQuoteView(authViewModel: authViewModel)
NotificationQuoteView(
profileViewModel: profileViewModel,
authViewModel: authViewModel,
notificationBodyContent: notificationBodyContent,
notificationTitleContent: notificationTitleContent,
notificationChange: notificationChange
)
.navigationBarBackButtonHidden()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public struct ProfileModalView: View {
let hashtagsTitleArray: [String] = ["유형", "성향"]

@StateObject var authViewModel: AuthorizationViewModel = AuthorizationViewModel()
let profileViewModel = ProfileViewViewModel()
let profileViewModel = ProfileViewModel()
@StateObject private var viewModel: CommonViewViewModel
@StateObject var exploreViewViewModel: ExploreViewModel = ExploreViewModel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,30 @@ import SwiftUI
import Common
import DesignSystem
import Authorization
import Model

struct NotificationQuoteView: View {
@StateObject private var profileViewModel: ProfileViewViewModel = ProfileViewViewModel()
@StateObject private var profileViewModel: ProfileViewModel
@StateObject var viewModel: CommonViewViewModel = CommonViewViewModel()
@StateObject var authViewModel: AuthorizationViewModel
var notificationBodyContent: String
var notificationTitleContent: String
var notificationChange: () -> Void
@Environment(\.presentationMode) var presentationMode

public init(
authViewModel: AuthorizationViewModel
profileViewModel: ProfileViewModel,
authViewModel: AuthorizationViewModel,
notificationBodyContent: String,
notificationTitleContent: String,
notificationChange: @escaping () -> Void
) {
self._profileViewModel = StateObject(wrappedValue: profileViewModel)
self._authViewModel = StateObject(wrappedValue: authViewModel)
self.notificationBodyContent = notificationBodyContent
self.notificationTitleContent = notificationTitleContent
self.notificationChange = notificationChange

}

var body: some View {
Expand Down Expand Up @@ -71,8 +85,9 @@ struct NotificationQuoteView: View {
if granted {
DispatchQueue.main.async {
let content = UNMutableNotificationContent()
content.title = "명언"
content.body = "오늘의 새로운 명언을 확인 해주세요!"
notificationChange()
content.title = "\(notificationTitleContent)"
content.body = "\(notificationBodyContent)"

// Extracting hour and minute from selectedTime
let calendar = Calendar.current
Expand Down Expand Up @@ -251,9 +266,10 @@ struct NotificationQuoteView: View {
completionHandler: { granted, _ in
if granted {
DispatchQueue.main.async {
notificationChange()
let content = UNMutableNotificationContent()
content.title = "명언"
content.body = "오늘의 새로운 명언을 확인 해주세요!"
content.title = "\(notificationTitleContent)"
content.body = "\(notificationBodyContent)"

// Extracting hour and minute from selectedTime
let calendar = Calendar.current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import DesignSystem


struct SelectTimeSheetView: View {
@ObservedObject private var viewModel: ProfileViewViewModel
@ObservedObject private var viewModel: ProfileViewModel

var closeSheetAction: () -> Void

public init(
viewModel: ProfileViewViewModel,
viewModel: ProfileViewModel,
closeSheetAction: @escaping () -> Void

) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import API
public struct OtherSettingView: View {
@StateObject private var appState: AppState
@StateObject private var viewModel: CommonViewViewModel
@StateObject private var profileViewModel: ProfileViewViewModel = ProfileViewViewModel()
@StateObject private var profileViewModel: ProfileViewModel = ProfileViewModel()
@StateObject var authViewModel: AuthorizationViewModel

@Environment(\.presentationMode) var presentationMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Moya
import API
import DesignSystem

public class ProfileViewViewModel: ObservableObject {
public class ProfileViewModel: ObservableObject {
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""

@Published var loadingWebView: Bool = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import PopupView


struct WithDrawView: View {
@StateObject private var profileViewModel: ProfileViewViewModel
@StateObject private var profileViewModel: ProfileViewModel
@StateObject var viewModel: CommonViewViewModel
@StateObject var authViewModel: AuthorizationViewModel
@Environment(\.presentationMode) var presentationMode

public init(
authViewModel: AuthorizationViewModel,
viewModel: CommonViewViewModel,
profileViewModel: ProfileViewViewModel
profileViewModel: ProfileViewModel
) {
self._authViewModel = StateObject(wrappedValue: authViewModel)
self._viewModel = StateObject(wrappedValue: viewModel)
Expand Down

0 comments on commit 66b01f7

Please sign in to comment.