From 8976a7060fb3c1f16e558f08ae3669baded6ca8f Mon Sep 17 00:00:00 2001 From: Alexandr Romanov Date: Sat, 16 Mar 2024 12:13:38 +0300 Subject: [PATCH] Develop (#14) * Fix build on mac os * Fix Onboarding * Fix gallary build --- .github/workflows/ci-pull-request.yml | 4 ++-- .github/workflows/ci-push.yml | 10 ++++++---- .github/workflows/release.yml | 2 +- Package.swift | 5 +---- .../CreateEventScreen/CreateEventView.swift | 20 ++++++++++++++++++- .../CreateEventViewSheet.swift | 8 ++++++++ .../Pickers/CalendarPicker.swift | 2 +- .../Pickers/RepeatPicker.swift | 6 +++++- .../ContactsLists/ContactsListsView.swift | 6 ++++++ .../ContactsPicker/EmailPickerView.swift | 14 +++++++++++++ .../StoreScreen/StoreSpecialOfferView.swift | 12 ++--------- .../StoreKit/StoreScreen/StoreView.swift | 2 +- .../MapCoordinateView/MapCoordinateView.swift | 4 +++- .../OnboardingView.swift | 2 ++ .../OversizePhotoKit/PhotosGalleryView.swift | 2 ++ 15 files changed, 73 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows/ci-pull-request.yml index 9230a1a..cdc2195 100644 --- a/.github/workflows/ci-pull-request.yml +++ b/.github/workflows/ci-pull-request.yml @@ -2,7 +2,7 @@ name: CI - Pull Request on: pull_request: branches: - - 'main' + - main workflow_dispatch: jobs: @@ -11,7 +11,7 @@ jobs: uses: oversizedev/GithubWorkflows/.github/workflows/build-swiftpm.yml@main strategy: matrix: - packages: [OversizeKit, OversizeAdsKit, OversizeCalendarKit, OversizeContactsKit, OversizeLocationKit, OversizeNoticeKit, OversizeNotificationKit, OversizeOnboardingKit, OversizePhotoKit] + packages: [OversizeKit, OversizeCalendarKit, OversizeContactsKit, OversizeLocationKit, OversizeNoticeKit, OversizeNotificationKit, OversizeOnboardingKit, OversizePhotoKit] with: package: ${{ matrix.packages }} secrets: inherit diff --git a/.github/workflows/ci-push.yml b/.github/workflows/ci-push.yml index 9803441..9b09524 100644 --- a/.github/workflows/ci-push.yml +++ b/.github/workflows/ci-push.yml @@ -1,8 +1,10 @@ name: CI - Push - on: - push: - branches: ["main"] + pull_request: + types: + - closed + branches: + - main workflow_dispatch: jobs: @@ -12,7 +14,7 @@ jobs: uses: oversizedev/GithubWorkflows/.github/workflows/build-swiftpm.yml@main strategy: matrix: - packages: [OversizeKit, OversizeAdsKit, OversizeCalendarKit, OversizeContactsKit, OversizeLocationKit, OversizeNoticeKit, OversizeNotificationKit, OversizeOnboardingKit, OversizePhotoKit] + packages: [OversizeKit, OversizeCalendarKit, OversizeContactsKit, OversizeLocationKit, OversizeNoticeKit, OversizeNotificationKit, OversizeOnboardingKit, OversizePhotoKit] with: package: ${{ matrix.packages }} secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0242e2a..3065293 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Release uses: softprops/action-gh-release@v1 diff --git a/Package.swift b/Package.swift index c5b5396..5cdcfc2 100644 --- a/Package.swift +++ b/Package.swift @@ -15,7 +15,6 @@ let productionDependencies: [PackageDescription.Package.Dependency] = [ .package(url: "https://github.com/oversizedev/OversizeModels.git", .upToNextMajor(from: "0.1.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/GetStream/effects-library.git", .upToNextMajor(from: "1.0.0")), ] let developmentDependencies: [PackageDescription.Package.Dependency] = [ @@ -29,7 +28,6 @@ let developmentDependencies: [PackageDescription.Package.Dependency] = [ .package(name: "OversizeModels", path: "../OversizeModels"), .package(url: "https://github.com/lorenzofiamingo/swiftui-cached-async-image.git", .upToNextMajor(from: "2.1.1")), .package(url: "https://github.com/hmlongco/Factory.git", .upToNextMajor(from: "2.1.3")), - .package(url: "https://github.com/GetStream/effects-library.git", .upToNextMajor(from: "1.0.0")), ] let isProductionDependencies = ProcessInfo.processInfo.environment["RELEASE_DEPENDENCIES"] == "TRUE" @@ -68,8 +66,7 @@ let package = Package( .product(name: "OversizeModels", package: "OversizeModels"), .product(name: "OversizeNetwork", package: "OversizeNetwork"), .product(name: "Factory", package: "Factory"), - .product(name: "CachedAsyncImage", package: "swiftui-cached-async-image"), - .product(name: "EffectsLibrary", package: "effects-library"), + .product(name: "CachedAsyncImage", package: "swiftui-cached-async-image") ] ), .target( diff --git a/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift b/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift index a4937e5..2a9f32e 100644 --- a/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift +++ b/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventView.swift @@ -56,7 +56,7 @@ public struct CreateEventView: View { Button { viewModel.present(.calendar) } label: { HStack(spacing: .xxxSmall) { Circle() - .fill(Color(viewModel.calendar?.cgColor ?? UIColor.gray.cgColor)) + .fill(Color(viewModel.calendar?.cgColor ?? CGColor.init(red: 0.4, green: 0.4, blue: 0.4, alpha: 1))) .frame(width: 16, height: 16) .padding(.xxxSmall) @@ -149,6 +149,7 @@ public struct CreateEventView: View { .body(.medium) .scrollContentBackground(.hidden) .background { + #if os(iOS) RoundedRectangleCorner(radius: 4, corners: [.bottomLeft, .bottomRight]) .fillSurfaceSecondary() .overlay(alignment: .topLeading) { @@ -159,6 +160,18 @@ public struct CreateEventView: View { .padding(.small) } } + #else + RoundedRectangle(cornerRadius: .small) + .fillSurfaceSecondary() + .overlay(alignment: .topLeading) { + if viewModel.note.isEmpty { + Text("Note") + .body(.medium) + .onSurfaceDisabledForegroundColor() + .padding(.small) + } + } + #endif } .frame(minHeight: 76) @@ -169,8 +182,13 @@ public struct CreateEventView: View { .padding(.horizontal, .small) .padding(.vertical, 18) .background { + #if os(iOS) RoundedRectangleCorner(radius: 4, corners: [.topLeft, .topRight]) .fillSurfaceSecondary() + #else + RoundedRectangle(cornerRadius: .small) + .fillSurfaceSecondary() + #endif } } .clipShape(RoundedRectangle(cornerRadius: .large, style: .continuous)) diff --git a/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventViewSheet.swift b/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventViewSheet.swift index 5a9513f..a09b54f 100644 --- a/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventViewSheet.swift +++ b/Sources/OversizeCalendarKit/CreateEventScreen/CreateEventViewSheet.swift @@ -64,6 +64,7 @@ public extension CreateEventView { Group { switch sheet { case .startTime: + #if os(iOS) DatePickerSheet(title: "Starts time", selection: $viewModel.dateStart) .onDisappear { if viewModel.dateStart > viewModel.dateEnd { @@ -71,10 +72,17 @@ public extension CreateEventView { } } .presentationDetents([.height(500)]) + #else + EmptyView() + #endif case .endTime: + #if os(iOS) DatePickerSheet(title: "Ends time", selection: $viewModel.dateEnd) .datePickerMinimumDate(viewModel.dateStart.minute) .presentationDetents([.height(500)]) + #else + EmptyView() + #endif case .attachment: AttachmentView() .presentationDetents([.height(270)]) diff --git a/Sources/OversizeCalendarKit/Pickers/CalendarPicker.swift b/Sources/OversizeCalendarKit/Pickers/CalendarPicker.swift index f09adae..173685e 100644 --- a/Sources/OversizeCalendarKit/Pickers/CalendarPicker.swift +++ b/Sources/OversizeCalendarKit/Pickers/CalendarPicker.swift @@ -57,7 +57,7 @@ public struct CalendarPicker: View { } } } - .surfaceContentRowInsets() + .surfaceContentRowMargins() } } diff --git a/Sources/OversizeCalendarKit/Pickers/RepeatPicker.swift b/Sources/OversizeCalendarKit/Pickers/RepeatPicker.swift index bae85a9..ec7b5d2 100644 --- a/Sources/OversizeCalendarKit/Pickers/RepeatPicker.swift +++ b/Sources/OversizeCalendarKit/Pickers/RepeatPicker.swift @@ -89,7 +89,7 @@ public struct RepeatPicker: View { })) .disabled(rule == .never) } - .surfaceContentRowInsets() + .surfaceContentRowMargins() } .presentationDetents(rule == .never ? [.height(630), .large] : [.large]) .presentationDragIndicator(.hidden) @@ -107,7 +107,9 @@ public struct RepeatPicker: View { repeatCount = newValue endRule = .occurrenceCount(Int(newValue) ?? 1) })) + #if os(iOS) .keyboardType(.numberPad) + #endif .textFieldStyle(DefaultPlaceholderTextFieldStyle()) .focused($isFocusedRepitCount) case .endDate: @@ -117,7 +119,9 @@ public struct RepeatPicker: View { endDate = newDate endRule = .endDate(newDate) })) + #if os(iOS) .datePickerStyle(.wheel) + #endif .labelsHidden() } } diff --git a/Sources/OversizeContactsKit/ContactsLists/ContactsListsView.swift b/Sources/OversizeContactsKit/ContactsLists/ContactsListsView.swift index b8c79a9..c13e5ef 100644 --- a/Sources/OversizeContactsKit/ContactsLists/ContactsListsView.swift +++ b/Sources/OversizeContactsKit/ContactsLists/ContactsListsView.swift @@ -65,6 +65,7 @@ public struct ContactsListsView: View { @ViewBuilder private func emailRow(email: CNLabeledValue, contact: CNContact) -> some View { let email = email.value as String + #if os(iOS) if let avatarThumbnailData = contact.thumbnailImageData, let avatarThumbnail = UIImage(data: avatarThumbnailData) { Row(contact.givenName + " " + contact.familyName, subtitle: email) { Avatar(firstName: contact.givenName, lastName: contact.familyName, avatar: Image(uiImage: avatarThumbnail)) @@ -74,6 +75,11 @@ public struct ContactsListsView: View { Avatar(firstName: contact.givenName, lastName: contact.familyName) } } + #else + Row(contact.givenName + " " + contact.familyName, subtitle: email) { + Avatar(firstName: contact.givenName, lastName: contact.familyName) + } + #endif } @ViewBuilder diff --git a/Sources/OversizeContactsKit/ContactsPicker/EmailPickerView.swift b/Sources/OversizeContactsKit/ContactsPicker/EmailPickerView.swift index b06c7ca..bb67810 100644 --- a/Sources/OversizeContactsKit/ContactsPicker/EmailPickerView.swift +++ b/Sources/OversizeContactsKit/ContactsPicker/EmailPickerView.swift @@ -49,7 +49,9 @@ public struct EmailPickerView: View { TextField("Email or name", text: $viewModel.searchText) .textFieldStyle(DefaultPlaceholderTextFieldStyle()) .focused($isFocusSearth) + #if os(iOS) .keyboardType(.emailAddress) + #endif } .onAppear { isFocusSearth = true @@ -151,6 +153,7 @@ public struct EmailPickerView: View { private func emailRow(email: CNLabeledValue, contact: CNContact) -> some View { let email = email.value as String let isSelected = selectedEmails.contains(email) + #if os(iOS) if let avatarThumbnailData = contact.thumbnailImageData, let avatarThumbnail = UIImage(data: avatarThumbnailData) { Checkbox(isOn: Binding( get: { isSelected }, @@ -172,6 +175,17 @@ public struct EmailPickerView: View { }) } + #else + Checkbox(isOn: Binding( + get: { isSelected }, + set: { _ in onContactClick(email: email) } + ), label: { + Row(contact.givenName + " " + contact.familyName, subtitle: email) { + Avatar(firstName: contact.givenName, lastName: contact.familyName) + } + + }) + #endif } private func onDoneAction() { diff --git a/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift b/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift index 292b1bc..2f522b6 100644 --- a/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift +++ b/Sources/OversizeKit/StoreKit/StoreScreen/StoreSpecialOfferView.swift @@ -4,7 +4,6 @@ // import CachedAsyncImage -import EffectsLibrary import OversizeComponents import OversizeCore import OversizeLocalizable @@ -97,7 +96,7 @@ public struct StoreSpecialOfferView: View { } } .toolbar { - ToolbarItem(placement: .topBarLeading) { + ToolbarItem(placement: .cancellationAction) { Button { lastClosedSpecialOffer = event.id dismiss() @@ -113,14 +112,7 @@ public struct StoreSpecialOfferView: View { var effectsView: some View { switch event.effect { case .snow: - SnowView(config: .init( - intensity: .low, - lifetime: .long, - initialVelocity: .medium, - fadeOut: .slow, - spreadRadius: .high - )) - .offset(y: -150) + EmptyView() default: EmptyView() } diff --git a/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift b/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift index d14457d..b7a9d9f 100644 --- a/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift +++ b/Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift @@ -234,7 +234,7 @@ import SwiftUI } public func closable(_: Bool = true) -> StoreView { - var control = self + let control = self return control } } diff --git a/Sources/OversizeLocationKit/MapCoordinateView/MapCoordinateView.swift b/Sources/OversizeLocationKit/MapCoordinateView/MapCoordinateView.swift index 2939463..dec7d90 100644 --- a/Sources/OversizeLocationKit/MapCoordinateView/MapCoordinateView.swift +++ b/Sources/OversizeLocationKit/MapCoordinateView/MapCoordinateView.swift @@ -31,7 +31,9 @@ public struct MapCoordinateView: View { }) .background(.thickMaterial, ignoresSafeAreaEdges: .top) } + #if os(iOS) .toolbar(.hidden, for: .tabBar) + #endif } else { mapView .safeAreaInset(edge: .top) { @@ -132,7 +134,7 @@ public struct MapCoordinateView: View { }) .backgroundSecondary() .disableScrollShadow(true) - .surfaceContentRowInsets() + .surfaceContentRowMargins() } func onTapAppleMaps() { diff --git a/Sources/OversizeOnboardingKit/OnboardingView.swift b/Sources/OversizeOnboardingKit/OnboardingView.swift index 081ee47..a12d76e 100644 --- a/Sources/OversizeOnboardingKit/OnboardingView.swift +++ b/Sources/OversizeOnboardingKit/OnboardingView.swift @@ -40,8 +40,10 @@ public struct OnboardingView: View { // .tag(index) // } } + #if os(iOS) .tabViewStyle(.page(indexDisplayMode: .never)) .indexViewStyle(.page(backgroundDisplayMode: .never)) + #endif } .background( Color.backgroundSecondary.ignoresSafeArea() diff --git a/Sources/OversizePhotoKit/PhotosGalleryView.swift b/Sources/OversizePhotoKit/PhotosGalleryView.swift index 47a1dd2..7aff10e 100644 --- a/Sources/OversizePhotoKit/PhotosGalleryView.swift +++ b/Sources/OversizePhotoKit/PhotosGalleryView.swift @@ -35,7 +35,9 @@ public struct PhotosGalleryView: View { .leadingBar { BarButton(.back) } + #if os(iOS) .photoOverlay(isPresent: $isShowPhoto, selection: $selection, photos: images) + #endif } }