Skip to content

Commit

Permalink
Fix build on mac os
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Mar 15, 2024
1 parent aa452cd commit b0dfa1d
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 19 deletions.
5 changes: 1 addition & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [
Expand All @@ -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"
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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) {
Expand All @@ -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)

Expand All @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,25 @@ public extension CreateEventView {
Group {
switch sheet {
case .startTime:
#if os(iOS)
DatePickerSheet(title: "Starts time", selection: $viewModel.dateStart)
.onDisappear {
if viewModel.dateStart > viewModel.dateEnd {
viewModel.dateEnd = viewModel.dateStart.halfHour
}
}
.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)])
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeCalendarKit/Pickers/CalendarPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public struct CalendarPicker: View {
}
}
}
.surfaceContentRowInsets()
.surfaceContentRowMargins()
}
}

Expand Down
6 changes: 5 additions & 1 deletion Sources/OversizeCalendarKit/Pickers/RepeatPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public struct RepeatPicker: View {
}))
.disabled(rule == .never)
}
.surfaceContentRowInsets()
.surfaceContentRowMargins()
}
.presentationDetents(rule == .never ? [.height(630), .large] : [.large])
.presentationDragIndicator(.hidden)
Expand All @@ -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:
Expand All @@ -117,7 +119,9 @@ public struct RepeatPicker: View {
endDate = newDate
endRule = .endDate(newDate)
}))
#if os(iOS)
.datePickerStyle(.wheel)
#endif
.labelsHidden()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public struct ContactsListsView: View {
@ViewBuilder
private func emailRow(email: CNLabeledValue<NSString>, 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))
Expand All @@ -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
Expand Down
14 changes: 14 additions & 0 deletions Sources/OversizeContactsKit/ContactsPicker/EmailPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -151,6 +153,7 @@ public struct EmailPickerView: View {
private func emailRow(email: CNLabeledValue<NSString>, 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 },
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import CachedAsyncImage
import EffectsLibrary
import OversizeComponents
import OversizeCore
import OversizeLocalizable
Expand Down Expand Up @@ -97,7 +96,7 @@ public struct StoreSpecialOfferView: View {
}
}
.toolbar {
ToolbarItem(placement: .topBarLeading) {
ToolbarItem(placement: .cancellationAction) {
Button {
lastClosedSpecialOffer = event.id
dismiss()
Expand All @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeKit/StoreKit/StoreScreen/StoreView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ import SwiftUI
}

public func closable(_: Bool = true) -> StoreView {
var control = self
let control = self
return control
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -132,7 +134,7 @@ public struct MapCoordinateView: View {
})
.backgroundSecondary()
.disableScrollShadow(true)
.surfaceContentRowInsets()
.surfaceContentRowMargins()
}

func onTapAppleMaps() {
Expand Down

0 comments on commit b0dfa1d

Please sign in to comment.