diff --git a/AnimeGen.xcodeproj/project.pbxproj b/AnimeGen.xcodeproj/project.pbxproj index 87dec9ec..414cdcbe 100644 --- a/AnimeGen.xcodeproj/project.pbxproj +++ b/AnimeGen.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ 138661252B8136DC0062AC91 /* nekosapi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138661242B8136DC0062AC91 /* nekosapi.swift */; }; 13877B192B82001800251A60 /* SettingsPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13877B182B82001800251A60 /* SettingsPage.swift */; }; 13877B1E2B82024A00251A60 /* AboutPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13877B1D2B82024A00251A60 /* AboutPage.swift */; }; + 138A42142BD02D24008B03F4 /* popup-Banner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138A42132BD02D24008B03F4 /* popup-Banner.swift */; }; 13910EBE2B80D380009BF17E /* ImageExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13910EBD2B80D380009BF17E /* ImageExtensions.swift */; }; 13910EC02B80D396009BF17E /* UIExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13910EBF2B80D396009BF17E /* UIExtensions.swift */; }; 13910EC52B80D5A6009BF17E /* pic-re.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13910EC42B80D5A6009BF17E /* pic-re.swift */; }; @@ -61,6 +62,7 @@ 138661242B8136DC0062AC91 /* nekosapi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = nekosapi.swift; sourceTree = ""; }; 13877B182B82001800251A60 /* SettingsPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsPage.swift; sourceTree = ""; }; 13877B1D2B82024A00251A60 /* AboutPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutPage.swift; sourceTree = ""; }; + 138A42132BD02D24008B03F4 /* popup-Banner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "popup-Banner.swift"; sourceTree = ""; }; 13910EBD2B80D380009BF17E /* ImageExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageExtensions.swift; sourceTree = ""; }; 13910EBF2B80D396009BF17E /* UIExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIExtensions.swift; sourceTree = ""; }; 13910EC42B80D5A6009BF17E /* pic-re.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "pic-re.swift"; sourceTree = ""; }; @@ -188,6 +190,7 @@ children = ( 13910EBD2B80D380009BF17E /* ImageExtensions.swift */, 13910EBF2B80D396009BF17E /* UIExtensions.swift */, + 138A42132BD02D24008B03F4 /* popup-Banner.swift */, ); path = Extensions; sourceTree = ""; @@ -278,6 +281,7 @@ 13910EC72B80D5B9009BF17E /* waifu-im.swift in Sources */, 13877B192B82001800251A60 /* SettingsPage.swift in Sources */, 13BE98C02B828B8000379AB7 /* nekosmoe.swift in Sources */, + 138A42142BD02D24008B03F4 /* popup-Banner.swift in Sources */, 130A80572B78C02E0028985F /* ViewController.swift in Sources */, 130A80532B78C02E0028985F /* AppDelegate.swift in Sources */, 130A80552B78C02E0028985F /* SceneDelegate.swift in Sources */, @@ -445,7 +449,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = AnimeGen/AnimeGen.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 399LMK6Q2Y; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = AnimeGen/Info.plist; @@ -480,7 +484,7 @@ CODE_SIGN_ENTITLEMENTS = AnimeGen/AnimeGen.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 20; DEVELOPMENT_TEAM = 399LMK6Q2Y; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = AnimeGen/Info.plist; diff --git a/AnimeGen.xcodeproj/project.xcworkspace/xcuserdata/Francesco.xcuserdatad/UserInterfaceState.xcuserstate b/AnimeGen.xcodeproj/project.xcworkspace/xcuserdata/Francesco.xcuserdatad/UserInterfaceState.xcuserstate index ef1233bd..da4bb168 100644 Binary files a/AnimeGen.xcodeproj/project.xcworkspace/xcuserdata/Francesco.xcuserdatad/UserInterfaceState.xcuserstate and b/AnimeGen.xcodeproj/project.xcworkspace/xcuserdata/Francesco.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/AnimeGen/APIs/kyoko.swift b/AnimeGen/APIs/kyoko.swift index 7b1afc2e..7972fbdd 100644 --- a/AnimeGen/APIs/kyoko.swift +++ b/AnimeGen/APIs/kyoko.swift @@ -9,7 +9,7 @@ import UIKit extension ViewController { - func loadImageAndTagsFromKyoko() { + func loadImageFromKyoko() { startLoadingIndicator() let categories: [String] diff --git a/AnimeGen/APIs/nekos-best.swift b/AnimeGen/APIs/nekos-best.swift index 60e07606..01df6513 100644 --- a/AnimeGen/APIs/nekos-best.swift +++ b/AnimeGen/APIs/nekos-best.swift @@ -9,7 +9,7 @@ import UIKit extension ViewController { - func loadImageAndTagsFromNekosBest() { + func loadImageFromNekosBest() { startLoadingIndicator() let categories = ["neko", "waifu", "kitsune"] diff --git a/AnimeGen/APIs/nekosapi.swift b/AnimeGen/APIs/nekosapi.swift index 87b0add7..0115eaae 100644 --- a/AnimeGen/APIs/nekosapi.swift +++ b/AnimeGen/APIs/nekosapi.swift @@ -9,7 +9,7 @@ import UIKit extension ViewController { - func loadImageAndTagsFromNekosapi() { + func loadImageFromNekosapi() { startLoadingIndicator() var ratings: [String] = ["safe"] diff --git a/AnimeGen/APIs/nekosmoe.swift b/AnimeGen/APIs/nekosmoe.swift index 272ef428..556580f5 100644 --- a/AnimeGen/APIs/nekosmoe.swift +++ b/AnimeGen/APIs/nekosmoe.swift @@ -9,7 +9,7 @@ import UIKit extension ViewController { - func loadImageAndTagsFromNekosMoe() { + func loadImageFromNekosMoe() { startLoadingIndicator() let isNSFW = UserDefaults.standard.bool(forKey: "enableExplictiCont") diff --git a/AnimeGen/APIs/pic-re.swift b/AnimeGen/APIs/pic-re.swift index 7a451213..35799280 100644 --- a/AnimeGen/APIs/pic-re.swift +++ b/AnimeGen/APIs/pic-re.swift @@ -9,7 +9,7 @@ import UIKit extension ViewController { - func loadImageAndTagsFromPicRe() { + func loadImageFromPicRe() { startLoadingIndicator() let apiEndpoint = "https://pic.re/image" diff --git a/AnimeGen/APIs/purr.swift b/AnimeGen/APIs/purr.swift index 805acdd0..e91210b5 100644 --- a/AnimeGen/APIs/purr.swift +++ b/AnimeGen/APIs/purr.swift @@ -10,7 +10,7 @@ import UIKit extension ViewController { - func loadImageAndTagsFromPurr() { + func loadImageFromPurr() { startLoadingIndicator() var categories: [String] diff --git a/AnimeGen/APIs/waifu-im.swift b/AnimeGen/APIs/waifu-im.swift index 43986894..2219554f 100644 --- a/AnimeGen/APIs/waifu-im.swift +++ b/AnimeGen/APIs/waifu-im.swift @@ -9,7 +9,7 @@ import UIKit extension ViewController { - func loadImageAndTagsFromWaifuIm() { + func loadImageFromWaifuIm() { startLoadingIndicator() let isNSFW = UserDefaults.standard.bool(forKey: "enableExplictiCont") diff --git a/AnimeGen/Buttons/Refresh-API-Button.swift b/AnimeGen/Buttons/Refresh-API-Button.swift index d9e11b77..2595e6d8 100644 --- a/AnimeGen/Buttons/Refresh-API-Button.swift +++ b/AnimeGen/Buttons/Refresh-API-Button.swift @@ -16,14 +16,22 @@ extension ViewController { switch title { case "pic.re": + showPopUpBanner(message: "This API is not supported on your iOS version!", viewController: self) { + if #available(iOS 14.0, *) { + // nothing here cuz ios 14+ 💪 + } else { + self.apiButton.setTitle("waifu.im", for: .normal) + self.loadImageFromWaifuIm() + } + } lastImage = imageView.image - loadImageAndTagsFromPicRe() + loadImageFromPicRe() case "waifu.im": lastImage = imageView.image - loadImageAndTagsFromWaifuIm() + loadImageFromWaifuIm() case "nekos.best": lastImage = imageView.image - loadImageAndTagsFromNekosBest() + loadImageFromNekosBest() case "waifu.pics": lastImage = imageView.image loadImageFromWaifuPics() @@ -31,23 +39,30 @@ extension ViewController { lastImage = imageView.image startHmtaiLoader() case "Nekos api": + showPopUpBanner(message: "This API is not supported on your iOS version!", viewController: self) { + if #available(iOS 14.0, *) { + // nothing here cuz ios 14+ 💪 + } else { + self.apiButton.setTitle("waifu.im", for: .normal) + self.loadImageFromWaifuIm() + } + } lastImage = imageView.image - loadImageAndTagsFromNekosapi() + loadImageFromNekosapi() case "nekos.moe": lastImage = imageView.image - loadImageAndTagsFromNekosMoe() + loadImageFromNekosMoe() case "kyoko": lastImage = imageView.image - loadImageAndTagsFromKyoko() + loadImageFromKyoko() case "Purr": lastImage = imageView.image - loadImageAndTagsFromPurr() + loadImageFromPurr() default: break } } - @objc func apiButtonTapped() { let alertController = UIAlertController(title: "Select API", message: nil, preferredStyle: .actionSheet) diff --git a/AnimeGen/Extensions/popup-Banner.swift b/AnimeGen/Extensions/popup-Banner.swift new file mode 100644 index 00000000..28942fe9 --- /dev/null +++ b/AnimeGen/Extensions/popup-Banner.swift @@ -0,0 +1,29 @@ +// +// popup-Banner.swift +// AnimeGen +// +// Created by cranci on 17/04/24. +// + +import UIKit + +extension ViewController { + + func showPopUpBanner(message: String, viewController: UIViewController, completion: (() -> Void)?) { + if #available(iOS 14.0, *) { + // nothing here cuz ios 14+ 💪 + completion?() + } else { + + // ios 13.x 😭 + + let alertController = UIAlertController(title: nil, message: message, preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default) { _ in + completion?() + } + alertController.addAction(okAction) + viewController.present(alertController, animated: true, completion: nil) + } + } + +} diff --git a/AnimeGen/Settings/SettingsPage.swift b/AnimeGen/Settings/SettingsPage.swift index 9c9fa3ce..54c22c1a 100644 --- a/AnimeGen/Settings/SettingsPage.swift +++ b/AnimeGen/Settings/SettingsPage.swift @@ -90,7 +90,6 @@ struct SettingsPage: View { } } - .listStyle(GroupedListStyle()) .navigationBarTitle("Settings") } .navigationViewStyle(StackNavigationViewStyle()) diff --git a/AnimeGen/ViewController.swift b/AnimeGen/ViewController.swift index 0ceb417c..50c3ce36 100644 --- a/AnimeGen/ViewController.swift +++ b/AnimeGen/ViewController.swift @@ -292,24 +292,42 @@ class ViewController: UIViewController { return } switch title { + case "pic.re": - loadImageAndTagsFromPicRe() + loadImageFromPicRe() + showPopUpBanner(message: "This API is not supported on your iOS version!", viewController: self) { + if #available(iOS 14.0, *) { + // nothing here cuz ios 14+ 💪 + } else { + self.apiButton.setTitle("waifu.im", for: .normal) + self.loadImageFromWaifuIm() + } + } case "waifu.im": - loadImageAndTagsFromWaifuIm() + loadImageFromWaifuIm() case "nekos.best": - loadImageAndTagsFromNekosBest() + loadImageFromNekosBest() case "waifu.pics": loadImageFromWaifuPics() case "Hmtai": startHmtaiLoader() case "Nekos api": - loadImageAndTagsFromNekosapi() + loadImageFromNekosapi() + showPopUpBanner(message: "This API is not supported on your iOS version!", viewController: self) { + if #available(iOS 14.0, *) { + // nothing here cuz ios 14+ 💪 + } else { + self.apiButton.setTitle("waifu.im", for: .normal) + self.loadImageFromWaifuIm() + } + } case "nekos.moe": - loadImageAndTagsFromNekosMoe() + loadImageFromNekosMoe() case "kyoko": - loadImageAndTagsFromKyoko() + loadImageFromKyoko() case "Purr": - loadImageAndTagsFromPurr() + loadImageFromPurr() + default: break }