USB-Meter / USB Meter / Views / DeviceHelpView.swift
Newer Older
60 lines | 2.008kb
Bogdan Timofte authored 2 weeks ago
1
//
2
//  BluetoothHelperView.swift
3
//  USB Meter
4
//
5
//  Created by Bogdan Timofte on 07/03/2020.
6
//  Copyright © 2020 Bogdan Timofte. All rights reserved.
7
//
8

            
9
import SwiftUI
10
import CoreBluetooth
11

            
12
struct DeviceHelpView: View {
13
    var body: some View {
Bogdan Timofte authored 2 weeks ago
14
        ScrollView {
15
            VStack(alignment: .leading, spacing: 14) {
16
                Text("Device Checklist")
17
                    .font(.system(.title3, design: .rounded).weight(.bold))
18
                    .frame(maxWidth: .infinity, alignment: .leading)
19
                    .padding(18)
20
                    .meterCard(tint: .orange, fillOpacity: 0.18, strokeOpacity: 0.24)
21

            
22
                helpCard(
23
                    title: "Power",
24
                    body: "Make sure the meter itself is powered on before trying to connect."
25
                )
26
                helpCard(
27
                    title: "Bluetooth",
28
                    body: "Confirm Bluetooth is enabled on the device and not disabled from the meter menu."
29
                )
30
                helpCard(
31
                    title: "Existing Connection",
32
                    body: "If the meter is already connected elsewhere, disconnect it first and then retry from the app."
33
                )
34
            }
35
            .padding()
36
        }
37
        .background(
38
            LinearGradient(
39
                colors: [.orange.opacity(0.14), Color.clear],
40
                startPoint: .topLeading,
41
                endPoint: .bottomTrailing
42
            )
43
            .ignoresSafeArea()
44
        )
45
        .navigationTitle("Device Help")
46
    }
47

            
48
    private func helpCard(title: String, body: String) -> some View {
49
        VStack(alignment: .leading, spacing: 6) {
50
            Text(title)
51
                .font(.headline)
52
            Text(body)
53
                .font(.footnote)
54
                .foregroundColor(.secondary)
Bogdan Timofte authored 2 weeks ago
55
        }
Bogdan Timofte authored 2 weeks ago
56
        .frame(maxWidth: .infinity, alignment: .leading)
57
        .padding(18)
58
        .meterCard(tint: .orange, fillOpacity: 0.14, strokeOpacity: 0.20)
Bogdan Timofte authored 2 weeks ago
59
    }
60
}