Skip to content

Commit 6d8a8e8

Browse files
committed
Open url on Article reader button
1 parent c45d738 commit 6d8a8e8

4 files changed

Lines changed: 8 additions & 2 deletions

File tree

BoxFeed/Config.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ struct AppConfig {
1313
static let APP_NAME = "Box Feed"
1414
static let APP_LINK = "https://github.com/sameersyd/BoxFeed"
1515
// https://newsapi.org
16-
static let API_KEY = "" // Add your API key here
16+
static let API_KEY = "5b6e1c3421a64bbdafe8511ea8709f04" // Add your API key here
1717
}

BoxFeed/Screens/Article/ArticleView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extension ArticleView {
5656
.foregroundColor(.text_primary)
5757
.modifier(FontModifier(.bold, size: 16))
5858
Spacer()
59-
Button(action: { }) {
59+
Button(action: viewModel.openNewsUrl) {
6060
Image.article.resizable()
6161
.renderingMode(.template)
6262
.foregroundColor(.text_primary)

BoxFeed/Screens/Article/ArticleViewModel.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ class ArticleViewModel: ObservableObject {
1616
self.model = model
1717
}
1818

19+
func openNewsUrl() {
20+
if let url = model.url {
21+
UIApplication.shared.open(url)
22+
}
23+
}
24+
1925
func isBookmarked(_ articles: FetchedResults<ArticleCD>) -> Bool {
2026
for article in articles {
2127
if article.url == model.url?.absoluteString {

0 commit comments

Comments
 (0)