-
Notifications
You must be signed in to change notification settings - Fork 0
/
HistoryView.swift
62 lines (58 loc) · 2.12 KB
/
HistoryView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// HistoryView.swift
// HyperClient (iOS)
//
// Created by Niko Ma on 4/16/22.
//
import SwiftUI
struct HistoryView: View {
@State var dataPair: ResponsePair
var body: some View {
List {
Group {
Section("实验名称") {
Text(dataPair.data.name)
}
Section("实验时间") {
Text(dataPair.data.experiment_time.toDate)
}
Section("作者") {
Text(dataPair.data.author)
}
Section("电子邮件") {
Text(dataPair.data.email)
}
Section("机构") {
Text(dataPair.data.institution)
}
Section("实验环境") {
Text(dataPair.data.environment)
}
Section("实验参数") {
Text(dataPair.data.parameters)
}
Section("详细信息") {
Text(dataPair.data.details)
}
Section("附件") {
ForEach(dataPair.data.attachment.components(separatedBy: " "), id: \.self) { str in
Text(str).onTapGesture {
UIApplication.shared.open(URL(string: str.trimmingCharacters(in: .whitespacesAndNewlines))!)
}.foregroundColor(.accentColor)
}
}
}
Group {
Section("数据哈希值") {
Text(dataPair.data.hash)
}
Section("数据验证结果") {
dataPair.authentication.result == true ? Image(systemName: "checkmark.circle").font(.system(size: 40)).foregroundColor(.green) : Image(systemName: "xmark.circle").font(.system(size: 40)).foregroundColor(.red)
}
Section("提交时间") {
Text(Date(timeIntervalSince1970: dataPair.data.timestamp).description(with: .current))
}
}
}
}
}