show the frames being generated in alert

This commit is contained in:
leminlimez committed 2025-06-11 19:50:42 -04:00
1 parent 9ccc8e4317
commit 047c9e9504
4 files changed
+23 -16

No files matched your search

+2 -2
View File
@@ -264,7 +264,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"Pocket Poster/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Pocket Poster/Preview Content\"";
DEVELOPMENT_TEAM = 2P4CP47H76; DEVELOPMENT_TEAM = 2P4CP47H76;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -296,7 +296,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"Pocket Poster/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Pocket Poster/Preview Content\"";
DEVELOPMENT_TEAM = 2P4CP47H76; DEVELOPMENT_TEAM = 2P4CP47H76;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -190,6 +190,7 @@ class PosterBoardManager: ObservableObject {
print(error.localizedDescription) print(error.localizedDescription)
} }
} }
UIApplication.shared.change(title: "Applying Wallpapers...", body: "Extracting tendies...")
for url in selectedTendies { for url in selectedTendies {
let unzippedDir = try unzipFile(at: url) let unzippedDir = try unzipFile(at: url)
guard let descriptors = try getDescriptorsFromTendie(unzippedDir) else { continue } // TODO: Add error handling guard let descriptors = try getDescriptorsFromTendie(unzippedDir) else { continue } // TODO: Add error handling
+3 -1
View File
@@ -91,11 +91,12 @@ class VideoHandler {
while let sampleBuffer = readerOutput.copyNextSampleBuffer(), while let sampleBuffer = readerOutput.copyNextSampleBuffer(),
let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) { let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) {
let name = "\(frameCount).jpg"
UIApplication.shared.change(title: "Generating Video...", body: "Creating assets/\(name)...")
let ciImage = CIImage(cvPixelBuffer: imageBuffer) let ciImage = CIImage(cvPixelBuffer: imageBuffer)
let context = CIContext() let context = CIContext()
if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) { if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) {
let name = "\(frameCount).jpg"
if let img = cgImage.jpg { if let img = cgImage.jpg {
try img.write(to: assetsFolder.appendingPathComponent(name)) try img.write(to: assetsFolder.appendingPathComponent(name))
camlData += "\t\t\t<CGImage src=\"assets/\(name)\"/>\n" camlData += "\t\t\t<CGImage src=\"assets/\(name)\"/>\n"
@@ -107,6 +108,7 @@ class VideoHandler {
} catch { } catch {
print("Error reading asset: \(error)") print("Error reading asset: \(error)")
} }
UIApplication.shared.change(title: "Generating Video...", body: "Creating CAML data...")
camlData += """ camlData += """
</values> </values>
+17 -13
View File
@@ -136,9 +136,9 @@ struct ContentView: View {
if !pbManager.selectedTendies.isEmpty || selectedVideo != nil { if !pbManager.selectedTendies.isEmpty || selectedVideo != nil {
Button(action: { Button(action: {
UIImpactFeedbackGenerator(style: .soft).impactOccurred() UIImpactFeedbackGenerator(style: .soft).impactOccurred()
UIApplication.shared.alert(title: NSLocalizedString("Applying Tendies...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false) UIApplication.shared.alert(title: NSLocalizedString("Applying Wallpapers...", comment: ""), body: NSLocalizedString("Please wait", comment: ""), animated: false, withButton: false)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { DispatchQueue.global(qos: .userInitiated).async {
do { do {
var videoURL: URL? = nil var videoURL: URL? = nil
switch loadState { switch loadState {
@@ -148,26 +148,30 @@ struct ContentView: View {
videoURL = nil videoURL = nil
} }
try pbManager.applyTendies(appHash: pbHash, videoURL: videoURL) try pbManager.applyTendies(appHash: pbHash, videoURL: videoURL)
pbManager.selectedTendies.removeAll()
SymHandler.cleanup() // just to be extra sure SymHandler.cleanup() // just to be extra sure
try? FileManager.default.removeItem(at: pbManager.getTendiesStoreURL()) try? FileManager.default.removeItem(at: pbManager.getTendiesStoreURL())
if let videoURL = videoURL { if let videoURL = videoURL {
try? FileManager.default.removeItem(at: videoURL) try? FileManager.default.removeItem(at: videoURL)
} }
Haptic.shared.notify(.success) Haptic.shared.notify(.success)
UIApplication.shared.dismissAlert(animated: true) UIApplication.shared.dismissAlert(animated: false)
UIApplication.shared.confirmAlert(title: "Success!", body: "The PosterBoard app will now open. Please close it from the app switcher.", onOK: { DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: {
if !pbManager.openPosterBoard() { pbManager.selectedTendies.removeAll()
UIApplication.shared.confirmAlert(title: "Falling Back to Shortcut", body: "PosterBoard failed to open directly. The fallback shortcut will now be opened.", onOK: { UIApplication.shared.confirmAlert(title: "Success!", body: "The PosterBoard app will now open. Please close it from the app switcher.", onOK: {
pbManager.runShortcut(named: "PosterBoard") if !pbManager.openPosterBoard() {
}, noCancel: true) UIApplication.shared.confirmAlert(title: "Falling Back to Shortcut", body: "PosterBoard failed to open directly. The fallback shortcut will now be opened.", onOK: {
} pbManager.runShortcut(named: "PosterBoard")
}, noCancel: true) }, noCancel: true)
}
}, noCancel: true)
})
} catch { } catch {
Haptic.shared.notify(.error) Haptic.shared.notify(.error)
SymHandler.cleanup() SymHandler.cleanup()
UIApplication.shared.dismissAlert(animated: true) UIApplication.shared.dismissAlert(animated: false)
UIApplication.shared.alert(body: error.localizedDescription) DispatchQueue.main.asyncAfter(deadline: .now() + 0.35, execute: {
UIApplication.shared.alert(body: error.localizedDescription)
})
} }
} }
}) { }) {