From e080c46fa53d9beac0ef4273c96daa7a315c6fad Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Fri, 24 Jul 2020 17:43:41 +0530 Subject: Added Launch-screen and Preprints filter --- Qrious/Base.lproj/LaunchScreen.storyboard | 11 ++++++++--- Qrious/ContentView.swift | 13 +++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Qrious/Base.lproj/LaunchScreen.storyboard b/Qrious/Base.lproj/LaunchScreen.storyboard index 09371d3..18ee6cd 100644 --- a/Qrious/Base.lproj/LaunchScreen.storyboard +++ b/Qrious/Base.lproj/LaunchScreen.storyboard @@ -15,9 +15,8 @@ - + + + + + + diff --git a/Qrious/ContentView.swift b/Qrious/ContentView.swift index 87c7eb2..f884e7f 100644 --- a/Qrious/ContentView.swift +++ b/Qrious/ContentView.swift @@ -47,12 +47,15 @@ class FetchToDo: ObservableObject { } }.resume() } - func fetchAgain(q: String = "Hepatitis+B+Virus+Silico",p: String = "10",limit: Bool = false) { + func fetchAgain(q: String = "Hepatitis+B+Virus+Silico",p: String = "10",limit: Bool = false, prepints: Bool = false) { var s = "https://api.figshare.com/v2/articles/search?search_for=\(q.replacingOccurrences(of: " ", with: "+"))&page_size=\(p)" //var request = URLRequest(url: URL(string: "https://api.figshare.com/v2/articles/search?search_for=\(q)&page_size=\(p)")!) if limit { s += "&group=13668" } + if prepints { + s += "&item_type=12" + } print(s, limit) var request = URLRequest(url: URL(string: s)!) request.httpMethod = "POST" @@ -114,6 +117,7 @@ struct ContentView: View { @State private var ques: String = configuration().question //"Results show what top compounds?" @State public var LimitToChemrxiv: Bool = false + @State private var LimitToPreprints: Bool = false @ObservedObject var fetch = FetchToDo() //let bert = BERTQAFP16() var body: some View { @@ -150,6 +154,11 @@ struct ContentView: View { Text("Limit to ChemRxiv") } } + HStack{ + Toggle(isOn: $LimitToPreprints){ + Text("Limit to Preprints") + } + } } } @@ -160,7 +169,7 @@ struct ContentView: View { Section{ - Button(action: {self.fetch.fetchAgain(q: self.query, p: String(self.noOfArticles), limit: self.LimitToChemrxiv)}){ + Button(action: {self.fetch.fetchAgain(q: self.query, p: String(self.noOfArticles), limit: self.LimitToChemrxiv, prepints: self.LimitToPreprints)}){ Text("Get Papers") } } -- cgit v1.2.3