Skip to content

Commit

Permalink
Add Hacker News guidelines button to login screen (#354)
Browse files Browse the repository at this point in the history
Added button to open Hacker New's Guidelines 
![Simulator Screenshot - iPhone 16 Pro - 2025-02-04 at 17 52
18](https://github.com/user-attachments/assets/cf5cfea7-048d-421a-a765-2797dc180f9e)
  • Loading branch information
Itaybre authored Feb 5, 2025
1 parent fb80e92 commit 7df8ff5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ios/HackerNews/Auth/LoginScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ struct LoginScreen: View {
.font(.ibmPlexMono(.regular, size: 14))
}


HStack(spacing: 0) {
Text("By signing in, you agree to the ")
.font(.ibmPlexSans(.regular, size: 12))
Text("Hacker News Guidelines")
.font(.ibmPlexSans(.regular, size: 12))
.foregroundColor(.blue)
.underline()
.onTapGesture {
openURL("https://news.ycombinator.com/newsguidelines.html")
}
Spacer()
}

Spacer()
.frame(maxHeight: 16)

Expand Down Expand Up @@ -96,6 +110,11 @@ struct LoginScreen: View {
.padding(32)
.background(.surface)
}

func openURL(_ urlString: String) {
guard let url = URL(string: urlString) else { return }
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}

#Preview("Default") {
Expand Down

0 comments on commit 7df8ff5

Please sign in to comment.