Skip to content

Commit

Permalink
Fixes some items not appearing on 'Release' filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
MadeiraAlexandre committed Aug 24, 2023
1 parent f3abcaf commit 1fd39a4
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ extension PersistenceController {
if isItemSaved(id: content.itemContentID) {
let item = fetch(for: content.itemContentID)
guard let item else { return }
if content.itemContentMedia == .movie && content.itemStatus == .released && !item.itemLastUpdateDate.hasPassedFourWeeks() { return }
if item.title != content.itemTitle {
item.title = content.itemTitle
}
Expand Down
1 change: 1 addition & 0 deletions Shared/Extensions/WatchlistItem-Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ extension WatchlistItem {
}
var isReleasedMovie: Bool {
if itemMedia == .movie {
if date != nil && itemReleaseDate < Date() && !isWatched { return true }
if itemSchedule == .released && !notify && !isWatched {
return true
}
Expand Down
222 changes: 111 additions & 111 deletions Shared/View/ItemContent/Components/ItemContentRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,133 +9,133 @@ import SwiftUI
import SDWebImageSwiftUI

struct ItemContentRowView: View {
let item: ItemContent
@State private var isWatched = false
@State private var isFavorite = false
@State private var isPin = false
@State private var isArchive = false
@Binding var showPopup: Bool
@State private var isInWatchlist = false
@State private var canReview = true
@State private var showNote = false
@State private var showCustomListView = false
@Binding var popupType: ActionPopupItems?
private let persistence = PersistenceController.shared
let item: ItemContent
@State private var isWatched = false
@State private var isFavorite = false
@State private var isPin = false
@State private var isArchive = false
@Binding var showPopup: Bool
@State private var isInWatchlist = false
@State private var canReview = true
@State private var showNote = false
@State private var showCustomListView = false
@Binding var popupType: ActionPopupItems?
private let persistence = PersistenceController.shared
var showNotificationDate = false
var body: some View {
NavigationLink(value: item) {
HStack {
ZStack {
WebImage(url: item.cardImageSmall)
.placeholder {
ZStack {
Rectangle().fill(.gray.gradient)
Image(systemName: "popcorn.fill")
.foregroundColor(.white.opacity(0.8))
}
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight)
}
.resizable()
.aspectRatio(contentMode: .fill)
.transition(.opacity)
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight)
.shadow(radius: 2.5)
if isWatched {
Color.black.opacity(0.5)
Image(systemName: "rectangle.fill.badge.checkmark")
.foregroundColor(.white)
}
// else if isInWatchlist {
// Color.black.opacity(0.5)
// Image(systemName: "checkmark.circle.fill")
// .foregroundColor(.white)
// }
}
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight)
.clipShape(RoundedRectangle(cornerRadius: DrawingConstants.imageRadius))
VStack(alignment: .leading) {
HStack {
Text(item.itemTitle)
.lineLimit(DrawingConstants.textLimit)
}
HStack {
var body: some View {
NavigationLink(value: item) {
HStack {
ZStack {
WebImage(url: item.cardImageSmall)
.placeholder {
ZStack {
Rectangle().fill(.gray.gradient)
Image(systemName: "popcorn.fill")
.foregroundColor(.white.opacity(0.8))
}
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight)
}
.resizable()
.aspectRatio(contentMode: .fill)
.transition(.opacity)
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight)
.shadow(radius: 2.5)
if isWatched {
Color.black.opacity(0.5)
Image(systemName: "rectangle.fill.badge.checkmark")
.foregroundColor(.white)
}
// else if isInWatchlist {
// Color.black.opacity(0.5)
// Image(systemName: "checkmark.circle.fill")
// .foregroundColor(.white)
// }
}
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight)
.clipShape(RoundedRectangle(cornerRadius: DrawingConstants.imageRadius))
VStack(alignment: .leading) {
HStack {
Text(item.itemTitle)
.lineLimit(DrawingConstants.textLimit)
}
HStack {
Text(showNotificationDate ? item.itemNotificationDescription : item.itemSearchDescription)
.font(.caption)
.foregroundColor(.secondary)
Spacer()
}
}
.font(.caption)
.foregroundColor(.secondary)
Spacer()
}
}
#if os(iOS) || os(macOS)
Spacer()
IconGridView(isFavorite: $isFavorite, isPin: $isPin)
.accessibilityHidden(true)
Spacer()
IconGridView(isFavorite: $isFavorite, isPin: $isPin)
.accessibilityHidden(true)
#endif
}
.itemContentContextMenu(item: item,
isWatched: $isWatched,
showPopup: $showPopup,
isInWatchlist: $isInWatchlist,
showNote: $showNote,
showCustomList: $showCustomListView,
popupType: $popupType,
isFavorite: $isFavorite,
isPin: $isPin,
isArchive: $isArchive)
.task {
isInWatchlist = persistence.isItemSaved(id: item.itemContentID)
if isInWatchlist {
isWatched = persistence.isMarkedAsWatched(id: item.itemContentID)
isPin = persistence.isItemPinned(id: item.itemContentID)
isFavorite = persistence.isMarkedAsFavorite(id: item.itemContentID)
isArchive = persistence.isItemArchived(id: item.itemContentID)
}
}
.sheet(isPresented: $showNote) {
}
.itemContentContextMenu(item: item,
isWatched: $isWatched,
showPopup: $showPopup,
isInWatchlist: $isInWatchlist,
showNote: $showNote,
showCustomList: $showCustomListView,
popupType: $popupType,
isFavorite: $isFavorite,
isPin: $isPin,
isArchive: $isArchive)
.task {
isInWatchlist = persistence.isItemSaved(id: item.itemContentID)
if isInWatchlist {
isWatched = persistence.isMarkedAsWatched(id: item.itemContentID)
isPin = persistence.isItemPinned(id: item.itemContentID)
isFavorite = persistence.isMarkedAsFavorite(id: item.itemContentID)
isArchive = persistence.isItemArchived(id: item.itemContentID)
}
}
.sheet(isPresented: $showNote) {
#if os(iOS) || os(macOS)
NavigationStack {
ReviewView(id: item.itemContentID, showView: $showNote)
}
.presentationDetents([.large])
NavigationStack {
ReviewView(id: item.itemContentID, showView: $showNote)
}
.presentationDetents([.large])
#if os(macOS)
.frame(width: 400, height: 400, alignment: .center)
.frame(width: 400, height: 400, alignment: .center)
#endif
#endif
}
.sheet(isPresented: $showCustomListView) {
NavigationStack {
ItemContentCustomListSelector(contentID: item.itemContentID,
showView: $showCustomListView,
title: item.itemTitle,
image: item.cardImageSmall)
}
.presentationDetents([.large])
}
.sheet(isPresented: $showCustomListView) {
NavigationStack {
ItemContentCustomListSelector(contentID: item.itemContentID,
showView: $showCustomListView,
title: item.itemTitle,
image: item.cardImageSmall)
}
.presentationDetents([.large])
#if os(macOS)
.frame(width: 500, height: 600, alignment: .center)
.frame(width: 500, height: 600, alignment: .center)
#else
.appTheme()
.appTint()
.appTheme()
.appTint()
#endif
}
}
}
}
}
}
}

private struct DrawingConstants {
#if os(watchOS)
#if os(watchOS)
static let imageWidth: CGFloat = 70
#else
static let imageWidth: CGFloat = 80
#endif
static let imageHeight: CGFloat = 50
static let imageRadius: CGFloat = 8
static let textLimit: Int = 1
#else
static let imageWidth: CGFloat = 80
#endif
static let imageHeight: CGFloat = 50
static let imageRadius: CGFloat = 8
static let textLimit: Int = 1
}

struct ItemContentItemView_Previews: PreviewProvider {
static var previews: some View {
ItemContentRowView(item: .example, showPopup: .constant(false), popupType: .constant(nil))
}
static var previews: some View {
ItemContentRowView(item: .example, showPopup: .constant(false), popupType: .constant(nil))
}
}
12 changes: 6 additions & 6 deletions Story.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.5.7;
MARKETING_VERSION = 2.5.8;
PRODUCT_BUNDLE_IDENTIFIER = dev.alexandremadeira.Story.watchkitapp;
PRODUCT_NAME = Cronica;
SDKROOT = watchos;
Expand Down Expand Up @@ -2245,7 +2245,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.5.7;
MARKETING_VERSION = 2.5.8;
PRODUCT_BUNDLE_IDENTIFIER = dev.alexandremadeira.Story.watchkitapp;
PRODUCT_NAME = Cronica;
SDKROOT = watchos;
Expand Down Expand Up @@ -2406,7 +2406,7 @@
"@executable_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 2.5.7;
MARKETING_VERSION = 2.5.8;
PRODUCT_BUNDLE_IDENTIFIER = dev.alexandremadeira.Story;
PRODUCT_NAME = Cronica;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -2451,7 +2451,7 @@
"@executable_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 2.5.7;
MARKETING_VERSION = 2.5.8;
PRODUCT_BUNDLE_IDENTIFIER = dev.alexandremadeira.Story;
PRODUCT_NAME = Cronica;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -2534,7 +2534,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.5.7;
MARKETING_VERSION = 2.5.8;
PRODUCT_BUNDLE_IDENTIFIER = dev.alexandremadeira.Story.CronicaWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -2569,7 +2569,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.5.7;
MARKETING_VERSION = 2.5.8;
PRODUCT_BUNDLE_IDENTIFIER = dev.alexandremadeira.Story.CronicaWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
Expand Down

0 comments on commit 1fd39a4

Please sign in to comment.