diff --git a/WallpaperHD_Live.xcodeproj/project.pbxproj b/WallpaperHD_Live.xcodeproj/project.pbxproj index 37084be..1fec698 100644 --- a/WallpaperHD_Live.xcodeproj/project.pbxproj +++ b/WallpaperHD_Live.xcodeproj/project.pbxproj @@ -8,6 +8,8 @@ /* Begin PBXBuildFile section */ 20E56B217F7725712DE82B32 /* Pods_WallpaperHD_Live.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F59CBF68E08818FF22B15165 /* Pods_WallpaperHD_Live.framework */; }; + 753B78932C4F427E0007526F /* WP_PhotoAlbumVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753B78912C4F427E0007526F /* WP_PhotoAlbumVC.swift */; }; + 753B78942C4F427E0007526F /* WP_PhotoAlbumVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 753B78922C4F427E0007526F /* WP_PhotoAlbumVC.xib */; }; 75B426A02C4E092C001844C2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B4269F2C4E092C001844C2 /* AppDelegate.swift */; }; 75B426A42C4E092C001844C2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B426A32C4E092C001844C2 /* ViewController.swift */; }; 75B426A72C4E092C001844C2 /* Base in Resources */ = {isa = PBXBuildFile; fileRef = 75B426A62C4E092C001844C2 /* Base */; }; @@ -42,9 +44,28 @@ 75B426FC2C4E45EB001844C2 /* WP_4KModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B426FB2C4E45EB001844C2 /* WP_4KModel.swift */; }; 75B426FF2C4E4990001844C2 /* WP_RankingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75B426FE2C4E4990001844C2 /* WP_RankingCell.xib */; }; 75B427002C4E4990001844C2 /* WP_RankingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B426FD2C4E4990001844C2 /* WP_RankingCell.swift */; }; + 75B427032C4E63A8001844C2 /* WP_WallPaPerDetailsVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75B427022C4E63A8001844C2 /* WP_WallPaPerDetailsVC.xib */; }; + 75B427042C4E63A8001844C2 /* WP_WallPaPerDetailsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427012C4E63A8001844C2 /* WP_WallPaPerDetailsVC.swift */; }; + 75B427062C4E658E001844C2 /* historyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427052C4E658D001844C2 /* historyManager.swift */; }; + 75B427082C4E65A3001844C2 /* AccountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427072C4E65A3001844C2 /* AccountManager.swift */; }; + 75B4270A2C4E65E3001844C2 /* PrefixHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427092C4E65E3001844C2 /* PrefixHeader.swift */; }; + 75B4270D2C4E66CB001844C2 /* WA_PreView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75B4270B2C4E66CA001844C2 /* WA_PreView.xib */; }; + 75B4270E2C4E66CB001844C2 /* WA_PreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B4270C2C4E66CA001844C2 /* WA_PreView.swift */; }; + 75B427112C4E6BF2001844C2 /* WP_AboutVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75B427102C4E6BF2001844C2 /* WP_AboutVC.xib */; }; + 75B427122C4E6BF2001844C2 /* WP_AboutVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B4270F2C4E6BF2001844C2 /* WP_AboutVC.swift */; }; + 75B427142C4E6CEF001844C2 /* WP_PrivacyVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427132C4E6CEF001844C2 /* WP_PrivacyVC.swift */; }; + 75B4271B2C4E76B4001844C2 /* WP_FeedVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75B4271A2C4E76B4001844C2 /* WP_FeedVC.xib */; }; + 75B4271C2C4E76B4001844C2 /* WP_FeedVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427192C4E76B4001844C2 /* WP_FeedVC.swift */; }; + 75B4271F2C4E7A84001844C2 /* WP_CollectionVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75B4271E2C4E7A84001844C2 /* WP_CollectionVC.xib */; }; + 75B427202C4E7A84001844C2 /* WP_CollectionVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B4271D2C4E7A84001844C2 /* WP_CollectionVC.swift */; }; + 75B427222C4E80CB001844C2 /* SPayPassWordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427212C4E80CB001844C2 /* SPayPassWordView.swift */; }; + 75B427252C4E811E001844C2 /* WP_LockVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 75B427242C4E811E001844C2 /* WP_LockVC.xib */; }; + 75B427262C4E811E001844C2 /* WP_LockVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B427232C4E811E001844C2 /* WP_LockVC.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 753B78912C4F427E0007526F /* WP_PhotoAlbumVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_PhotoAlbumVC.swift; sourceTree = ""; }; + 753B78922C4F427E0007526F /* WP_PhotoAlbumVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WP_PhotoAlbumVC.xib; sourceTree = ""; }; 75B4269C2C4E092C001844C2 /* WallpaperHD_Live.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WallpaperHD_Live.app; sourceTree = BUILT_PRODUCTS_DIR; }; 75B4269F2C4E092C001844C2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 75B426A32C4E092C001844C2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -83,6 +104,23 @@ 75B426FB2C4E45EB001844C2 /* WP_4KModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WP_4KModel.swift; sourceTree = ""; }; 75B426FD2C4E4990001844C2 /* WP_RankingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_RankingCell.swift; sourceTree = ""; }; 75B426FE2C4E4990001844C2 /* WP_RankingCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WP_RankingCell.xib; sourceTree = ""; }; + 75B427012C4E63A8001844C2 /* WP_WallPaPerDetailsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_WallPaPerDetailsVC.swift; sourceTree = ""; }; + 75B427022C4E63A8001844C2 /* WP_WallPaPerDetailsVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WP_WallPaPerDetailsVC.xib; sourceTree = ""; }; + 75B427052C4E658D001844C2 /* historyManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = historyManager.swift; sourceTree = ""; }; + 75B427072C4E65A3001844C2 /* AccountManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountManager.swift; sourceTree = ""; }; + 75B427092C4E65E3001844C2 /* PrefixHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrefixHeader.swift; sourceTree = ""; }; + 75B4270B2C4E66CA001844C2 /* WA_PreView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WA_PreView.xib; sourceTree = ""; }; + 75B4270C2C4E66CA001844C2 /* WA_PreView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WA_PreView.swift; sourceTree = ""; }; + 75B4270F2C4E6BF2001844C2 /* WP_AboutVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_AboutVC.swift; sourceTree = ""; }; + 75B427102C4E6BF2001844C2 /* WP_AboutVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WP_AboutVC.xib; sourceTree = ""; }; + 75B427132C4E6CEF001844C2 /* WP_PrivacyVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_PrivacyVC.swift; sourceTree = ""; }; + 75B427192C4E76B4001844C2 /* WP_FeedVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_FeedVC.swift; sourceTree = ""; }; + 75B4271A2C4E76B4001844C2 /* WP_FeedVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WP_FeedVC.xib; sourceTree = ""; }; + 75B4271D2C4E7A84001844C2 /* WP_CollectionVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_CollectionVC.swift; sourceTree = ""; }; + 75B4271E2C4E7A84001844C2 /* WP_CollectionVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WP_CollectionVC.xib; sourceTree = ""; }; + 75B427212C4E80CB001844C2 /* SPayPassWordView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SPayPassWordView.swift; sourceTree = ""; }; + 75B427232C4E811E001844C2 /* WP_LockVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WP_LockVC.swift; sourceTree = ""; }; + 75B427242C4E811E001844C2 /* WP_LockVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WP_LockVC.xib; sourceTree = ""; }; 9CBEA2442AE6AC8044848FC3 /* Pods-WallpaperHD_Live.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WallpaperHD_Live.release.xcconfig"; path = "Target Support Files/Pods-WallpaperHD_Live/Pods-WallpaperHD_Live.release.xcconfig"; sourceTree = ""; }; A14E883F09B5C78F804A4357 /* Pods-WallpaperHD_Live.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WallpaperHD_Live.debug.xcconfig"; path = "Target Support Files/Pods-WallpaperHD_Live/Pods-WallpaperHD_Live.debug.xcconfig"; sourceTree = ""; }; F59CBF68E08818FF22B15165 /* Pods_WallpaperHD_Live.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WallpaperHD_Live.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -198,6 +236,8 @@ 75B426E22C4E371D001844C2 /* WP_Christmas.xib */, 75B426E52C4E372C001844C2 /* WP_FlowersVC.swift */, 75B426E62C4E372C001844C2 /* WP_FlowersVC.xib */, + 75B427012C4E63A8001844C2 /* WP_WallPaPerDetailsVC.swift */, + 75B427022C4E63A8001844C2 /* WP_WallPaPerDetailsVC.xib */, ); path = C; sourceTree = ""; @@ -215,6 +255,17 @@ children = ( 75B426D02C4E2B49001844C2 /* WP_MineVC.swift */, 75B426D12C4E2B49001844C2 /* WP_MineVC.xib */, + 75B4270F2C4E6BF2001844C2 /* WP_AboutVC.swift */, + 75B427102C4E6BF2001844C2 /* WP_AboutVC.xib */, + 75B427132C4E6CEF001844C2 /* WP_PrivacyVC.swift */, + 75B427192C4E76B4001844C2 /* WP_FeedVC.swift */, + 75B4271A2C4E76B4001844C2 /* WP_FeedVC.xib */, + 75B4271D2C4E7A84001844C2 /* WP_CollectionVC.swift */, + 75B4271E2C4E7A84001844C2 /* WP_CollectionVC.xib */, + 75B427232C4E811E001844C2 /* WP_LockVC.swift */, + 75B427242C4E811E001844C2 /* WP_LockVC.xib */, + 753B78912C4F427E0007526F /* WP_PhotoAlbumVC.swift */, + 753B78922C4F427E0007526F /* WP_PhotoAlbumVC.xib */, ); path = C; sourceTree = ""; @@ -241,6 +292,10 @@ 75B426D42C4E2B89001844C2 /* Tool */ = { isa = PBXGroup; children = ( + 75B427212C4E80CB001844C2 /* SPayPassWordView.swift */, + 75B427092C4E65E3001844C2 /* PrefixHeader.swift */, + 75B427072C4E65A3001844C2 /* AccountManager.swift */, + 75B427052C4E658D001844C2 /* historyManager.swift */, 75B426F82C4E457D001844C2 /* 4k.json */, 75B426EC2C4E3A02001844C2 /* CustomCollectionViewFlowLayout.swift */, 75B426D72C4E36D9001844C2 /* my_wallpaper.json */, @@ -260,6 +315,8 @@ 75B426EE2C4E3A12001844C2 /* V */ = { isa = PBXGroup; children = ( + 75B4270C2C4E66CA001844C2 /* WA_PreView.swift */, + 75B4270B2C4E66CA001844C2 /* WA_PreView.xib */, 75B426EF2C4E3A3C001844C2 /* WP_WallpaperCollectionCell.swift */, 75B426F02C4E3A3C001844C2 /* WP_WallpaperCollectionCell.xib */, ); @@ -345,6 +402,7 @@ buildActionMask = 2147483647; files = ( 75B426F92C4E457D001844C2 /* 4k.json in Resources */, + 75B4271B2C4E76B4001844C2 /* WP_FeedVC.xib in Resources */, 75B426FF2C4E4990001844C2 /* WP_RankingCell.xib in Resources */, 75B426D82C4E36D9001844C2 /* my_wallpaper.json in Resources */, 75B426E72C4E372C001844C2 /* WP_FlowersVC.xib in Resources */, @@ -352,11 +410,17 @@ 75B426D22C4E2B49001844C2 /* WP_MineVC.xib in Resources */, 75B426E32C4E371D001844C2 /* WP_Christmas.xib in Resources */, 75B426A92C4E092F001844C2 /* Assets.xcassets in Resources */, + 75B4270D2C4E66CB001844C2 /* WA_PreView.xib in Resources */, + 75B4271F2C4E7A84001844C2 /* WP_CollectionVC.xib in Resources */, 75B426AC2C4E092F001844C2 /* Base in Resources */, 75B426CE2C4E2B31001844C2 /* WP_RankingVC.xib in Resources */, 75B426DB2C4E3705001844C2 /* WP_NewestVC.xib in Resources */, + 75B427032C4E63A8001844C2 /* WP_WallPaPerDetailsVC.xib in Resources */, 75B426F12C4E3A3C001844C2 /* WP_WallpaperCollectionCell.xib in Resources */, 75B426CA2C4E2B25001844C2 /* WP_HomeVC.xib in Resources */, + 75B427112C4E6BF2001844C2 /* WP_AboutVC.xib in Resources */, + 753B78942C4F427E0007526F /* WP_PhotoAlbumVC.xib in Resources */, + 75B427252C4E811E001844C2 /* WP_LockVC.xib in Resources */, 75B426A72C4E092C001844C2 /* Base in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -412,23 +476,35 @@ files = ( 75B426CF2C4E2B31001844C2 /* WP_RankingVC.swift in Sources */, 75B426E42C4E371D001844C2 /* WP_Christmas.swift in Sources */, + 75B427062C4E658E001844C2 /* historyManager.swift in Sources */, + 75B427082C4E65A3001844C2 /* AccountManager.swift in Sources */, 75B426FC2C4E45EB001844C2 /* WP_4KModel.swift in Sources */, 75B426DC2C4E3705001844C2 /* WP_NewestVC.swift in Sources */, 75B426A42C4E092C001844C2 /* ViewController.swift in Sources */, 75B426B42C4E0CF5001844C2 /* WP_RootVC.swift in Sources */, 75B426CB2C4E2B25001844C2 /* WP_HomeVC.swift in Sources */, + 75B427122C4E6BF2001844C2 /* WP_AboutVC.swift in Sources */, + 753B78932C4F427E0007526F /* WP_PhotoAlbumVC.swift in Sources */, + 75B4270E2C4E66CB001844C2 /* WA_PreView.swift in Sources */, 75B426B82C4E0D21001844C2 /* WP_RootNAV.swift in Sources */, 75B426D62C4E2B9F001844C2 /* colorManager.swift in Sources */, 75B426EB2C4E38F9001844C2 /* WallpaperModel.swift in Sources */, + 75B4270A2C4E65E3001844C2 /* PrefixHeader.swift in Sources */, + 75B427202C4E7A84001844C2 /* WP_CollectionVC.swift in Sources */, 75B426ED2C4E3A02001844C2 /* CustomCollectionViewFlowLayout.swift in Sources */, 75B427002C4E4990001844C2 /* WP_RankingCell.swift in Sources */, + 75B4271C2C4E76B4001844C2 /* WP_FeedVC.swift in Sources */, 75B426A02C4E092C001844C2 /* AppDelegate.swift in Sources */, + 75B427222C4E80CB001844C2 /* SPayPassWordView.swift in Sources */, + 75B427042C4E63A8001844C2 /* WP_WallPaPerDetailsVC.swift in Sources */, 75B426D32C4E2B49001844C2 /* WP_MineVC.swift in Sources */, 75B426E82C4E372C001844C2 /* WP_FlowersVC.swift in Sources */, 75B426BF2C4E1046001844C2 /* WP_TabbarCommon.swift in Sources */, + 75B427262C4E811E001844C2 /* WP_LockVC.swift in Sources */, 75B426F22C4E3A3C001844C2 /* WP_WallpaperCollectionCell.swift in Sources */, 75B426E02C4E3711001844C2 /* WP_PopularVC.swift in Sources */, 75B426C12C4E10D7001844C2 /* WP_TabBarVC.swift in Sources */, + 75B427142C4E6CEF001844C2 /* WP_PrivacyVC.swift in Sources */, 75B426BE2C4E1046001844C2 /* WP_TabButton.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -587,6 +663,7 @@ GCC_PREFIX_HEADER = "$(SRCROOT)/WallpaperHD_Live/Header/waperLivePCH.pch"; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = WallpaperHD_Live/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Lock Wallpaper"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -624,6 +701,7 @@ GCC_PREFIX_HEADER = "$(SRCROOT)/WallpaperHD_Live/Header/waperLivePCH.pch"; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = WallpaperHD_Live/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Lock Wallpaper"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; diff --git a/WallpaperHD_Live/AppDelegate.swift b/WallpaperHD_Live/AppDelegate.swift index d59f280..fb15fe3 100644 --- a/WallpaperHD_Live/AppDelegate.swift +++ b/WallpaperHD_Live/AppDelegate.swift @@ -11,16 +11,32 @@ import IQKeyboardManagerSwift class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - + let hasLaunchedBeforeKey = "hasLaunchedBefore" func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { IQKeyboardManager.shared.enable = true window = UIWindow(frame: UIScreen.main.bounds) - WP_TabbarCommon.TabBarController() +// WP_TabbarCommon.TabBarController() + + + let userDefaults = UserDefaults.standard + if userDefaults.bool(forKey: hasLaunchedBeforeKey){ + if userDefaults.bool(forKey: "islock"){ + let vc = WP_LockVC() + self.window?.rootViewController = WP_RootNAV(rootViewController: vc) + }else{ + WP_TabbarCommon.TabBarController() + } + + + }else{ + // 第一次启动 + userDefaults.set(true, forKey: hasLaunchedBeforeKey) + userDefaults.set(false, forKey: "islock") + WP_TabbarCommon.TabBarController() + } self.window?.makeKeyAndVisible() return true } - - } diff --git a/WallpaperHD_Live/Assets.xcassets/AppIcon.appiconset/Contents.json b/WallpaperHD_Live/Assets.xcassets/AppIcon.appiconset/Contents.json index 13613e3..f434400 100644 --- a/WallpaperHD_Live/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/WallpaperHD_Live/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "logo.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" diff --git a/WallpaperHD_Live/Assets.xcassets/AppIcon.appiconset/logo.png b/WallpaperHD_Live/Assets.xcassets/AppIcon.appiconset/logo.png new file mode 100644 index 0000000..9022b5a Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/AppIcon.appiconset/logo.png differ diff --git a/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/Contents.json b/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/Contents.json index ffb8ec8..4e3df59 100644 --- a/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/Contents.json +++ b/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "截屏2024-03-11 16.39.35.png", + "filename" : "Rectangle.jpeg", "idiom" : "universal", "scale" : "1x" }, diff --git a/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/Rectangle.jpeg b/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/Rectangle.jpeg new file mode 100644 index 0000000..918f003 Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/Rectangle.jpeg differ diff --git a/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/截屏2024-03-11 16.39.35.png b/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/截屏2024-03-11 16.39.35.png deleted file mode 100644 index b6b0714..0000000 Binary files a/WallpaperHD_Live/Assets.xcassets/Rectangle.imageset/截屏2024-03-11 16.39.35.png and /dev/null differ diff --git a/WallpaperHD_Live/Assets.xcassets/back_black.imageset/Contents.json b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/Contents.json new file mode 100644 index 0000000..4abbcf2 --- /dev/null +++ b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "back_black.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "back_black@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "back_black@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black.png b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black.png new file mode 100644 index 0000000..996c072 Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black.png differ diff --git a/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black@2x.png b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black@2x.png new file mode 100644 index 0000000..9efe202 Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black@2x.png differ diff --git a/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black@3x.png b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black@3x.png new file mode 100644 index 0000000..65f4098 Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/back_black.imageset/back_black@3x.png differ diff --git a/WallpaperHD_Live/Assets.xcassets/camera.imageset/Contents.json b/WallpaperHD_Live/Assets.xcassets/camera.imageset/Contents.json new file mode 100644 index 0000000..41ca708 --- /dev/null +++ b/WallpaperHD_Live/Assets.xcassets/camera.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "照相机.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WallpaperHD_Live/Assets.xcassets/camera.imageset/照相机.png b/WallpaperHD_Live/Assets.xcassets/camera.imageset/照相机.png new file mode 100644 index 0000000..b388f99 Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/camera.imageset/照相机.png differ diff --git a/WallpaperHD_Live/Assets.xcassets/flashlight.imageset/Contents.json b/WallpaperHD_Live/Assets.xcassets/flashlight.imageset/Contents.json new file mode 100644 index 0000000..c3f24a6 --- /dev/null +++ b/WallpaperHD_Live/Assets.xcassets/flashlight.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "手电筒.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WallpaperHD_Live/Assets.xcassets/flashlight.imageset/手电筒.png b/WallpaperHD_Live/Assets.xcassets/flashlight.imageset/手电筒.png new file mode 100644 index 0000000..865a5f3 Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/flashlight.imageset/手电筒.png differ diff --git a/WallpaperHD_Live/Assets.xcassets/nodata.imageset/Contents.json b/WallpaperHD_Live/Assets.xcassets/nodata.imageset/Contents.json new file mode 100644 index 0000000..17f6fd9 --- /dev/null +++ b/WallpaperHD_Live/Assets.xcassets/nodata.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "Image.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WallpaperHD_Live/Assets.xcassets/nodata.imageset/Image.png b/WallpaperHD_Live/Assets.xcassets/nodata.imageset/Image.png new file mode 100644 index 0000000..f7b191a Binary files /dev/null and b/WallpaperHD_Live/Assets.xcassets/nodata.imageset/Image.png differ diff --git a/WallpaperHD_Live/Home/C/WP_Christmas.swift b/WallpaperHD_Live/Home/C/WP_Christmas.swift index 1f4ce70..89f5d43 100644 --- a/WallpaperHD_Live/Home/C/WP_Christmas.swift +++ b/WallpaperHD_Live/Home/C/WP_Christmas.swift @@ -158,7 +158,10 @@ extension WP_Christmas:UICollectionViewDelegate,UICollectionViewDataSource,UICol } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - + let vc = WP_WallPaPerDetailsVC() + vc.type = 2 + vc.modeltype = self.christmasWallpapers[indexPath.row] + self.navigationController?.pushViewController(vc, animated: true) } diff --git a/WallpaperHD_Live/Home/C/WP_FlowersVC.swift b/WallpaperHD_Live/Home/C/WP_FlowersVC.swift index 56c9e6e..ba58e2c 100644 --- a/WallpaperHD_Live/Home/C/WP_FlowersVC.swift +++ b/WallpaperHD_Live/Home/C/WP_FlowersVC.swift @@ -156,7 +156,10 @@ extension WP_FlowersVC:UICollectionViewDelegate,UICollectionViewDataSource,UICol func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - + let vc = WP_WallPaPerDetailsVC() + vc.type = 2 + vc.modeltype = self.flowersWallpapers[indexPath.row] + self.navigationController?.pushViewController(vc, animated: true) } } diff --git a/WallpaperHD_Live/Home/C/WP_NewestVC.swift b/WallpaperHD_Live/Home/C/WP_NewestVC.swift index be2c443..cda8323 100644 --- a/WallpaperHD_Live/Home/C/WP_NewestVC.swift +++ b/WallpaperHD_Live/Home/C/WP_NewestVC.swift @@ -157,7 +157,10 @@ extension WP_NewestVC:UICollectionViewDelegate,UICollectionViewDataSource,UIColl func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - + let vc = WP_WallPaPerDetailsVC() + vc.type = 2 + vc.modeltype = self.newestWallpapers[indexPath.row] + self.navigationController?.pushViewController(vc, animated: true) } } diff --git a/WallpaperHD_Live/Home/C/WP_PopularVC.swift b/WallpaperHD_Live/Home/C/WP_PopularVC.swift index a3e4462..7d3e197 100644 --- a/WallpaperHD_Live/Home/C/WP_PopularVC.swift +++ b/WallpaperHD_Live/Home/C/WP_PopularVC.swift @@ -159,7 +159,10 @@ extension WP_PopularVC:UICollectionViewDelegate,UICollectionViewDataSource,UICol } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - + let vc = WP_WallPaPerDetailsVC() + vc.type = 2 + vc.modeltype = self.populartWallpapers[indexPath.row] + self.navigationController?.pushViewController(vc, animated: true) } diff --git a/WallpaperHD_Live/Home/C/WP_WallPaPerDetailsVC.swift b/WallpaperHD_Live/Home/C/WP_WallPaPerDetailsVC.swift new file mode 100644 index 0000000..62f6358 --- /dev/null +++ b/WallpaperHD_Live/Home/C/WP_WallPaPerDetailsVC.swift @@ -0,0 +1,288 @@ +// +// WP_WallPaPerDetailsVC.swift +// WallpaperHD_Live +// +// Created by 忆海16 on 2024/7/22. +// + +import UIKit +import SDWebImage +import Photos +import SVProgressHUD +import Alamofire +class WP_WallPaPerDetailsVC: WP_RootVC { + @IBOutlet weak var bgView: UIView! + + @IBOutlet weak var backBtn: UIButton! + + + @IBOutlet weak var preimageV: UIImageView! + var model = WP_4KModel() + + var modeltype = WallpaperData() + + let activityView = UIActivityIndicatorView() + + var type:Int = 0 + override func viewDidLoad() { + super.viewDidLoad() + + if type == 1{ + let imageURL = URL(string: model.preview ?? "") + preimageV.sd_setImage(with: imageURL, placeholderImage: UIImage(named: "Rectangle")) + }else{ + let imageURL = URL(string: modeltype.source ?? "") + preimageV.sd_setImage(with: imageURL, placeholderImage: UIImage(named: "Rectangle")) + } + + // 添加手势识别器到 UIView 上 + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(viewTapped)) + preimageV.isUserInteractionEnabled = true + preimageV.addGestureRecognizer(tapGesture) + + activityView.center = CGPoint(x: self.view.center.x, y: self.view.center.y - kSafeArea_Top - 44) + // 停止后,隐藏菊花 + activityView.hidesWhenStopped = true + activityView.color = .black; + activityView.style = UIActivityIndicatorView.Style.whiteLarge + + self.view.addSubview(activityView) + + backBtn.layer.cornerRadius = 20 + + if type == 1{ + let model1 = WP_4KModel() + model1.preview = self.model.preview + model1.title = self.model.title + model1.thumbnail = self.model.thumbnail + model1.is_free = self.model.is_free + model1.category = self.model.category + model1.id = self.model.id + model1.cnt_like = self.model.cnt_like + HistoryManager.shared.addHistoryItem(item: model1) + }else{ + let model1 = WallpaperData() + model1.original = self.modeltype.original + model1.previewThumb = self.modeltype.previewThumb + model1.source = self.modeltype.source + model1.banner = self.modeltype.banner + HistoryjpgManager.shared.addHistoryItem(item: model1) + } + } + + + @IBAction func saveBtn(_ sender: Any) { + self.activityView.startAnimating() + saveImageToPhotoLibrary() + DispatchQueue.global().asyncAfter(deadline: .now() + 1.5) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0){ + self.activityView.stopAnimating() + // self.view.makeToast("Save Success", duration: 1.5, position: .center) + // 创建一个 UIAlertController + let alertController = UIAlertController(title: "Successfully saved", message: "Do you need to set up a tutorial", preferredStyle: .alert) + + // 添加一个取消按钮 + alertController.addAction(UIAlertAction(title: "cancel", style: .cancel, handler: nil)) + + // 添加一个确定按钮 + alertController.addAction(UIAlertAction(title: "Need", style: .default, handler: { action in + // 点击确定按钮后执行的操作 + // print("点击了确定按钮") +// let vc = WA_TipVC() +// self.present(vc, animated: true) + })) + + // 在当前视图控制器中 present 显示提示框 + self.present(alertController, animated: true, completion: nil) + } + } + + } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.navigationBar.isHidden = true + } + + func saveImageToPhotoLibrary() { + guard let image = self.preimageV.image else { + print("找不到要保存的图片") + SVProgressHUD.showInfo(withStatus: "Can't find the picture to save") + DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { + SVProgressHUD.dismiss() + } + return + } + + PHPhotoLibrary.requestAuthorization { status in + switch status { + case .authorized: + self.saveImage(image: image) + case .denied, .restricted: + print("用户拒绝了访问相册权限") + SVProgressHUD.showInfo(withStatus: "Album access denied") + DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { + SVProgressHUD.dismiss() + } + case .notDetermined: + print("用户尚未选择是否允许访问相册") + SVProgressHUD.showInfo(withStatus: "You have not chosen whether to allow access to the album") + DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { + SVProgressHUD.dismiss() + } + @unknown default: + break + } + } + } + + func saveImage(image: UIImage) { + PHPhotoLibrary.shared().performChanges({ + // 创建向照片库添加新图像资产的请求 + PHAssetChangeRequest.creationRequestForAsset(from: image) + }) { success, error in + if success { + print("图片保存成功") + + + } else if let error = error { + print("图片保存失败:\(error.localizedDescription)") + SVProgressHUD.showError(withStatus: "Image saving failed:\(error.localizedDescription)") + DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { + SVProgressHUD.dismiss() + } + } + } + } + + @IBAction func previewBtn(_ sender: Any) { + UIView.animate(withDuration: 0.5, animations: { + self.bgView.frame.origin.y += 0 + self.bgView.alpha = 0 + self.backBtn.isHidden = true + }) + + showView() + } + + // 手势识别器的处理方法 + @objc func viewTapped() { + // 根据当前 UIView 的位置和透明度进行不同的动画 + if bgView.frame.origin.y == UIScreen.main.bounds.height - bgView.frame.height { + // 当 UIView 在底部时,执行向下移动并渐变消失的动画 + UIView.animate(withDuration: 0.5, animations: { + self.bgView.frame.origin.y += self.bgView.frame.height + self.bgView.alpha = 0 + self.backBtn.isHidden = true + }) + } else { + + self.backBtn.isHidden = false + // 当 UIView不在底部时,执行向上移动并渐变显示的动画 + UIView.animate(withDuration: 0.5, animations: { + self.bgView.frame.origin.y -= self.bgView.frame.height + self.bgView.alpha = 1 + }) + } + } + + func showView() { + // 加载预览视图并添加到当前视图控制器的视图上 + let previewView = Bundle.main.loadNibNamed("WA_PreView", owner: nil, options: nil)?.first as! WA_PreView + previewView.flashView.layer.cornerRadius = 25 + previewView.cameraV.layer.cornerRadius = 25 + + previewView.touchBlock = { + + self.backBtn.isHidden = false + // 当 UIView 不在底部时,执行向上移动并渐变显示的动画 + UIView.animate(withDuration: 0.5, animations: { + self.bgView.frame.origin.y -= 0 + self.bgView.alpha = 1 + }) + } + view.addSubview(previewView) + + + // 设置预览视图初始位置在屏幕左侧外面 + previewView.frame.origin.x = -previewView.frame.width + + // 执行动画 + UIView.animate(withDuration: 1.0) { + // 将预览视图移回主视图中心 + previewView.frame = self.view.frame + } + } + + @IBAction func shareBtn(_ sender: Any) { + self.activityView.startAnimating() + + // 创建要分享的图片 + guard let image = self.preimageV.image else { + SVProgressHUD.showInfo(withStatus: "Can't find the image to share") + DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { + SVProgressHUD.dismiss() + } + print("找不到要分享的图片") + return + } + + // 创建要分享的对象数组 + let items: [Any] = [image] + + // 创建 UIActivityViewController 实例 + let activityViewController = UIActivityViewController(activityItems: items, applicationActivities: nil) + + // 设置 UIActivityViewController 的主题 + activityViewController.modalPresentationStyle = .popover + + // 在 iPad 上设置 UIActivityViewController 的位置 + if let popoverController = activityViewController.popoverPresentationController { + popoverController.sourceView = self.view + popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0) + popoverController.permittedArrowDirections = [] + } + + // 弹出分享视图 + self.present(activityViewController, animated: true, completion: nil) + + DispatchQueue.main.asyncAfter(deadline: .now() + 0){ + self.activityView.stopAnimating() + } + + } + + + @IBAction func collectBtn(_ sender: Any) { + if type == 1{ + let model1 = WP_4KModel() + model1.preview = self.model.preview + model1.title = self.model.title + model1.thumbnail = self.model.thumbnail + model1.is_free = self.model.is_free + model1.category = self.model.category + model1.id = self.model.id + model1.cnt_like = self.model.cnt_like + sc4kManager.shared.addHistoryItem(item: model1) + }else{ + let model1 = WallpaperData() + model1.original = self.modeltype.original + model1.previewThumb = self.modeltype.previewThumb + model1.source = self.modeltype.source + model1.banner = self.modeltype.banner + scjpgManager.shared.addHistoryItem(item: model1) + } + SVProgressHUD.showInfo(withStatus: "Collection successful") + DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { + SVProgressHUD.dismiss() + } + + } + + + @IBAction func back(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + } + + + +} diff --git a/WallpaperHD_Live/Home/C/WP_WallPaPerDetailsVC.xib b/WallpaperHD_Live/Home/C/WP_WallPaPerDetailsVC.xib new file mode 100644 index 0000000..ee61d84 --- /dev/null +++ b/WallpaperHD_Live/Home/C/WP_WallPaPerDetailsVC.xib @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Home/V/WA_PreView.swift b/WallpaperHD_Live/Home/V/WA_PreView.swift new file mode 100644 index 0000000..7d6b486 --- /dev/null +++ b/WallpaperHD_Live/Home/V/WA_PreView.swift @@ -0,0 +1,65 @@ +// +// WA_PreView.swift +// wallpaper_project + + +import UIKit + + +class WA_PreView: UIView { + @IBOutlet weak var flashView: UIView! + + @IBOutlet weak var cameraV: UIView! + + var touchBlock:(()->())? + + override init(frame: CGRect) { + super.init(frame: frame) + commonInit() + + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + + } + + private func commonInit() { + guard let view = loadViewFromNib() else { return } + view.frame = bounds + addSubview(view) + seeUI() + } + private func loadViewFromNib() -> UIView? { + let nib = UINib(nibName: "WA_PreView", bundle: nil) + return nib.instantiate(withOwner: self, options: nil).first as? UIView + } + + + private func seeUI() { + self.flashView.layer.cornerRadius = 25 + self.flashView.clipsToBounds = true + + self.cameraV.layer.cornerRadius = 25 + self.cameraV.clipsToBounds = true + + } + + + + @IBAction func hidView(_ sender: UIButton) { + UIView.animate(withDuration: 1.0, animations: { + self.frame.origin.x = -self.frame.width + }) { (finished) in + // 移除自定义视图 + self.removeFromSuperview() + } + + if self.touchBlock != nil{ + self.touchBlock!() + + } + } + + +} diff --git a/WallpaperHD_Live/Home/V/WA_PreView.xib b/WallpaperHD_Live/Home/V/WA_PreView.xib new file mode 100644 index 0000000..e2e5587 --- /dev/null +++ b/WallpaperHD_Live/Home/V/WA_PreView.xib @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Home/V/WP_WallpaperCollectionCell.swift b/WallpaperHD_Live/Home/V/WP_WallpaperCollectionCell.swift index 2a83971..60a41f1 100644 --- a/WallpaperHD_Live/Home/V/WP_WallpaperCollectionCell.swift +++ b/WallpaperHD_Live/Home/V/WP_WallpaperCollectionCell.swift @@ -6,6 +6,7 @@ // import UIKit +import SDWebImage class WP_WallpaperCollectionCell: UICollectionViewCell { @@ -15,5 +16,13 @@ class WP_WallpaperCollectionCell: UICollectionViewCell { self.wpImagV.layer.cornerRadius = 10 self.wpImagV.clipsToBounds = true } - + var model:WP_4KModel?{ + didSet{ + if let imageURL = URL(string: model!.thumbnail ?? "") { +// wpImagV.sd_setImage(with: imageURL, completed: nil) + wpImagV.sd_setImage(with: imageURL, placeholderImage: UIImage(named: "Rectangle")) + } + + } + } } diff --git a/WallpaperHD_Live/Info.plist b/WallpaperHD_Live/Info.plist index 6a6654d..3c3ebe3 100644 --- a/WallpaperHD_Live/Info.plist +++ b/WallpaperHD_Live/Info.plist @@ -2,6 +2,10 @@ + NSPhotoLibraryUsageDescription + Wallpaper Home needs access to your photo album to update your profile picture, save wallpapers to your album, and share updates within the community. + NSPhotoLibraryAddUsageDescription + Wallpaper Home needs access to your photo album to update your profile picture, save wallpapers to your album, and share updates within the community. NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/WallpaperHD_Live/Mine/C/WP_AboutVC.swift b/WallpaperHD_Live/Mine/C/WP_AboutVC.swift new file mode 100644 index 0000000..6ac43c9 --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_AboutVC.swift @@ -0,0 +1,20 @@ +// +// WP_AboutVC.swift +// WallpaperHD_Live +// +// Created by 忆海16 on 2024/7/22. +// + +import UIKit + +class WP_AboutVC: WP_RootVC { + + override func viewDidLoad() { + super.viewDidLoad() + + } + + @IBAction func back(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + } +} diff --git a/WallpaperHD_Live/Mine/C/WP_AboutVC.xib b/WallpaperHD_Live/Mine/C/WP_AboutVC.xib new file mode 100644 index 0000000..3dbfb8e --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_AboutVC.xib @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Mine/C/WP_CollectionVC.swift b/WallpaperHD_Live/Mine/C/WP_CollectionVC.swift new file mode 100644 index 0000000..7231104 --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_CollectionVC.swift @@ -0,0 +1,98 @@ +// +// WP_CollectionVC.swift +// WallpaperHD_Live +// +// Created by 忆海16 on 2024/7/22. +// + +import UIKit + +class WP_CollectionVC: WP_RootVC { + @IBOutlet weak var dataView: UIView! + + @IBOutlet weak var collectionView: UICollectionView! + + var model = [WP_4KModel]() + var modeltype = [WallpaperData]() + + override func viewDidLoad() { + super.viewDidLoad() + setCollectionView() + } + + func setCollectionView(){ + collectionView.delegate = self + collectionView.dataSource = self + + // 设置 collection view 的布局 + let layout = CustomCollectionViewFlowLayout() + collectionView.collectionViewLayout = layout + layout.scrollDirection = .vertical + + collectionView.register(UINib(nibName: "WP_WallpaperCollectionCell", bundle: nil), forCellWithReuseIdentifier: "WP_WallpaperCollectionCell") + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.navigationBar.isHidden = true + self.model = sc4kManager.shared.history + self.modeltype = scjpgManager.shared.history + if self.model.count + self.modeltype.count == 0{ + self.dataView.isHidden = false + }else{ + self.dataView.isHidden = true + } + } + + @IBAction func back(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + } + +} +extension WP_CollectionVC:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + + return self.model.count + self.modeltype.count + + } + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "WP_WallpaperCollectionCell", for: indexPath)as!WP_WallpaperCollectionCell + // if + + if indexPath.item < self.model.count { + cell.model = self.model[indexPath.item] + }else{ + let newIndex = indexPath.item - self.model.count + if newIndex < self.modeltype.count { + let model = self.modeltype[newIndex] + if let imageURL = URL(string: model.source ?? "") { + // wpImagV.sd_setImage(with: imageURL, completed: nil) + cell.wpImagV.sd_setImage(with: imageURL, placeholderImage: UIImage(named: "Rectangle")) + } + } + } + + return cell + } + + + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + let vc = WP_WallPaPerDetailsVC() + if indexPath.item < self.model.count { + vc.model = self.model[indexPath.item] + vc.type = 1 + navigationController?.pushViewController(vc, animated: true) + }else{ + let newIndex = indexPath.item - self.model.count + if newIndex < self.modeltype.count { + vc.type = 2 + vc.modeltype = self.modeltype[newIndex] + navigationController?.pushViewController(vc, animated: true) + } + } + + + + } +} diff --git a/WallpaperHD_Live/Mine/C/WP_CollectionVC.xib b/WallpaperHD_Live/Mine/C/WP_CollectionVC.xib new file mode 100644 index 0000000..6075c6d --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_CollectionVC.xib @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Mine/C/WP_FeedVC.swift b/WallpaperHD_Live/Mine/C/WP_FeedVC.swift new file mode 100644 index 0000000..9abd02a --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_FeedVC.swift @@ -0,0 +1,61 @@ +// +// WP_FeedVC.swift +// WallpaperHD_Live +// +// Created by 忆海16 on 2024/7/22. +// + +import UIKit +import SVProgressHUD + +class WP_FeedVC: WP_RootVC,UITextViewDelegate { + @IBOutlet weak var feedTextV: UITextView! + + + @IBOutlet weak var sureBtn: UIButton! + + let placeholderLabel = UILabel() + + override func viewDidLoad() { + super.viewDidLoad() + // 添加占位符Label + placeholderLabel.text = "Please enter the content..." + placeholderLabel.textColor = UIColor.lightGray + placeholderLabel.frame = CGRect(x: 5, y: 8, width: feedTextV.frame.width - 10, height: 20) + feedTextV.addSubview(placeholderLabel) + + feedTextV.layer.cornerRadius = 10 + feedTextV.layer.borderColor = UIColor.black.cgColor + feedTextV.layer.borderWidth = 1 + sureBtn.layer.cornerRadius = 10 + } + + func textViewDidChange(_ textView: UITextView) { + placeholderLabel.isHidden = !textView.text.isEmpty + } + + @IBAction func back(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + + } + + + + @IBAction func sure(_ sender: Any) { + if feedTextV.text.count <= 0 { + SVProgressHUD.showInfo(withStatus: "Please enter your feedback") + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { + SVProgressHUD.dismiss() + } + }else{ + SVProgressHUD.showSuccess(withStatus: "Thank you for your valuable feedback") + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { + SVProgressHUD.dismiss() + } + self.feedTextV.text = "" + self.navigationController?.popViewController(animated: true) + } + + } + +} diff --git a/WallpaperHD_Live/Mine/C/WP_FeedVC.xib b/WallpaperHD_Live/Mine/C/WP_FeedVC.xib new file mode 100644 index 0000000..2719c51 --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_FeedVC.xib @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Mine/C/WP_LockVC.swift b/WallpaperHD_Live/Mine/C/WP_LockVC.swift new file mode 100644 index 0000000..043c0bd --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_LockVC.swift @@ -0,0 +1,87 @@ +// +// WP_LockVC.swift +// WallpaperHD_Live +// +// Created by 忆海16 on 2024/7/22. +// + +import UIKit +import SVProgressHUD + +class WP_LockVC: WP_RootVC { + @IBOutlet weak var backBtn: UIButton! + + @IBOutlet weak var sure: UIButton! + + @IBOutlet weak var paypassView: SPayPassWordView! + + var type:Int = 0 + var code:String? + override func viewDidLoad() { + super.viewDidLoad() + + sure.layer.cornerRadius = 10 + paypassView.delegate = self + } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationController?.navigationBar.isHidden = true + if self.type == 0{ + self.backBtn.isHidden = true + }else{ + self.backBtn.isHidden = false + } + } + + + @IBAction func back(_ sender: Any) { + dismiss(animated: true) + } + + @IBAction func sure(_ sender: Any) { + let userDefaults = UserDefaults.standard + if userDefaults.bool(forKey: "islock"){ + let codestr = userDefaults.value(forKey: "lockcode") + + if self.code == codestr as? String{ + if self.type == 0 { + SVProgressHUD.showInfo(withStatus: "Password is correct") + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { + SVProgressHUD.dismiss() + } + WP_TabbarCommon.TabBarController() + }else{ + userDefaults.set(false, forKey: "islock") + SVProgressHUD.showInfo(withStatus: "Close lock successfully") + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { + SVProgressHUD.dismiss() + } + self.dismiss(animated: true) + } + + }else{ + SVProgressHUD.showInfo(withStatus: "wrong password") + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { + SVProgressHUD.dismiss() + } + } + }else{ + userDefaults.set(self.code, forKey: "lockcode") + userDefaults.set(true, forKey: "islock") + SVProgressHUD.showInfo(withStatus: "Set lock successfully") + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { + SVProgressHUD.dismiss() + } + self.dismiss(animated: true) + } + + } +} +extension WP_LockVC:SPayPassWordViewDelegate{ + + func entryComplete(password: String) { + self.code = password + + } + +} diff --git a/WallpaperHD_Live/Mine/C/WP_LockVC.xib b/WallpaperHD_Live/Mine/C/WP_LockVC.xib new file mode 100644 index 0000000..1c3b584 --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_LockVC.xib @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Mine/C/WP_MineVC.swift b/WallpaperHD_Live/Mine/C/WP_MineVC.swift index bc912ad..51490cc 100644 --- a/WallpaperHD_Live/Mine/C/WP_MineVC.swift +++ b/WallpaperHD_Live/Mine/C/WP_MineVC.swift @@ -8,11 +8,93 @@ import UIKit class WP_MineVC: WP_RootVC { - + @IBOutlet weak var aboutV: UIView! + + + @IBOutlet weak var phototView: UIView! + + @IBOutlet weak var collectView: UIView! + + @IBOutlet weak var privacyView: UIView! + + @IBOutlet weak var feedView: UIView! + + @IBOutlet weak var userView: UIView! + + + @IBOutlet weak var lockView: UIView! + + + @IBOutlet weak var lockIsopen: UILabel! + + override func viewDidLoad() { super.viewDidLoad() + aboutV.layer.cornerRadius = 10 + collectView.layer.cornerRadius = 10 + privacyView.layer.cornerRadius = 10 + feedView.layer.cornerRadius = 10 + userView.layer.cornerRadius = 10 + lockView.layer.cornerRadius = 10 + phototView.layer.cornerRadius = 10 + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationController?.navigationBar.isHidden = true + let userDefaults = UserDefaults.standard + if userDefaults.bool(forKey: "islock"){ + self.lockIsopen.text = "open" + }else{ + self.lockIsopen.text = "closed" + } + } + + + @IBAction func baboutBtn(_ sender: Any) { + let vc = WP_AboutVC() + navigationController?.pushViewController(vc, animated: true) + } + + @IBAction func photoBtn(_ sender: Any) { + let vc = WP_PhotoAlbumVC() + navigationController?.pushViewController(vc, animated: true) + } + + + @IBAction func privacyBtn(_ sender: Any) { + + let vc = WP_PrivacyVC() + vc.type = 0 + self.present(vc, animated: true) + } + + + @IBAction func collectionbtn(_ sender: Any) { + let vc = WP_CollectionVC() + self.navigationController?.pushViewController(vc, animated: true) + } + + + @IBAction func feedBtn(_ sender: Any) { + let vc = WP_FeedVC() + navigationController?.pushViewController(vc, animated: true) } - + + @IBAction func usag(_ sender: Any) { + let vc = WP_PrivacyVC() + vc.type = 1 + self.present(vc, animated: true) + } + + @IBAction func lock(_ sender: Any) { + let vc = WP_LockVC() + vc.modalPresentationStyle = .fullScreen + vc.type = 1 + self.present(vc, animated: true) + + } + } diff --git a/WallpaperHD_Live/Mine/C/WP_MineVC.xib b/WallpaperHD_Live/Mine/C/WP_MineVC.xib index 00b20f3..b3777a5 100644 --- a/WallpaperHD_Live/Mine/C/WP_MineVC.xib +++ b/WallpaperHD_Live/Mine/C/WP_MineVC.xib @@ -11,6 +11,14 @@ + + + + + + + + @@ -19,8 +27,8 @@ - + + + + @@ -65,11 +84,22 @@ + + + + + @@ -102,13 +132,24 @@ + + + + + @@ -122,11 +163,22 @@ + + + + + @@ -143,18 +195,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Mine/C/WP_PhotoAlbumVC.swift b/WallpaperHD_Live/Mine/C/WP_PhotoAlbumVC.swift new file mode 100644 index 0000000..121e390 --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_PhotoAlbumVC.swift @@ -0,0 +1,140 @@ +// +// WP_PhotoAlbumVC.swift +// WallpaperHD_Live +// +// Created by 忆海16 on 2024/7/23. +// + +import UIKit +import Photos + +class WP_PhotoAlbumVC: WP_RootVC { + @IBOutlet weak var collectionView: UICollectionView! + + @IBOutlet weak var dataView: UIView! + var model = [WP_PhotoAlbum]() + override func viewDidLoad() { + super.viewDidLoad() + setCollectionView() + + } + func setCollectionView(){ + collectionView.delegate = self + collectionView.dataSource = self + + // 设置 collection view 的布局 + let layout = CustomCollectionViewFlowLayout() + collectionView.collectionViewLayout = layout + layout.scrollDirection = .vertical + + collectionView.register(UINib(nibName: "WP_WallpaperCollectionCell", bundle: nil), forCellWithReuseIdentifier: "WP_WallpaperCollectionCell") + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationController?.navigationBar.isHidden = true + let retrievedModels = PreferencesManager.shared.retrieveRakModels() + if retrievedModels != nil{ + self.model = retrievedModels! + }else{ + + } + + if self.model.count == 0{ + self.dataView.isHidden = false + }else{ + self.dataView.isHidden = true + } + } + + @IBAction func add(_ sender: Any) { + let imagePicker = UIImagePickerController() + imagePicker.sourceType = .photoLibrary + imagePicker.delegate = self + present(imagePicker, animated: true, completion: nil) + + } + + + @IBAction func back(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + } + + + + // 将 UIImage 转换为字符串 + func convertImageToString(image: UIImage) -> String? { + if let imageData = image.jpegData(compressionQuality: 1.0) { + // 将图片数据转换为 Base64 编码的字符串 + let base64String = imageData.base64EncodedString() + return base64String + } + return nil + } + + // 将 Base64 字符串转换为图片 + func convertStringToImage(base64String: String) -> UIImage? { + if let imageData = Data(base64Encoded: base64String) { + if let image = UIImage(data: imageData) { + return image + } + } + return nil + } + +} +extension WP_PhotoAlbumVC:UIImagePickerControllerDelegate, UINavigationControllerDelegate{ + + // 当选择图片完成时调用的方法 + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + picker.dismiss(animated: true, completion: nil) + + // 获取选定的图片 + if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { + // 存储图片到 UserDefaults + // saveImageToUserDefaults(image, forKey: "selectedImage") + let base64imgString = convertImageToString(image: image) + let dataModel1 = WP_PhotoAlbum( img: base64imgString) + PreferencesManager.shared.addRakModel(dataModel1) + + let retrievedModels = PreferencesManager.shared.retrieveRakModels() + if retrievedModels != nil{ + self.model = retrievedModels! + self.collectionView.reloadData() + }else{ + + } + + if self.model.count == 0{ + self.dataView.isHidden = false + }else{ + self.dataView.isHidden = true + } + + } + } + + // 当用户取消选择图片时调用的方法 + func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { + picker.dismiss(animated: true, completion: nil) + + } + + +} +extension WP_PhotoAlbumVC:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{ + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + + return model.count + + } + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "WP_WallpaperCollectionCell", for: indexPath)as!WP_WallpaperCollectionCell + let data = self.model[indexPath.row] + cell.wpImagV.image = convertStringToImage(base64String: data.img ?? "") + return cell + } + + +} diff --git a/WallpaperHD_Live/Mine/C/WP_PhotoAlbumVC.xib b/WallpaperHD_Live/Mine/C/WP_PhotoAlbumVC.xib new file mode 100644 index 0000000..4ff3c57 --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_PhotoAlbumVC.xib @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WallpaperHD_Live/Mine/C/WP_PrivacyVC.swift b/WallpaperHD_Live/Mine/C/WP_PrivacyVC.swift new file mode 100644 index 0000000..910515d --- /dev/null +++ b/WallpaperHD_Live/Mine/C/WP_PrivacyVC.swift @@ -0,0 +1,38 @@ +// +// WP_PrivacyVC.swift +// WallpaperHD_Live +// +// Created by 忆海16 on 2024/7/22. +// + +import UIKit +import WebKit + +class WP_PrivacyVC: WP_RootVC { + var webView: WKWebView! + var type:Int = 0 + override func viewDidLoad() { + super.viewDidLoad() + webView = WKWebView() + view = webView + + if type == 0 { + if let url = URL(string: "https://wallpaperhomewail.bitbucket.io/privacy.html") { + let request = URLRequest(url: url) + webView.load(request) + } + + }else{ + if let url = URL(string: "https://wallpaperhomewail.bitbucket.io/terms.html") { + let request = URLRequest(url: url) + webView.load(request) + } + } + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationController?.navigationBar.isHidden = true + } + +} diff --git a/WallpaperHD_Live/Ranking/C/WP_RankingVC.swift b/WallpaperHD_Live/Ranking/C/WP_RankingVC.swift index ed670ce..aee6a1e 100644 --- a/WallpaperHD_Live/Ranking/C/WP_RankingVC.swift +++ b/WallpaperHD_Live/Ranking/C/WP_RankingVC.swift @@ -78,14 +78,14 @@ extension WP_RankingVC:FSPagerViewDelegate,FSPagerViewDataSource{ cell.wallpaperImageV.sd_setImage(with: imageURL, placeholderImage: UIImage(named: "Rectangle")) } - - return cell } func pagerView(_ pagerView: FSPagerView, didSelectItemAt index: Int) { - - + let vc = WP_WallPaPerDetailsVC() + vc.type = 1 + vc.model = self.wallpapers[index] + self.navigationController?.pushViewController(vc, animated: true) } } diff --git a/WallpaperHD_Live/Ranking/C/WP_RankingVC.xib b/WallpaperHD_Live/Ranking/C/WP_RankingVC.xib index 8f076b8..626106e 100644 --- a/WallpaperHD_Live/Ranking/C/WP_RankingVC.xib +++ b/WallpaperHD_Live/Ranking/C/WP_RankingVC.xib @@ -27,7 +27,7 @@ - +