Added Launch-screen and Preprints filter

This commit is contained in:
Navan Chauhan 2020-07-24 17:43:41 +05:30
parent 408cf562a3
commit e080c46fa5
2 changed files with 19 additions and 5 deletions

View File

@ -15,9 +15,8 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <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"> <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="117" y="412" width="180" height="72"/> <rect key="frame" x="50" y="144" width="314" height="618"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<attributedString key="attributedText"> <attributedString key="attributedText">
<fragment content="Qrious"> <fragment content="Qrious">
<attributes> <attributes>
@ -30,6 +29,12 @@
</label> </label>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <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"/> <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view> </view>
</viewController> </viewController>

View File

@ -47,12 +47,15 @@ class FetchToDo: ObservableObject {
} }
}.resume() }.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 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)")!) //var request = URLRequest(url: URL(string: "https://api.figshare.com/v2/articles/search?search_for=\(q)&page_size=\(p)")!)
if limit { if limit {
s += "&group=13668" s += "&group=13668"
} }
if prepints {
s += "&item_type=12"
}
print(s, limit) print(s, limit)
var request = URLRequest(url: URL(string: s)!) var request = URLRequest(url: URL(string: s)!)
request.httpMethod = "POST" request.httpMethod = "POST"
@ -114,6 +117,7 @@ struct ContentView: View {
@State private var ques: String = configuration().question @State private var ques: String = configuration().question
//"Results show what top compounds?" //"Results show what top compounds?"
@State public var LimitToChemrxiv: Bool = false @State public var LimitToChemrxiv: Bool = false
@State private var LimitToPreprints: Bool = false
@ObservedObject var fetch = FetchToDo() @ObservedObject var fetch = FetchToDo()
//let bert = BERTQAFP16() //let bert = BERTQAFP16()
var body: some View { var body: some View {
@ -150,6 +154,11 @@ struct ContentView: View {
Text("Limit to ChemRxiv") Text("Limit to ChemRxiv")
} }
} }
HStack{
Toggle(isOn: $LimitToPreprints){
Text("Limit to Preprints")
}
}
} }
} }
@ -160,7 +169,7 @@ struct ContentView: View {
Section{ 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") Text("Get Papers")
} }
} }