Skip to content

Commit 1941b57

Browse files
committed
Open Github release page by tapping on About App
1 parent f0994cc commit 1941b57

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

ForPDA/Sources/Extensions/URL+Ext.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ extension URL {
1515
return URL(string: "https://4pda.to/page/\(page)/")!
1616
}
1717

18+
static func githubRelease() -> URL {
19+
if let marketingVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
20+
return URL(string: "https://github.com/SubvertDev/ForPDA/releases/tag/v\(marketingVersion)/")!
21+
} else {
22+
return URL(string: "https://github.com/SubvertDev/ForPDA/")!
23+
}
24+
}
25+
1826
func stripLastURLComponent() -> URL {
1927
var newUrl = self
2028
newUrl.deleteLastPathComponent()

ForPDA/Sources/Modules/Settings/SettingsPresenter.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ final class SettingsPresenter: SettingsPresenterProtocol {
9999
// About App
100100
MenuSection(title: R.string.localizable.aboutApp(), options: [
101101
// .staticCell(model: MenuOption(title: "Проверить обновления", handler: {})),
102-
.staticCell(model: MenuOption(title: "\(R.string.localizable.version()) \(version) (\(build.trimmingCharacters(in: .whitespacesAndNewlines)))", handler: {}))
102+
.staticCell(model: MenuOption(title: "\(R.string.localizable.version()) \(version) (\(build.trimmingCharacters(in: .whitespacesAndNewlines)))", handler: showReleaseOnGithub))
103103
])
104104
]
105105

@@ -182,6 +182,11 @@ final class SettingsPresenter: SettingsPresenterProtocol {
182182
view?.showChangeDarkThemeBackgroundColorSheet()
183183
}
184184

185+
private func showReleaseOnGithub() {
186+
analytics.event(Event.Settings.openGithubRelease.rawValue)
187+
UIApplication.shared.open(URL.githubRelease())
188+
}
189+
185190
private func showDefaultError() {
186191
view?.showDefaultError()
187192
}

ForPDA/Sources/Services/Analytics/Event.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum Event {
5353
case nightModeChanged
5454
case fastLoadingSystemChanged
5555
case showLikesChanged
56+
case openGithubRelease
5657
}
5758

5859
}

0 commit comments

Comments
 (0)