Skip to content

Commit a6af03b

Browse files
committed
fix pb and carplay app hash problems
1 parent e849659 commit a6af03b

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

Pocket Poster.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
"$(inherited)",
282282
"@executable_path/Frameworks",
283283
);
284-
MARKETING_VERSION = 2.0;
284+
MARKETING_VERSION = 2.0.1;
285285
PRODUCT_BUNDLE_IDENTIFIER = "com.lemin.Pocket-Poster";
286286
PRODUCT_NAME = "$(TARGET_NAME)";
287287
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -313,7 +313,7 @@
313313
"$(inherited)",
314314
"@executable_path/Frameworks",
315315
);
316-
MARKETING_VERSION = 2.0;
316+
MARKETING_VERSION = 2.0.1;
317317
PRODUCT_BUNDLE_IDENTIFIER = "com.lemin.Pocket-Poster";
318318
PRODUCT_NAME = "$(TARGET_NAME)";
319319
SWIFT_EMIT_LOC_STRINGS = YES;

Pocket Poster/Views/SettingsView.swift

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ struct SettingsView: View {
2323
TextField("Enter App Hash", text: $pbHash)
2424
.textFieldStyle(RoundedBorderTextFieldStyle())
2525
.font(.system(.body, design: .monospaced))
26+
.onChange(of: pbHash) { _ in
27+
var separator: String? = nil
28+
if pbHash.contains(" ") {
29+
separator = " "
30+
} else if pbHash.contains("\n") {
31+
separator = "\n"
32+
}
33+
if let separator = separator {
34+
let items = pbHash.split(separator: separator)
35+
if let pb = items.first {
36+
pbHash = String(pb)
37+
}
38+
if items.count >= 2 {
39+
cpHash = String(items[1])
40+
}
41+
}
42+
}
2643
HStack {
2744
Spacer()
2845
// Run task to check until file exists from Nugget pc over AFC
@@ -144,7 +161,11 @@ struct SettingsView: View {
144161
let contents = try String(contentsOf: filePath)
145162
try? FileManager.default.removeItem(at: filePath)
146163
await MainActor.run {
147-
let items = contents.split(separator: "\n")
164+
var separator = " "
165+
if contents.contains("\n") {
166+
separator = "\n"
167+
}
168+
let items = contents.split(separator: separator)
148169
if let pb = items.first {
149170
pbHash = String(pb)
150171
}

0 commit comments

Comments
 (0)