diff --git a/.github/workflows/build-example.yml b/.github/workflows/build-example.yml index 77fa1e3..83322c4 100644 --- a/.github/workflows/build-example.yml +++ b/.github/workflows/build-example.yml @@ -1,16 +1,15 @@ name: Build Example on: - push: - branches: [ main, develop ] - pull_request: - branches: [ main ] + workflow_dispatch: + workflow_call: + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true env: DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer - PROJECT_DIR: Example - PROJECT_NAME: Example.xcodeproj - iOSSCHEME: Example jobs: @@ -19,17 +18,24 @@ jobs: runs-on: macOS-13 strategy: matrix: - iosDestination: ['platform=iOS Simulator,OS=16,name=iPhone X','platform=iOS Simulator,OS=17.0,name=iPhone 14'] + iosDestination: ['platform=iOS Simulator,OS=16.0,name=iPhone 14'] steps: - name: Checkout - uses: actions/checkout@v2 - with: - token: ${{ secrets.ACTIONS_TOKEN }} - repository: oversizedev/OversizeResources + uses: actions/checkout@v4 + + - name: Set secret + run: git config --global url."https://${{ secrets.ACTIONS_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + + + - name: Set pipefail + run: set -euo pipefail + + - name: Set SwiftPM Plugin config + run: defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES - name: Build iOS run: | - xcodebuild clean build -project "Example/Example.xcodeproj" -scheme "Example" | xcpretty && exit ${PIPESTATUS[0]} + xcodebuild clean build -project "AppExample/Example.xcodeproj" -scheme "Example" | xcpretty && exit ${PIPESTATUS[0]} env: destination: ${{ matrix.iosDestination }} diff --git a/.github/workflows/build-swiftpm.yml b/.github/workflows/build-swiftpm.yml new file mode 100644 index 0000000..123d039 --- /dev/null +++ b/.github/workflows/build-swiftpm.yml @@ -0,0 +1,38 @@ +name: Build SwiftPM + +on: + workflow_dispatch: + workflow_call: + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer + +jobs: + + swiftpm: + name: Build SwiftPM + runs-on: macOS-13 + strategy: + matrix: + packages: [OversizeKit, OversizeAdsKit, OversizeCalendarKit, OversizeContactsKit, OversizeLocationKit, OversizeNoticeKit, OversizeNotificationKit, OversizeOnboardingKit, OversizePhotoKit] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set secret + run: git config --global url."https://${{ secrets.ACTIONS_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + + + - name: Set pipefail + run: set -euo pipefail + + - name: Set SwiftPM Plugin config + run: defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES + + - name: Build + run: xcodebuild clean build -skipPackagePluginValidation -scheme ${{ matrix.packages }} -destination 'platform=iOS Simulator,name=iPhone 8,OS=16.4' | xcpretty && exit ${PIPESTATUS[0]} diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index fb1699e..68d71ff 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -1,8 +1,8 @@ name: Bump version on: - push: - branches: - - main + workflow_dispatch: + workflow_call: + jobs: tag: @@ -14,7 +14,7 @@ jobs: fetch-depth: '0' - name: Bump version and push tag - uses: anothrNick/github-tag-action@1.61.0 + uses: anothrNick/github-tag-action@master env: GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }} WITH_V: false diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows/ci-pull-request.yml new file mode 100644 index 0000000..3949062 --- /dev/null +++ b/.github/workflows/ci-pull-request.yml @@ -0,0 +1,18 @@ +name: CI - Pull Request +on: + pull_request: + branches: + - 'main' + workflow_dispatch: +jobs: + + build-swiftpm: + name: Build SwiftPM + uses: ./.github/workflows/build-swiftpm.yml + secrets: inherit + + build-example: + name: Build Examples + needs: build-swiftpm + uses: ./.github/workflows/build-example.yml + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7705a4c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI - Push + +on: + push: + branches: ["main"] + workflow_dispatch: + +jobs: + + build-swiftpm: + name: Build SwiftPM + uses: ./.github/workflows/build-swiftpm.yml + secrets: inherit + + build-example: + name: Build Examples + needs: build-swiftpm + uses: ./.github/workflows/build-example.yml + secrets: inherit + + bump: + name: Bump version + needs: build-example + uses: ./.github/workflows/bump.yml + secrets: inherit + diff --git a/.gitignore b/.gitignore index 397bce0..b0a3eb8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ .DS_Store /.build -/Packages -xcuserdata/ -DerivedData/ -.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata -.netrc Package.resolved +.swiftpm +xcuserdata/ +DerivedData/ \ No newline at end of file diff --git a/.swiftpm/xcode/package.xcworkspace/xcuserdata/admin.xcuserdatad/IDEFindNavigatorScopes.plist b/.swiftpm/xcode/package.xcworkspace/xcuserdata/admin.xcuserdatad/IDEFindNavigatorScopes.plist new file mode 100644 index 0000000..5dd5da8 --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/xcuserdata/admin.xcuserdatad/IDEFindNavigatorScopes.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/.swiftpm/xcode/package.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate b/.swiftpm/xcode/package.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..e7a3e77 Binary files /dev/null and b/.swiftpm/xcode/package.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/.swiftpm/xcode/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/.swiftpm/xcode/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..02d1e09 --- /dev/null +++ b/.swiftpm/xcode/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/.swiftpm/xcode/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist b/.swiftpm/xcode/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..dfa97a4 --- /dev/null +++ b/.swiftpm/xcode/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,117 @@ + + + + + SchemeUserState + + OversizeAdsKit.xcscheme_^#shared#^_ + + orderHint + 0 + + OversizeCalendarKit.xcscheme_^#shared#^_ + + orderHint + 2 + + OversizeContactsKit.xcscheme_^#shared#^_ + + orderHint + 3 + + OversizeKit-Package.xcscheme_^#shared#^_ + + orderHint + 1 + + OversizeKit.xcscheme_^#shared#^_ + + orderHint + 4 + + OversizeKitTests.xcscheme_^#shared#^_ + + orderHint + 13 + + OversizeLocationKit.xcscheme_^#shared#^_ + + orderHint + 5 + + OversizeNoticeKit.xcscheme_^#shared#^_ + + orderHint + 6 + + OversizeNotificationKit.xcscheme_^#shared#^_ + + orderHint + 7 + + OversizeOnboardingKit.xcscheme_^#shared#^_ + + orderHint + 8 + + OversizePhotoKit.xcscheme_^#shared#^_ + + orderHint + 9 + + + SuppressBuildableAutocreation + + OversizeAdsKit + + primary + + + OversizeCalendarKit + + primary + + + OversizeContactsKit + + primary + + + OversizeKit + + primary + + + OversizeKitTests + + primary + + + OversizeLocationKit + + primary + + + OversizeNoticeKit + + primary + + + OversizeNotificationKit + + primary + + + OversizeOnboardingKit + + primary + + + OversizePhotoKit + + primary + + + + + diff --git a/Example/Example.xcodeproj/project.pbxproj b/AppExample/Example.xcodeproj/project.pbxproj similarity index 97% rename from Example/Example.xcodeproj/project.pbxproj rename to AppExample/Example.xcodeproj/project.pbxproj index 619c3e4..b4928e8 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/AppExample/Example.xcodeproj/project.pbxproj @@ -19,10 +19,6 @@ 840CD67F2AC0E39D00C6AAD0 /* AppConfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = 840CD67E2AC0E39D00C6AAD0 /* AppConfig.plist */; }; 840CD6812AC0E39D00C6AAD0 /* Router.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840CD6802AC0E39D00C6AAD0 /* Router.swift */; }; 840CD6832AC0E39D00C6AAD0 /* Tabs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840CD6822AC0E39D00C6AAD0 /* Tabs.swift */; }; - 840CD6862AC0E39D00C6AAD0 /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 840CD6852AC0E39D00C6AAD0 /* .gitignore */; }; - 840CD6882AC0E39D00C6AAD0 /* .swiftformat in Resources */ = {isa = PBXBuildFile; fileRef = 840CD6872AC0E39D00C6AAD0 /* .swiftformat */; }; - 840CD68A2AC0E39D00C6AAD0 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 840CD6892AC0E39D00C6AAD0 /* .swiftlint.yml */; }; - 840CD68C2AC0E39D00C6AAD0 /* swiftgen.yml in Resources */ = {isa = PBXBuildFile; fileRef = 840CD68B2AC0E39D00C6AAD0 /* swiftgen.yml */; }; 840CD68E2AC0E39D00C6AAD0 /* ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840CD68D2AC0E39D00C6AAD0 /* ExampleApp.swift */; }; 840CD6902AC0E3A600C6AAD0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 840CD68F2AC0E3A600C6AAD0 /* Assets.xcassets */; }; 840CD6932AC0E3A600C6AAD0 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 840CD6922AC0E3A600C6AAD0 /* Preview Assets.xcassets */; }; @@ -268,13 +264,9 @@ buildActionMask = 2147483647; files = ( 840CD6B12AC0E6E200C6AAD0 /* Products.storekit in Resources */, - 840CD68A2AC0E39D00C6AAD0 /* .swiftlint.yml in Resources */, - 840CD68C2AC0E39D00C6AAD0 /* swiftgen.yml in Resources */, - 840CD6862AC0E39D00C6AAD0 /* .gitignore in Resources */, 840CD6932AC0E3A600C6AAD0 /* Preview Assets.xcassets in Resources */, 840CD67F2AC0E39D00C6AAD0 /* AppConfig.plist in Resources */, 840CD6902AC0E3A600C6AAD0 /* Assets.xcassets in Resources */, - 840CD6882AC0E39D00C6AAD0 /* .swiftformat in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/AppExample/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to AppExample/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/AppExample/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to AppExample/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/AppExample/Example.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate b/AppExample/Example.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..c5dd800 Binary files /dev/null and b/AppExample/Example.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/AppExample/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme similarity index 100% rename from Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme rename to AppExample/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme diff --git a/AppExample/Example.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist b/AppExample/Example.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..268deb9 --- /dev/null +++ b/AppExample/Example.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + Example.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + 840CD6622AC0E39D00C6AAD0 + + primary + + + + + diff --git a/Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json b/AppExample/Example/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AccentColor.colorset/Contents.json rename to AppExample/Example/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/Example/Example/Assets.xcassets/AlternateAppIcon1.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AlternateAppIcon1.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AlternateAppIcon1.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AlternateAppIcon1.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/AlternateAppIcon2.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AlternateAppIcon2.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AlternateAppIcon2.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AlternateAppIcon2.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/AlternateAppIcon3.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AlternateAppIcon3.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AlternateAppIcon3.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AlternateAppIcon3.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/AlternateAppIcon4.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AlternateAppIcon4.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AlternateAppIcon4.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AlternateAppIcon4.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/AlternateAppIcon5.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AlternateAppIcon5.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AlternateAppIcon5.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AlternateAppIcon5.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/AlternateAppIcon6.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AlternateAppIcon6.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AlternateAppIcon6.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AlternateAppIcon6.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/AlternateAppIcon7.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AlternateAppIcon7.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AlternateAppIcon7.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AlternateAppIcon7.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json b/AppExample/Example/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json rename to AppExample/Example/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Example/Example/Assets.xcassets/Contents.json b/AppExample/Example/Assets.xcassets/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/Contents.json rename to AppExample/Example/Assets.xcassets/Contents.json diff --git a/Example/Example/Assets.xcassets/OnbardingBackground.imageset/Contents.json b/AppExample/Example/Assets.xcassets/OnbardingBackground.imageset/Contents.json similarity index 100% rename from Example/Example/Assets.xcassets/OnbardingBackground.imageset/Contents.json rename to AppExample/Example/Assets.xcassets/OnbardingBackground.imageset/Contents.json diff --git a/Example/Example/ExampleApp.swift b/AppExample/Example/ExampleApp.swift similarity index 100% rename from Example/Example/ExampleApp.swift rename to AppExample/Example/ExampleApp.swift diff --git a/Example/Example/Preview Content/Preview Assets.xcassets/Contents.json b/AppExample/Example/Preview Content/Preview Assets.xcassets/Contents.json similarity index 100% rename from Example/Example/Preview Content/Preview Assets.xcassets/Contents.json rename to AppExample/Example/Preview Content/Preview Assets.xcassets/Contents.json diff --git a/Example/Example/Resources/AppConfig.plist b/AppExample/Example/Resources/AppConfig.plist similarity index 100% rename from Example/Example/Resources/AppConfig.plist rename to AppExample/Example/Resources/AppConfig.plist diff --git a/Example/Example/Resources/Info.plist b/AppExample/Example/Resources/Info.plist similarity index 100% rename from Example/Example/Resources/Info.plist rename to AppExample/Example/Resources/Info.plist diff --git a/Example/Example/Resources/Products.storekit b/AppExample/Example/Resources/Products.storekit similarity index 100% rename from Example/Example/Resources/Products.storekit rename to AppExample/Example/Resources/Products.storekit diff --git a/Example/Example/Resources/Scripts/swiftgen.yml b/AppExample/Example/Resources/Scripts/swiftgen.yml similarity index 100% rename from Example/Example/Resources/Scripts/swiftgen.yml rename to AppExample/Example/Resources/Scripts/swiftgen.yml diff --git a/Example/Example/Router/Alerts.swift b/AppExample/Example/Router/Alerts.swift similarity index 100% rename from Example/Example/Router/Alerts.swift rename to AppExample/Example/Router/Alerts.swift diff --git a/Example/Example/Router/Router.swift b/AppExample/Example/Router/Router.swift similarity index 100% rename from Example/Example/Router/Router.swift rename to AppExample/Example/Router/Router.swift diff --git a/Example/Example/Router/Screens.swift b/AppExample/Example/Router/Screens.swift similarity index 100% rename from Example/Example/Router/Screens.swift rename to AppExample/Example/Router/Screens.swift diff --git a/Example/Example/Router/Tabs.swift b/AppExample/Example/Router/Tabs.swift similarity index 100% rename from Example/Example/Router/Tabs.swift rename to AppExample/Example/Router/Tabs.swift diff --git a/Example/Example/Screens/AppSettings/AppSettingsPageView.swift b/AppExample/Example/Screens/AppSettings/AppSettingsPageView.swift similarity index 100% rename from Example/Example/Screens/AppSettings/AppSettingsPageView.swift rename to AppExample/Example/Screens/AppSettings/AppSettingsPageView.swift diff --git a/Example/Example/Screens/AppSettings/AppSettingsPageViewModel.swift b/AppExample/Example/Screens/AppSettings/AppSettingsPageViewModel.swift similarity index 100% rename from Example/Example/Screens/AppSettings/AppSettingsPageViewModel.swift rename to AppExample/Example/Screens/AppSettings/AppSettingsPageViewModel.swift diff --git a/Example/Example/Screens/AppSettings/AppSettingsView.swift b/AppExample/Example/Screens/AppSettings/AppSettingsView.swift similarity index 100% rename from Example/Example/Screens/AppSettings/AppSettingsView.swift rename to AppExample/Example/Screens/AppSettings/AppSettingsView.swift diff --git a/Example/Example/Screens/AppSettings/AppSettingsViewModel.swift b/AppExample/Example/Screens/AppSettings/AppSettingsViewModel.swift similarity index 100% rename from Example/Example/Screens/AppSettings/AppSettingsViewModel.swift rename to AppExample/Example/Screens/AppSettings/AppSettingsViewModel.swift diff --git a/Example/Example/Screens/Main/MainView.swift b/AppExample/Example/Screens/Main/MainView.swift similarity index 100% rename from Example/Example/Screens/Main/MainView.swift rename to AppExample/Example/Screens/Main/MainView.swift diff --git a/Example/Example/Screens/Main/MainViewModel.swift b/AppExample/Example/Screens/Main/MainViewModel.swift similarity index 100% rename from Example/Example/Screens/Main/MainViewModel.swift rename to AppExample/Example/Screens/Main/MainViewModel.swift diff --git a/Example/Example/Screens/Onboarding/OnboardingView.swift b/AppExample/Example/Screens/Onboarding/OnboardingView.swift similarity index 100% rename from Example/Example/Screens/Onboarding/OnboardingView.swift rename to AppExample/Example/Screens/Onboarding/OnboardingView.swift diff --git a/Package.swift b/Package.swift index 3d81c15..0b2cac8 100644 --- a/Package.swift +++ b/Package.swift @@ -12,7 +12,7 @@ let productionDependencies: [PackageDescription.Package.Dependency] = { [ .package(url: "https://github.com/oversizedev/OversizeResources.git", .upToNextMajor(from: "2.0.0")), .package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")), .package(url: "https://github.com/lorenzofiamingo/swiftui-cached-async-image.git", .upToNextMajor(from: "2.1.1")), - .package(url: "https://github.com/oversizedev/OversizeNetwork.git", .upToNextMajor(from: "0.6.0")) + .package(url: "https://github.com/oversizedev/OversizeNetwork.git", .upToNextMajor(from: "0.4.0")) ] }() let developmentDependencies: [PackageDescription.Package.Dependency] = { [ @@ -59,6 +59,7 @@ let package = Package( .product(name: "OversizeLocalizable", package: "OversizeLocalizable"), .product(name: "OversizeResources", package: "OversizeResources"), .product(name: "OversizeNotificationService", package: "OversizeServices"), + .product(name: "OversizeNetwork", package: "OversizeNetwork"), .product(name: "Factory", package: "Factory"), .product(name: "CachedAsyncImage", package: "swiftui-cached-async-image"), ] diff --git a/Sources/OversizeCalendarKit/CreateEventScreen/AttachmentScreen/AttachmentView.swift b/Sources/OversizeCalendarKit/CreateEventScreen/AttachmentScreen/AttachmentView.swift index e9404bc..2d55b53 100644 --- a/Sources/OversizeCalendarKit/CreateEventScreen/AttachmentScreen/AttachmentView.swift +++ b/Sources/OversizeCalendarKit/CreateEventScreen/AttachmentScreen/AttachmentView.swift @@ -3,7 +3,6 @@ // AttachmentView.swift // -import OversizeResources import OversizeUI import SwiftUI @@ -15,13 +14,13 @@ public struct AttachmentView: View { SectionView { VStack(spacing: .zero) { Row("Add investment") { - IconDeprecated(.paperclip) - .iconColor(.onSurfaceHighEmphasis) + Image.Base.attach + .icon() } Row("Add link") { - IconDeprecated(.link) - .iconColor(.onSurfaceHighEmphasis) + Image.Base.link + .icon() } } } diff --git a/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift b/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift index 188b9cf..b8bd69b 100644 --- a/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift +++ b/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift @@ -9,7 +9,6 @@ import OversizeCalendarService import OversizeComponents import OversizeCore import OversizeLocalizable -import OversizeResources import OversizeServices import OversizeUI import SwiftUI diff --git a/Sources/OversizeCalendarKit/CreateEventScreen/SaveForView/SaveForView.swift b/Sources/OversizeCalendarKit/CreateEventScreen/SaveForView/SaveForView.swift index 543fb85..b8ee9d7 100644 --- a/Sources/OversizeCalendarKit/CreateEventScreen/SaveForView/SaveForView.swift +++ b/Sources/OversizeCalendarKit/CreateEventScreen/SaveForView/SaveForView.swift @@ -4,7 +4,6 @@ // import EventKit -import OversizeResources import OversizeUI import SwiftUI diff --git a/Sources/OversizeKit/LauncherKit/Launcher.swift b/Sources/OversizeKit/LauncherKit/Launcher.swift index acbc82d..f2bfced 100644 --- a/Sources/OversizeKit/LauncherKit/Launcher.swift +++ b/Sources/OversizeKit/LauncherKit/Launcher.swift @@ -138,16 +138,6 @@ public extension View { } } -extension View { - func withoutAnimation(action: @escaping () -> Void) { - var transaction = Transaction() - transaction.disablesAnimations = true - withTransaction(transaction) { - action() - } - } -} - struct LockscreenView_Previews: PreviewProvider { static var previews: some View { Launcher { diff --git a/Sources/OversizeKit/SettingsKit/Views/About/AboutView.swift b/Sources/OversizeKit/SettingsKit/Views/About/About/AboutView.swift similarity index 73% rename from Sources/OversizeKit/SettingsKit/Views/About/AboutView.swift rename to Sources/OversizeKit/SettingsKit/Views/About/About/AboutView.swift index 871647e..bf4b853 100644 --- a/Sources/OversizeKit/SettingsKit/Views/About/AboutView.swift +++ b/Sources/OversizeKit/SettingsKit/Views/About/About/AboutView.swift @@ -21,6 +21,12 @@ import SwiftUI @Environment(\.presentationMode) var presentationMode @Environment(\.screenSize) var screenSize @Environment(\.iconStyle) var iconStyle: IconStyle + + @StateObject var viewModel: AboutViewModel + + public init() { + _viewModel = StateObject(wrappedValue: AboutViewModel()) + } @State var offset: CGFloat = 0 @@ -60,13 +66,14 @@ import SwiftUI let scale: CGFloat = 2 #endif - public init() {} - public var body: some View { #if os(iOS) PageView(L10n.Settings.about, onOffsetChanged: { offset = $0 }) { list - .surfaceContentRowInsets() + .surfaceContentRowMargins() + .task { + await viewModel.fetchApps() + } } .leadingBar { /* @@ -86,7 +93,82 @@ import SwiftUI #endif } - private var list: some View { + private func appLinks() -> some View { + return ScrollView(.horizontal, showsIndicators: false) { + HStack(alignment: .top, spacing: Space.small) { + switch viewModel.state { + case .initial, .loading: + ForEach(0...6, id: \.self) { _ in + RoundedRectangle(cornerRadius: .large, style: .continuous) + .fillSurfaceSecondary() + .frame(width: 74, height: 74) + } + case .result(let apps, _): + ForEach(apps, id: \.appStoreId) { app in + Button { + isPresentStoreProduct = true + } label: { + VStack(spacing: .xSmall) { + CachedAsyncImage(url: URL(string: "https://cdn.oversize.design/assets/apps/" + app.address + "/icon.png"), urlCache: .imageCache, content: { + $0 + .resizable() + .frame(width: 74, height: 74) + .mask(RoundedRectangle(cornerRadius: .large, + style: .continuous)) + .overlay( + RoundedRectangle(cornerRadius: 16, + style: .continuous) + .stroke(lineWidth: 1) + .opacity(0.15) + ) + + }, placeholder: { + RoundedRectangle(cornerRadius: .large, style: .continuous) + .fillSurfaceSecondary() + .frame(width: 74, height: 74) + }) + + Text(app.name) + .caption(.medium) + .multilineTextAlignment(.center) + .foregroundColor(.onSurfaceMediumEmphasis) + .frame(width: 74) + } + } + .buttonStyle(.scale) + .appStoreOverlay(isPresent: $isPresentStoreProduct, appId: app.appStoreId) + } + case .error: + EmptyView() + } + + + if let authorAllApps = Info.url.developerAllApps { + VStack(spacing: .xSmall) { + Link(destination: authorAllApps) { + ZStack { + RoundedRectangle(cornerRadius: 16, style: .continuous) + .foregroundColor(.surfaceSecondary) + .frame(width: 74, height: 74) + + IconDeprecated(.externalLink) + } + } + + Text("All apps") + .caption(.medium) + .multilineTextAlignment(.center) + .foregroundColor(.onSurfaceMediumEmphasis) + .frame(width: 74) + } + } + + }.padding(.horizontal, .medium) + } + .padding(.bottom, 16) + } + + var list: some View { VStack(spacing: .zero) { image .padding(.top, isLargeScreen ? -70 : 0) @@ -195,69 +277,7 @@ import SwiftUI Spacer() } - ScrollView(.horizontal, showsIndicators: false) { - HStack(alignment: .top, spacing: Space.small) { - let data = Info.all?.apps.filter { $0.id != Info.app.appStoreID } - - ForEach(data ?? []) { app in - Button { - isPresentStoreProduct = true - } label: { - VStack(spacing: .xSmall) { - let imageUrl = "\(Info.links?.company.cdnString ?? "")/assets/apps/\(app.path ?? "")/icon.png" - CachedAsyncImage(url: URL(string: imageUrl), urlCache: .imageCache, content: { - $0 - .resizable() - .frame(width: 74, height: 74) - .mask(RoundedRectangle(cornerRadius: .large, - style: .continuous)) - .overlay( - RoundedRectangle(cornerRadius: 16, - style: .continuous) - .stroke(lineWidth: 1) - .opacity(0.15) - ) - - }, placeholder: { - RoundedRectangle(cornerRadius: .large, style: .continuous) - .fillSurfaceSecondary() - .frame(width: 74, height: 74) - }) - - Text(app.name ?? "") - .caption(.medium) - .multilineTextAlignment(.center) - .foregroundColor(.onSurfaceMediumEmphasis) - .frame(width: 74) - } - } - .buttonStyle(.scale) - .appStoreOverlay(isPresent: $isPresentStoreProduct, appId: app.id) - } - - if let authorAllApps = Info.url.developerAllApps { - VStack(spacing: .xSmall) { - Link(destination: authorAllApps) { - ZStack { - RoundedRectangle(cornerRadius: 16, style: .continuous) - .foregroundColor(.surfaceSecondary) - .frame(width: 74, height: 74) - - IconDeprecated(.externalLink) - } - } - - Text("All apps") - .caption(.medium) - .multilineTextAlignment(.center) - .foregroundColor(.onSurfaceMediumEmphasis) - .frame(width: 74) - } - } - - }.padding(.horizontal, .medium) - } - .padding(.bottom, 16) + appLinks() } } @@ -295,6 +315,43 @@ import SwiftUI private var soclal: some View { HStack(spacing: .small) { +// switch viewModel.state { +// case .initial, .loading: +// ForEach(0...6, id: \.self) { _ in +// Circle() +// .fillSurfaceSecondary() +// .frame(width: 24, height: 24) +// } +// case .result(_, let info): +// ForEach(info.company.socialNetworks, id: \.title) { link in +// if let linkUrl = URL(string: link.url), let iconUrl = URL(string: link.iconUrl) { +// Link(destination: linkUrl) { +// HStack { +// Spacer() +// +// CachedAsyncImage(url: iconUrl, urlCache: .imageCache, scale: scale) { +// $0 +// .resizable() +// .scaledToFit() +// .blur(radius: blur) +// } placeholder: { +// Circle() +// .fillSurfaceSecondary() +// .frame(width: 24, height: 24) +// } +// .offset(y: -(offset * -0.04)) +// +// Spacer() +// } +// } +// } +// } +// case .error: +// EmptyView() +// } + + + if let facebook = Info.url.companyFacebook { Link(destination: facebook) { // Surface { @@ -495,15 +552,3 @@ import SwiftUI } } #endif - -// MARK: - UIScrollView - -// #if os(iOS) -// import UIKit -// extension UIScrollView { -// override open var clipsToBounds: Bool { -// get { false } -// set {} -// } -// } -// #endif diff --git a/Sources/OversizeKit/SettingsKit/Views/About/About/AboutViewModel.swift b/Sources/OversizeKit/SettingsKit/Views/About/About/AboutViewModel.swift new file mode 100644 index 0000000..ee5ec3c --- /dev/null +++ b/Sources/OversizeKit/SettingsKit/Views/About/About/AboutViewModel.swift @@ -0,0 +1,39 @@ +// +// Copyright © 2023 Alexander Romanov +// AboutViewModel.swift, created on 30.09.2023 +// + +import Factory +import OversizeNetwork +import OversizeServices +import SwiftUI + +@MainActor +public class AboutViewModel: ObservableObject { + + @Injected(\.networkService) var networkService + @Published var state: AboutViewModel.State = State.initial + + public init() {} + + public func fetchApps() async { + state = .loading + async let resultApps = networkService.fetchApps() + async let resultInfo = networkService.fetchInfo() + if case let .success(apps) = await resultApps, case let .success(info) = await resultInfo { + state = .result(apps.filter { $0.appStoreId != Info.app.appStoreID }, info) + + } else { + state = .error(.network(type: .noResponse)) + } + } +} + +extension AboutViewModel { + enum State { + case initial + case loading + case result([Components.Schemas.AppShort], Components.Schemas.Info) + case error(AppError) + } +} diff --git a/Sources/OversizeKit/SettingsKit/Views/SettingsView.swift b/Sources/OversizeKit/SettingsKit/Views/SettingsView.swift index d187adb..dbd5f10 100644 --- a/Sources/OversizeKit/SettingsKit/Views/SettingsView.swift +++ b/Sources/OversizeKit/SettingsKit/Views/SettingsView.swift @@ -49,7 +49,6 @@ import SwiftUI public var body: some View { #if os(iOS) - Group { if !isPortrait, verticalSizeClass == .regular { Group { diff --git a/Sources/OversizeKit/StoreKit/StoreScreen/StoreInstuctinsView.swift b/Sources/OversizeKit/StoreKit/StoreScreen/StoreInstuctinsView.swift index 3ed51ac..a736466 100644 --- a/Sources/OversizeKit/StoreKit/StoreScreen/StoreInstuctinsView.swift +++ b/Sources/OversizeKit/StoreKit/StoreScreen/StoreInstuctinsView.swift @@ -29,16 +29,7 @@ public struct StoreInstuctinsView: View { PageView { offset = $0 } content: { Group { switch viewModel.state { - case .initial: - contentPlaceholder() - .task { - await viewModel.fetchData() - if case let .result(products) = viewModel.state { - await viewModel.updateState(products: products) - } - } - - case .loading: + case .initial, .loading: contentPlaceholder() case let .result(data): content(data: data) @@ -73,6 +64,9 @@ public struct StoreInstuctinsView: View { dismiss() } } + .task { + await viewModel.fetchData() + } #else EmptyView() #endif diff --git a/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift b/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift index a30177b..a1d0b70 100644 --- a/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift +++ b/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift @@ -40,12 +40,6 @@ public struct StoreSpecialOfferView: View { HStack { Spacer() ProgressView() - .task { - await viewModel.fetchData() - if case let .result(products) = viewModel.state { - await viewModel.updateState(products: products) - } - } Spacer() } Spacer() @@ -82,6 +76,9 @@ public struct StoreSpecialOfferView: View { dismiss() } } + .task { + await viewModel.fetchData() + } #else EmptyView() #endif diff --git a/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift b/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift index a8fd138..d14457d 100644 --- a/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift +++ b/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift @@ -29,16 +29,7 @@ import SwiftUI PageView { Group { switch viewModel.state { - case .initial: - contentPlaceholder() - .task { - await viewModel.fetchData() - if case let .result(products) = viewModel.state { - await viewModel.updateState(products: products) - } - } - - case .loading: + case .initial, .loading: contentPlaceholder() case let .result(data): content(data: data) @@ -75,6 +66,9 @@ import SwiftUI Fireworks() } } + .task { + await viewModel.fetchData() + } } var titleText: String { diff --git a/Sources/OversizeKit/StoreKit/StoreScreen/ViewModel/StoreViewModel.swift b/Sources/OversizeKit/StoreKit/StoreScreen/ViewModel/StoreViewModel.swift index a3ba2d1..ff710d3 100644 --- a/Sources/OversizeKit/StoreKit/StoreScreen/ViewModel/StoreViewModel.swift +++ b/Sources/OversizeKit/StoreKit/StoreScreen/ViewModel/StoreViewModel.swift @@ -342,7 +342,11 @@ extension StoreViewModel { } state = .result(finalProducts) log("✅ StoeKit fetched") - // log(finalProducts) + if finalProducts.autoRenewable.isEmpty { + log("❌ NO autoRenewable products") + } else { + log("📦 \(finalProducts.autoRenewable.count) autoRenewable products") + } case let .failure(error): state = .error(error) log("❌ Product not fetched (\(error.title))") diff --git a/Sources/OversizeKit/StoreKit/Views/PrmiumBannerRow.swift b/Sources/OversizeKit/StoreKit/Views/PrmiumBannerRow.swift index 373edb9..d479082 100644 --- a/Sources/OversizeKit/StoreKit/Views/PrmiumBannerRow.swift +++ b/Sources/OversizeKit/StoreKit/Views/PrmiumBannerRow.swift @@ -37,9 +37,6 @@ public struct PrmiumBannerRow: View { } .task { await viewModel.fetchData() - if case let .result(products) = viewModel.state { - await viewModel.updateState(products: products) - } } } diff --git a/Sources/OversizePhotoKit/PhotoViewerView.swift b/Sources/OversizePhotoKit/PhotoViewerView.swift deleted file mode 100644 index c5d31e4..0000000 --- a/Sources/OversizePhotoKit/PhotoViewerView.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright © 2023 Alexander Romanov -// PhotoViewerView.swift -// - -import OversizePhotoComponents -import OversizeUI -import SwiftUI - -public struct PhotoViewerView: View { - private let title: String - private let images: [Image] - @State private var isShowPhoto: Bool = false - @Binding private var selection: Int - - public init(_ title: String = "Photos", selection: Binding, images: [Image]) { - self.title = title - self.images = images - _selection = selection - } - - public var body: some View { -// PageView(title) { - VStack(spacing: 0) { -// ModalNavigationBar(title: title) { -// BarButton(.back) -// } - if images.isEmpty { - Text("Not photos") - .title3() - .onSurfaceHighEmphasisForegroundColor() - } else { - PhotoSliderView(selection: $selection, photos: images) - } - } -// .leadingBar { -// BarButton(.back) -// } - } -} - -// struct SwiftUIView_Previews: PreviewProvider { -// static var previews: some View { -// SwiftUIView() -// } -// }