Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 849d4ab

Browse files
authored
Update SetupView.swift
1 parent 6b724cf commit 849d4ab

1 file changed

Lines changed: 28 additions & 13 deletions

File tree

Sources/prostore/views/SetupView.swift

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,35 @@ struct SetupView: View {
6767

6868
Spacer()
6969

70-
Button(currentPage == pages.count - 1 ? "Finish" : "Next") {
71-
withAnimation {
72-
if pages[currentPage].title == "Install ProStore Shortcut",
73-
let rawURL = "https://raw.githubusercontent.com/ProStore-iOS/files/refs/heads/main/Turn%20on%20VPN.shortcut".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed),
74-
let shortcutURL = URL(string: "shortcuts://import-shortcut?url=\(rawURL)") {
75-
UIApplication.shared.open(shortcutURL)
70+
Button(currentPage == pages.count - 1 ? "Finish" : "Next") {
71+
withAnimation {
72+
if pages[currentPage].title == "Install ProStore Shortcut" {
73+
// The raw GitHub URL (no extra encoding here).
74+
let rawURLString = "https://raw.githubusercontent.com/ProStore-iOS/files/refs/heads/main/Turn on VPN.shortcut"
75+
76+
// Build the shortcuts URL safely via URLComponents so the `url` query item is percent-encoded correctly.
77+
if var components = URLComponents(string: "shortcuts://import-shortcut") {
78+
components.queryItems = [
79+
URLQueryItem(name: "url", value: rawURLString)
80+
]
81+
82+
if let shortcutURL = components.url {
83+
UIApplication.shared.open(shortcutURL)
84+
} else {
85+
// fallback or debug
86+
print("Failed to build shortcuts URL")
87+
}
88+
}
89+
}
90+
91+
if currentPage < pages.count - 1 {
92+
currentPage += 1
93+
} else {
94+
onComplete()
95+
}
96+
}
7697
}
7798

78-
if currentPage < pages.count - 1 {
79-
currentPage += 1
80-
} else {
81-
onComplete()
82-
}
83-
}
84-
}
8599
.buttonStyle(.borderedProminent)
86100
}
87101
.padding(.horizontal)
@@ -99,3 +113,4 @@ struct SetupPage {
99113
let imageName: String
100114

101115
}
116+

0 commit comments

Comments
 (0)