Skip to content

Commit

Permalink
Merge pull request #64 from DroidKaigi/MrSmart00/feature/safari
Browse files Browse the repository at this point in the history
Add SafariView and connect with url links
  • Loading branch information
MrSmart00 authored Jun 23, 2024
2 parents 0fece23 + 0f77b44 commit e797c0b
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 14 deletions.
15 changes: 10 additions & 5 deletions app-ios/Sources/AboutFeature/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,24 @@ public struct AboutView: View {
}
}
.sheet(item: $store.scope(state: \.destination?.codeOfConduct, action: \.presentation.codeOfConduct), content: { _ in
Text("CodeOfConduct")
SafariView(url: .codeOfConduct)
.ignoresSafeArea()
})
.sheet(item: $store.scope(state: \.destination?.privacyPolicy, action: \.presentation.privacyPolicy), content: { _ in
Text("PrivacyPolicy")
SafariView(url: .privacyPolicy)
.ignoresSafeArea()
})
.sheet(item: $store.scope(state: \.destination?.youtube, action: \.presentation.youtube), content: { _ in
Text("Youtube")
SafariView(url: .youtube)
.ignoresSafeArea()
})
.sheet(item: $store.scope(state: \.destination?.xcom, action: \.presentation.xcom), content: { _ in
Text("X.com")
SafariView(url: .xcom)
.ignoresSafeArea()
})
.sheet(item: $store.scope(state: \.destination?.medium, action: \.presentation.medium), content: { _ in
Text("Medium")
SafariView(url: .medium)
.ignoresSafeArea()
})
}

Expand Down
43 changes: 34 additions & 9 deletions app-ios/Sources/AboutFeature/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@
}
}
},
"CodeOfConductURL" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://portal.droidkaigi.jp/en/about/code-of-conduct"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://portal.droidkaigi.jp/about/code-of-conduct"
}
}
}
},
"Contributers" : {
"localizations" : {
"ja" : {
Expand Down Expand Up @@ -110,9 +127,6 @@
}
}
}
},
"Medium" : {

},
"Others" : {
"localizations" : {
Expand All @@ -134,6 +148,23 @@
}
}
},
"PrivacyPolicyURL" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://portal.droidkaigi.jp/en/about/code-of-conduct"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://portal.droidkaigi.jp/about/privacy"
}
}
}
},
"Sponsors" : {
"localizations" : {
"ja" : {
Expand All @@ -153,12 +184,6 @@
}
}
}
},
"X.com" : {

},
"Youtube" : {

}
},
"version" : "1.0"
Expand Down
24 changes: 24 additions & 0 deletions app-ios/Sources/AboutFeature/SafariView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import SafariServices
import SwiftUI

struct SafariView: UIViewControllerRepresentable {
let url: URL

func makeUIViewController(context: Context) -> some UIViewController {
let configuration = SFSafariViewController.Configuration()
configuration.barCollapsingEnabled = false
return SFSafariViewController(
url: url,
configuration: configuration
)
}

func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { }
}

#Preview {
SafariView(
url: URL(string: "https://2023.droidkaigi.jp/")!
)
}

9 changes: 9 additions & 0 deletions app-ios/Sources/AboutFeature/URL+Constants.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Foundation

extension URL {
static let youtube = URL(string: "https://www.youtube.com/c/DroidKaigi")!
static let xcom = URL(string: "https://x.com/DroidKaigi")!
static let medium = URL(string: "https://medium.com/droidkaigi")!
static let privacyPolicy = URL(string: String(localized: "PrivacyPolicyURL", bundle: .module))!
static let codeOfConduct = URL(string: String(localized: "CodeOfConductURL", bundle: .module))!
}

0 comments on commit e797c0b

Please sign in to comment.