add time preview to video

This commit is contained in:
leminlimez committed 2025-06-21 10:47:42 -04:00
1 parent eccf8926fd
commit 71d37a38bb
4 files changed
+222 -31

No files matched your search

+150 -12
View File
@@ -839,6 +839,12 @@
}, },
"Community Translators" : { "Community Translators" : {
"localizations" : { "localizations" : {
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Fordítók"
}
},
"ru" : { "ru" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -1929,6 +1935,12 @@
"value" : "Jouir!" "value" : "Jouir!"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Élvezd!"
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -2694,6 +2706,12 @@
}, },
"Failed to Import Video" : { "Failed to Import Video" : {
"localizations" : { "localizations" : {
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Videó importálása sikertelen"
}
},
"ru" : { "ru" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -2958,6 +2976,12 @@
"value" : "Trouver des fonds d'écran" "value" : "Trouver des fonds d'écran"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Háttérképek találása"
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -3240,6 +3264,12 @@
"value" : "Obtenir un raccourci" "value" : "Obtenir un raccourci"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Shortcut letöltése"
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -3304,6 +3334,12 @@
"value" : "Voici un tutoriel pour vous aider à démarrer avec l'application." "value" : "Voici un tutoriel pour vous aider à démarrer avec l'application."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Íme egy oktatóanyag, amely segít az alkalmazás használatának megkezdésében."
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -3441,9 +3477,6 @@
} }
} }
} }
},
"How to Reset Collections" : {
}, },
"Install Nugget" : { "Install Nugget" : {
"localizations" : { "localizations" : {
@@ -3483,6 +3516,12 @@
"value" : "Installer Nugget" "value" : "Installer Nugget"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nugget telepítése"
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -3553,6 +3592,12 @@
"value" : "Installer le raccourci de repli (optionnel)" "value" : "Installer le raccourci de repli (optionnel)"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Tartalék parancs telepítése"
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -4360,6 +4405,12 @@
"value" : "Sur votre ordinateur, téléchargez Nugget depuis GitHub." "value" : "Sur votre ordinateur, téléchargez Nugget depuis GitHub."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "A számítógépeden, töltsd le a Nuggetet a GitHubról."
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -4536,6 +4587,12 @@
"value" : "Ouvrir GitHub" "value" : "Ouvrir GitHub"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "GitHub megnyitésa"
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -4567,9 +4624,6 @@
} }
} }
} }
},
"Open the Language Settings" : {
}, },
"Please wait" : { "Please wait" : {
"localizations" : { "localizations" : {
@@ -5370,9 +5424,6 @@
} }
} }
} }
},
"Set the Primary Language" : {
}, },
"Skip" : { "Skip" : {
"localizations" : { "localizations" : {
@@ -5918,6 +5969,12 @@
"value" : "Le dossier est mal configuré. Appuyez sur \"Réinitialiser les Collections\" et réessayez." "value" : "Le dossier est mal configuré. Appuyez sur \"Réinitialiser les Collections\" et réessayez."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "A mappa nincs megfelelően beállítva. Koppintson a \"Gyűjtemények visszaállítása\" gombra, és próbálja újra."
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6064,6 +6121,12 @@
}, },
"The video you imported is too long! Your video must be %@ seconds or less." : { "The video you imported is too long! Your video must be %@ seconds or less." : {
"localizations" : { "localizations" : {
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Az importált videó túl hosszú! A videó hossza legfeljebb %@ másodperc lehet."
}
},
"ru" : { "ru" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6116,6 +6179,12 @@
"value" : "Pour l'appliquer, PosterBoard doit être ouvert." "value" : "Pour l'appliquer, PosterBoard doit être ouvert."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Az alkalmazáshoz a PosterBoardnak meg kell nyílnia."
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6186,6 +6255,12 @@
"value" : "Pour obtenir l'identifiant du bundle d'application, Nugget est nécessaire." "value" : "Pour obtenir l'identifiant du bundle d'application, Nugget est nécessaire."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nuggetre van szükség az App Bundle id megszerzéséhez."
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6217,9 +6292,6 @@
} }
} }
} }
},
"Verify That It Worked" : {
}, },
"Version %@ (%@)" : { "Version %@ (%@)" : {
"localizations" : { "localizations" : {
@@ -6277,6 +6349,12 @@
"value" : "Version %1$@ (%2$@)" "value" : "Version %1$@ (%2$@)"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Verzió %1$@ (%2$@)"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6365,6 +6443,12 @@
"value" : "Vidéos" "value" : "Vidéos"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Videók"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6453,6 +6537,12 @@
"value" : "Voir sur GitHub" "value" : "Voir sur GitHub"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Megtekintés a GitHubon"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6547,6 +6637,12 @@
"value" : "Concepteur de site web" "value" : "Concepteur de site web"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Weboldal Designere"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6629,6 +6725,12 @@
"value" : "Bienvenue à Pocket Poster!" "value" : "Bienvenue à Pocket Poster!"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Üdvözlünk a Pocket Poster-be!"
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6705,6 +6807,12 @@
"value" : "Voulez-vous télécharger le fichier %@?" "value" : "Voulez-vous télécharger le fichier %@?"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Szeretnéd letölteni a(z) %@ fájlt?"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6787,6 +6895,12 @@
"value" : "Vous pouvez trouver des fonds d'écran sur le site officiel de Cowabun.ga." "value" : "Vous pouvez trouver des fonds d'écran sur le site officiel de Cowabun.ga."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Háttérképeket a hivatalos Cowabun.ga weboldalon találhatsz."
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6851,6 +6965,12 @@
"value" : "Vous pouvez installer un raccourci facultatif si la méthode originale échoue." "value" : "Vous pouvez installer un raccourci facultatif si la méthode originale échoue."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Telepíthetsz egy opcionális parancsot, ha az eredeti módszer nem működik."
}
},
"pl" : { "pl" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -6927,6 +7047,12 @@
"value" : "Vous ne pouvez appliquer que des descripteurs %@." "value" : "Vous ne pouvez appliquer que des descripteurs %@."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Csak %@ descriptort alkalmazhatsz."
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -7015,6 +7141,12 @@
"value" : "Votre App Hash est incorrect. Veuillez le redéfinir." "value" : "Votre App Hash est incorrect. Veuillez le redéfinir."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Az App hashed helytelen. Kérlek állítsd be újra"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -7103,6 +7235,12 @@
"value" : "Votre PosterBoard se rafraîchit automatiquement." "value" : "Votre PosterBoard se rafraîchit automatiquement."
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "A PosterBoardod automatikusan újra fog tölteni."
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -59,6 +59,12 @@
"value" : "Pocket Poster" "value" : "Pocket Poster"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Pocket Poster"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -147,6 +153,12 @@
"value" : "Fond d'écran Nugget" "value" : "Fond d'écran Nugget"
} }
}, },
"hu" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nugget Háttérkép"
}
},
"ja" : { "ja" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
@@ -14,12 +14,30 @@ struct VideoView: View {
@AppStorage("ignoreDurationLimit") var ignoreDurationLimit: Bool = false @AppStorage("ignoreDurationLimit") var ignoreDurationLimit: Bool = false
@State var selectedVideo: PhotosPickerItem? @State var selectedVideo: PhotosPickerItem?
@State private var currentPage: Int = 0
@State private var currentDate = Date()
private let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() // update every second
private var dateFormatter: DateFormatter {
let formatter = DateFormatter()
formatter.dateFormat = "EEEE, MMMM d"
return formatter
}
private var timeFormatter: DateFormatter {
let formatter = DateFormatter()
if Locale.current.hourCycle == .zeroToEleven || Locale.current.hourCycle == .oneToTwelve {
formatter.dateFormat = "h:mm"
} else {
formatter.dateFormat = "HH:mm"
}
return formatter
}
var body: some View { var body: some View {
VStack { VStack {
GeometryReader { geom in GeometryReader { geom in
TabView { TabView(selection: $currentPage) {
ForEach(pbManager.videos) { vid in ForEach(Array(pbManager.videos.enumerated()), id: \.offset) { idx, vid in
ZStack { ZStack {
switch vid.loadState { switch vid.loadState {
case .unknown: case .unknown:
@@ -31,6 +49,17 @@ struct VideoView: View {
.scaledToFill() .scaledToFill()
.frame(width: geom.size.width * 0.7, height: geom.size.height * 0.8) .frame(width: geom.size.width * 0.7, height: geom.size.height * 0.8)
.clipped() .clipped()
VStack {
Text(dateFormatter.string(from: currentDate))
.shadow(radius: 10)
Text(timeFormatter.string(from: currentDate))
.font(.system(size: 75, weight: .semibold, design: .rounded))
.shadow(radius: 10)
Spacer()
}
.padding(.top, 45)
.foregroundStyle(.white)
case .failed: case .failed:
Text("Failed") Text("Failed")
} }
@@ -39,6 +68,7 @@ struct VideoView: View {
.shadow(radius: 5) .shadow(radius: 5)
.background(Color.black.opacity(0.6)) .background(Color.black.opacity(0.6))
.cornerRadius(24) .cornerRadius(24)
.tag(idx)
.overlay { .overlay {
RoundedRectangle(cornerRadius: 24) RoundedRectangle(cornerRadius: 24)
.stroke(.gray, lineWidth: 4) .stroke(.gray, lineWidth: 4)
@@ -51,22 +81,30 @@ struct VideoView: View {
.overlay( .overlay(
// Loops Button // Loops Button
Button(action: { Button(action: {
if let index = pbManager.videos.firstIndex(of: vid) { pbManager.videos[idx].autoReverses = !vid.autoReverses
pbManager.videos[index].autoReverses = !vid.autoReverses
}
}) { }) {
Image(systemName: "arrow.left.arrow.right.circle") Image(systemName: "arrow.left.arrow.right.circle")
.font(.title) .font(.title)
.foregroundStyle(.black) .foregroundStyle(Color(uiColor: .label))
.background { .background {
if vid.autoReverses {
Circle() Circle()
.foregroundStyle(vid.autoReverses ? .blue : .white) .foregroundStyle(.blue.opacity(0.8))
.shadow(radius: 5)
} else {
Circle()
.foregroundStyle(.regularMaterial)
.shadow(radius: 5)
}
} }
}.offset(x: 8, y: -8), }.offset(x: 8, y: -8),
alignment: .topTrailing alignment: .topTrailing
) )
} }
.onDelete(perform: removeVideo) .onDelete(perform: removeVideo)
.onReceive(timer) { input in
currentDate = input
}
// MARK: Select Photo Option // MARK: Select Photo Option
if selectedVideo == nil && pbManager.videos.count < 5 { if selectedVideo == nil && pbManager.videos.count < 5 {
@@ -90,6 +128,7 @@ struct VideoView: View {
.shadow(radius: 5) .shadow(radius: 5)
.background(Color.black.opacity(0.6)) .background(Color.black.opacity(0.6))
.cornerRadius(24) .cornerRadius(24)
.tag(pbManager.videos.count)
.overlay { .overlay {
RoundedRectangle(cornerRadius: 24) RoundedRectangle(cornerRadius: 24)
.stroke(.gray, lineWidth: 4) .stroke(.gray, lineWidth: 4)
@@ -109,6 +148,7 @@ struct VideoView: View {
UIApplication.shared.alert(title: NSLocalizedString("Failed to Import Video", comment: ""), body: String(format: NSLocalizedString("The video you imported is too long! Your video must be %@ seconds or less.", comment: ""), "\(Int(VideoHandler.MaxDurationSecs))")) UIApplication.shared.alert(title: NSLocalizedString("Failed to Import Video", comment: ""), body: String(format: NSLocalizedString("The video you imported is too long! Your video must be %@ seconds or less.", comment: ""), "\(Int(VideoHandler.MaxDurationSecs))"))
} else { } else {
pbManager.videos[id].loadState = .loaded(movie) pbManager.videos[id].loadState = .loaded(movie)
currentPage = id
} }
} }
} else { } else {
@@ -124,7 +164,7 @@ struct VideoView: View {
selectedVideo = nil selectedVideo = nil
} }
} }
.tabViewStyle(.page) .tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))
} }
} }
} }
@@ -155,7 +195,8 @@ struct DeleteButton: View {
.font(.title) .font(.title)
.background { .background {
Circle() Circle()
.foregroundStyle(.white) .foregroundStyle(.regularMaterial)
.shadow(radius: 5)
} }
} }
.offset(x: -8, y: -8) .offset(x: -8, y: -8)
@@ -9,14 +9,14 @@ import SwiftUICore
struct OnBoardingPage: Identifiable { struct OnBoardingPage: Identifiable {
var id = UUID() var id = UUID()
var title: LocalizedStringKey var title: String
var description: String var description: String
var image: String var image: String
var link: URL? var link: URL?
var linkName: LocalizedStringKey? var linkName: String?
var gradientColors: [Color] var gradientColors: [Color]
init(title: LocalizedStringKey, description: String, image: String, link: URL? = nil, linkName: LocalizedStringKey? = nil, gradientColors: [Color] = [Color("WelcomeLight"), Color("WelcomeDark")]) { init(title: String, description: String, image: String, link: URL? = nil, linkName: String? = nil, gradientColors: [Color] = [Color("WelcomeLight"), Color("WelcomeDark")]) {
self.id = UUID() self.id = UUID()
self.title = title self.title = title
self.description = description self.description = description
@@ -29,30 +29,30 @@ struct OnBoardingPage: Identifiable {
let onBoardingCards: [OnBoardingPage] = [ let onBoardingCards: [OnBoardingPage] = [
.init( .init(
title: "Welcome to Pocket Poster!", title: NSLocalizedString("Welcome to Pocket Poster!", comment: ""),
description: NSLocalizedString("Here is a tutorial to help you get started with the app.", comment: ""), description: NSLocalizedString("Here is a tutorial to help you get started with the app.", comment: ""),
image: "Logo" image: "Logo"
), ),
.init( .init(
title: "Install the Fallback Shortcut (Optional)", title: NSLocalizedString("Install the Fallback Shortcut (Optional)", comment: ""),
description: NSLocalizedString("To apply, PosterBoard will need to open.", comment: "") + "\n\n" + NSLocalizedString("You can install an optional shortcut if the original method fails.", comment: ""), description: NSLocalizedString("To apply, PosterBoard will need to open.", comment: "") + "\n\n" + NSLocalizedString("You can install an optional shortcut if the original method fails.", comment: ""),
image: "Shortcuts", image: "Shortcuts",
link: URL(string: PosterBoardManager.ShortcutURL), link: URL(string: PosterBoardManager.ShortcutURL),
linkName: "Get Shortcut" linkName: NSLocalizedString("Get Shortcut", comment: "")
), ),
.init( .init(
title: "Install Nugget", title: NSLocalizedString("Install Nugget", comment: ""),
description: NSLocalizedString("To get the app bundle id, Nugget is required.", comment: "") + "\n\n" + NSLocalizedString("On your computer, download Nugget from the GitHub.", comment: ""), description: NSLocalizedString("To get the app bundle id, Nugget is required.", comment: "") + "\n\n" + NSLocalizedString("On your computer, download Nugget from the GitHub.", comment: ""),
image: "Nugget", image: "Nugget",
link: URL(string: "https://github.com/leminlimez/Nugget/releases/latest"), link: URL(string: "https://github.com/leminlimez/Nugget/releases/latest"),
linkName: "Open GitHub" linkName: NSLocalizedString("Open GitHub", comment: "")
), ),
.init( .init(
title: "Enjoy!", title: NSLocalizedString("Enjoy!", comment: ""),
description: NSLocalizedString("You can find wallpapers on the official Cowabun.ga website.", comment: ""), description: NSLocalizedString("You can find wallpapers on the official Cowabun.ga website.", comment: ""),
image: "Cowabunga", image: "Cowabunga",
link: URL(string: PosterBoardManager.WallpapersURL), link: URL(string: PosterBoardManager.WallpapersURL),
linkName: "Find Wallpapers" linkName: NSLocalizedString("Find Wallpapers", comment: "")
) )
] ]