aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Qrious/Base.lproj/LaunchScreen.storyboard11
-rw-r--r--Qrious/ContentView.swift13
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 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gdb-a2-TI2">
- <rect key="frame" x="117" y="412" width="180" height="72"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gdb-a2-TI2">
+ <rect key="frame" x="50" y="144" width="314" height="618"/>
<attributedString key="attributedText">
<fragment content="Qrious">
<attributes>
@@ -30,6 +29,12 @@
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+ <constraints>
+ <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="gdb-a2-TI2" secondAttribute="bottom" constant="100" id="BCz-JW-oZR"/>
+ <constraint firstItem="gdb-a2-TI2" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="50" id="Jec-Zw-8Pf"/>
+ <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="gdb-a2-TI2" secondAttribute="trailing" constant="50" id="LSK-up-IEe"/>
+ <constraint firstItem="gdb-a2-TI2" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="100" id="O8W-TU-BvS"/>
+ </constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
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")
}
}