Skip to content

Commit 9711416

Browse files
committed
Add integrations view
1 parent dbfc151 commit 9711416

File tree

2 files changed

+94
-1
lines changed

2 files changed

+94
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import InlineKit
2+
import SwiftUI
3+
4+
struct IntegrationsView: View {
5+
var body: some View {
6+
List {
7+
HStack(alignment: .center) {
8+
Image("linear-icon")
9+
.resizable()
10+
.frame(width: 55, height: 55)
11+
.clipShape(RoundedRectangle(cornerRadius: 18))
12+
.padding(.trailing, 6)
13+
VStack(alignment: .leading) {
14+
Text("Linear")
15+
.fontWeight(.semibold)
16+
Text("Connect your Linear to create issues from messages with AI")
17+
.foregroundColor(.secondary)
18+
.font(.caption)
19+
}
20+
Spacer()
21+
Button("Connect") {
22+
// TODO: Implement Linear integration
23+
}
24+
.buttonStyle(.borderless)
25+
}
26+
}
27+
// .listStyle(.plain)
28+
.navigationBarTitleDisplayMode(.inline)
29+
.toolbarRole(.editor)
30+
.toolbar {
31+
ToolbarItem(id: "integrations", placement: .principal) {
32+
HStack {
33+
Image(systemName: "app.connected.to.app.below.fill")
34+
.foregroundColor(.secondary)
35+
.font(.callout)
36+
.padding(.trailing, 4)
37+
VStack(alignment: .leading) {
38+
Text("Integrations")
39+
.font(.body)
40+
.fontWeight(.semibold)
41+
}
42+
}
43+
}
44+
}
45+
}
46+
}

apple/InlineIOS/Settings/Settings.swift

+48-1
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,51 @@ import InlineKit
33
import SwiftUI
44

55
struct SettingsView: View {
6-
@Query(CurrentUser()) var currentUser: User?
6+
@Query(CurrentUser()) var currentUser: UserInfo?
77
@Environment(\.auth) var auth
88
@EnvironmentObject private var webSocket: WebSocketManager
99
@EnvironmentObject private var navigation: Navigation
1010
@EnvironmentObject private var onboardingNavigation: OnboardingNavigation
1111
@EnvironmentObject private var mainRouter: MainViewRouter
12+
@EnvironmentObject private var fileUploadViewModel: FileUploadViewModel
1213

1314
var body: some View {
1415
List {
1516
UserProfileSection(currentUser: currentUser)
17+
Section {
18+
Button {
19+
fileUploadViewModel.showImagePicker = true
20+
} label: {
21+
HStack {
22+
Image(systemName: "camera.fill")
23+
.font(.callout)
24+
.foregroundColor(.white)
25+
.frame(width: 25, height: 25)
26+
.background(Color.pink)
27+
.clipShape(RoundedRectangle(cornerRadius: 6))
28+
Text("Change Profile Photo")
29+
.foregroundColor(.primary)
30+
.padding(.leading, 4)
31+
Spacer()
32+
}
33+
.padding(.vertical, 2)
34+
}
35+
}
36+
37+
NavigationLink(destination: IntegrationsView()) {
38+
HStack {
39+
Image(systemName: "app.connected.to.app.below.fill")
40+
.foregroundColor(.white)
41+
.frame(width: 25, height: 25)
42+
.background(Color.purple)
43+
.clipShape(RoundedRectangle(cornerRadius: 6))
44+
Text("Integrations")
45+
.foregroundColor(.primary)
46+
.padding(.leading, 4)
47+
Spacer()
48+
}
49+
.padding(.vertical, 2)
50+
}
1651
NavigationLink(destination: ThemeSection()) {
1752
HStack {
1853
Image(systemName: "paintbrush.fill")
@@ -27,6 +62,7 @@ struct SettingsView: View {
2762
}
2863
.padding(.vertical, 2)
2964
}
65+
3066
LogoutSection()
3167
}
3268
.navigationBarTitleDisplayMode(.inline)
@@ -46,6 +82,17 @@ struct SettingsView: View {
4682
}
4783
}
4884
}
85+
.sheet(isPresented: $fileUploadViewModel.showImagePicker) {
86+
ImagePicker(sourceType: .photoLibrary) { image in
87+
Task {
88+
if let pngData = image.pngData() {
89+
await fileUploadViewModel.uploadImage(pngData, fileType: .png)
90+
} else if let jpegData = image.jpegData(compressionQuality: 0.8) {
91+
await fileUploadViewModel.uploadImage(jpegData, fileType: .jpeg)
92+
}
93+
}
94+
}
95+
}
4996
}
5097
}
5198

0 commit comments

Comments
 (0)