diff --git a/ChuanhuWallpaper.xcodeproj/project.pbxproj b/ChuanhuWallpaper.xcodeproj/project.pbxproj index 00cef5a..d084acf 100644 --- a/ChuanhuWallpaper.xcodeproj/project.pbxproj +++ b/ChuanhuWallpaper.xcodeproj/project.pbxproj @@ -341,7 +341,7 @@ CODE_SIGN_ENTITLEMENTS = ChuanhuWallpaper/ChuanhuWallpaper.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEVELOPMENT_ASSET_PATHS = "\"ChuanhuWallpaper/Preview Content\""; DEVELOPMENT_TEAM = KWS26AWJ45; ENABLE_HARDENED_RUNTIME = YES; @@ -369,7 +369,7 @@ CODE_SIGN_ENTITLEMENTS = ChuanhuWallpaper/ChuanhuWallpaper.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEVELOPMENT_ASSET_PATHS = "\"ChuanhuWallpaper/Preview Content\""; DEVELOPMENT_TEAM = KWS26AWJ45; ENABLE_HARDENED_RUNTIME = YES; diff --git a/ChuanhuWallpaper/AppearanceWallpaperView.swift b/ChuanhuWallpaper/AppearanceWallpaperView.swift index 437497c..6f83f71 100644 --- a/ChuanhuWallpaper/AppearanceWallpaperView.swift +++ b/ChuanhuWallpaper/AppearanceWallpaperView.swift @@ -58,7 +58,7 @@ struct AppearanceWallpaperView: View { } } .padding() - SubmitButton(wallpapers: wallpapers) + SubmitButton(wallpapers: wallpapers, disableSubmit: currentSelectedNum < 2) .padding(.bottom) } } diff --git a/ChuanhuWallpaper/SolarWallpaperView.swift b/ChuanhuWallpaper/SolarWallpaperView.swift index 6365b03..67497ac 100644 --- a/ChuanhuWallpaper/SolarWallpaperView.swift +++ b/ChuanhuWallpaper/SolarWallpaperView.swift @@ -82,7 +82,7 @@ struct SolarWallpaperView: View { } label: { Label("Add New Picture", systemImage: "doc.badge.plus") } - SubmitButton(wallpapers: wallpapers) + SubmitButton(wallpapers: wallpapers, disableSubmit: wallpapers.count < 2) HelpButton { self.showPopover.toggle() diff --git a/ChuanhuWallpaper/SubmitButton.swift b/ChuanhuWallpaper/SubmitButton.swift index 7358a02..e0bbbda 100644 --- a/ChuanhuWallpaper/SubmitButton.swift +++ b/ChuanhuWallpaper/SubmitButton.swift @@ -13,6 +13,7 @@ struct SubmitButton: View { @State var showErrorMessage = false @State var errorMessage = "" let wallpaperGenerator = WallpaperGenerator() + var disableSubmit = false var body: some View { Button { @@ -41,7 +42,7 @@ struct SubmitButton: View { .alert(isPresented: $showErrorMessage) { Alert(title: Text("An Error Occured"), message: Text(errorMessage), dismissButton: .cancel()) } - .disabled(wallpapers.count<2) + .disabled(disableSubmit) } } diff --git a/ChuanhuWallpaper/TimeWallpaperView.swift b/ChuanhuWallpaper/TimeWallpaperView.swift index 88d7bb1..dd82f30 100644 --- a/ChuanhuWallpaper/TimeWallpaperView.swift +++ b/ChuanhuWallpaper/TimeWallpaperView.swift @@ -85,7 +85,7 @@ struct TimeWallpaperView: View { } label: { Label("Add New Picture", systemImage: "doc.badge.plus") } - SubmitButton(wallpapers: wallpapers) + SubmitButton(wallpapers: wallpapers, disableSubmit: wallpapers.count < 2) HelpButton { self.showPopover.toggle() }