Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Daily.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
F6B151702EDD2A1C00813BAF /* SettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6B1516F2EDD2A1C00813BAF /* SettingViewModel.swift */; };
F6B151752EDD7B7A00813BAF /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F6B151732EDD7B7A00813BAF /* Localizable.strings */; };
F6B151782EDD7FB100813BAF /* LanguageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6B151772EDD7FB100813BAF /* LanguageManager.swift */; };
F6B591F8305234CA00F3EBBA /* VersionTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6B591F7305234CA00F3EBBA /* VersionTypes.swift */; };
F6BEC935290F5894005EAF28 /* DailyApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6BEC934290F5894005EAF28 /* DailyApp.swift */; };
F6BEC939290F5895005EAF28 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F6BEC938290F5895005EAF28 /* Assets.xcassets */; };
F6BEC93D290F5895005EAF28 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F6BEC93C290F5895005EAF28 /* Preview Assets.xcassets */; };
Expand Down Expand Up @@ -273,6 +274,7 @@
F6B151742EDD7B7A00813BAF /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; };
F6B151762EDD7BA400813BAF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
F6B151772EDD7FB100813BAF /* LanguageManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LanguageManager.swift; sourceTree = "<group>"; };
F6B591F7305234CA00F3EBBA /* VersionTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VersionTypes.swift; sourceTree = "<group>"; };
F6BEC931290F5894005EAF28 /* Daily.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Daily.app; sourceTree = BUILT_PRODUCTS_DIR; };
F6BEC934290F5894005EAF28 /* DailyApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyApp.swift; sourceTree = "<group>"; };
F6BEC938290F5895005EAF28 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -771,6 +773,7 @@
F6DB67A42F34670C0088893B /* Notifications.swift */,
F6573325304669EE00C641F8 /* DeleteScope.swift */,
F65733273046774E00C641F8 /* StatisticsTypes.swift */,
F6B591F7305234CA00F3EBBA /* VersionTypes.swift */,
);
path = Enums;
sourceTree = "<group>";
Expand Down Expand Up @@ -1009,6 +1012,7 @@
F6C6B0342BB424DD00C578C1 /* AppInfoContent.swift in Sources */,
F6E1CD782DBC97E6009E25DA /* WeekIndicator.swift in Sources */,
F6C6CD912D6B703B00772E59 /* NavigationObject.swift in Sources */,
F6B591F8305234CA00F3EBBA /* VersionTypes.swift in Sources */,
F67DD7A82E0E48240001203D /* DailyPicker.swift in Sources */,
F6C758D62CCB123700F9CF91 /* CalendarHeader.swift in Sources */,
F6E1CCDA2DAEAF88009E25DA /* YearDataModel.swift in Sources */,
Expand Down Expand Up @@ -1238,7 +1242,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.seungyong96.Daily;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down Expand Up @@ -1283,7 +1287,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 12.3;
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.seungyong96.Daily;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down Expand Up @@ -1318,7 +1322,7 @@
"@executable_path/../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.seungyong96.Daily.DailyWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1356,7 +1360,7 @@
"@executable_path/../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
PRODUCT_BUNDLE_IDENTIFIER = com.seungyong96.Daily.DailyWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down
14 changes: 14 additions & 0 deletions Daily/Domain/Entities/Enums/VersionTypes.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// VersionTypes.swift
// Daily
//
// Created by seungyooooong on 9/10/26.
//

import Foundation

enum VersionTypes: Int {
case major = 0
case minor = 1
case patch = 2
}
26 changes: 19 additions & 7 deletions Daily/Domain/Usecases/AppLaunchUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,37 @@ final class AppLaunchUseCase {

extension AppLaunchUseCase {
func getNotices() async -> [NoticeModel] {
if let ignoreNoticeDate = UserDefaultManager.ignoreNoticeDate, ignoreNoticeDate >= Date(format: .daily) { return [] }
var notices: Array<NoticeModel> = []

let imageName = UserDefaultManager.language == .korean ? "daily_2.2_update" : "daily_2.2_update_en"
let notices = [
NoticeModel(id: 0, type: .image, image: imageName)
]
if let ignoreNoticeDate = UserDefaultManager.ignoreNoticeDate, ignoreNoticeDate >= Date(format: .daily) { return notices }

if await checkUpdate(.patch) {
let imageName = UserDefaultManager.language == .korean ? "daily_2.2_update" : "daily_2.2_update_en"

notices.append(NoticeModel(id: 0, type: .image, image: imageName))

}

// MARK: sheet animation을 고려해 0.5초 추가 딜레이
try? await Task.sleep(nanoseconds: 500_000_000)

return notices
}

func checkUpdate() async -> Bool {
func checkUpdate(_ targetVersion: VersionTypes...) async -> Bool {
do {
let storeVersion = try await System.getStoreVersion().split(separator: ".").map {$0}
let appVersion = System.appVersion!.split(separator: ".").map {$0}

return ((storeVersion[0] > appVersion[0]) || (storeVersion[1] > appVersion[1]))
let major = VersionTypes.major.rawValue
let minor = VersionTypes.minor.rawValue
let patch = VersionTypes.patch.rawValue

return (
(targetVersion.contains(.major) && (storeVersion[major] > appVersion[major])) ||
(targetVersion.contains(.minor) && (storeVersion[minor] > appVersion[minor])) ||
(targetVersion.contains(.patch) && (storeVersion[patch] > appVersion[patch]))
)
} catch {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion Daily/Presentation/Splash/SplashViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class SplashViewModel: ObservableObject {

func onAppear() {
Task { @MainActor in
isNeedUpdate = await appLaunchUseCase.checkUpdate()
isNeedUpdate = await appLaunchUseCase.checkUpdate(.major, .minor)
if isNeedUpdate { return }

CalendarServices.shared.calculateSymbolNum()
Expand Down