@@ -9,6 +9,7 @@ struct CodeiumView: View {
99 @Published var isSignedIn : Bool
1010 @Published var installationStatus : CodeiumInstallationManager . InstallationStatus
1111 @Published var installationStep : CodeiumInstallationManager . InstallationStep ?
12+ @AppStorage ( \. codeiumVerboseLog) var codeiumVerboseLog
1213
1314 init ( ) {
1415 isSignedIn = codeiumAuthService. isSignedIn
@@ -123,78 +124,86 @@ struct CodeiumView: View {
123124
124125 var body : some View {
125126 VStack ( alignment: . leading) {
126- switch viewModel. installationStatus {
127- case . notInstalled:
128- HStack {
129- Text ( " Language Server Version: Not Installed " )
130- installButton
131- }
132- case let . installed( version) :
133- HStack {
134- Text ( " Language Server Version: \( version) " )
135- uninstallButton
136- }
137- case let . outdated( current: current, latest: latest) :
138- HStack {
139- Text ( " Language Server Version: \( current) (Update Available: \( latest) ) " )
140- uninstallButton
141- updateButton
127+ VStack ( alignment: . leading) {
128+ switch viewModel. installationStatus {
129+ case . notInstalled:
130+ HStack {
131+ Text ( " Language Server Version: Not Installed " )
132+ installButton
133+ }
134+ case let . installed( version) :
135+ HStack {
136+ Text ( " Language Server Version: \( version) " )
137+ uninstallButton
138+ }
139+ case let . outdated( current: current, latest: latest) :
140+ HStack {
141+ Text ( " Language Server Version: \( current) (Update Available: \( latest) ) " )
142+ uninstallButton
143+ updateButton
144+ }
145+ case let . unsupported( current: current, latest: latest) :
146+ HStack {
147+ Text ( " Language Server Version: \( current) (Supported Version: \( latest) ) " )
148+ uninstallButton
149+ updateButton
150+ }
142151 }
143- case let . unsupported( current: current, latest: latest) :
144- HStack {
145- Text ( " Language Server Version: \( current) (Supported Version: \( latest) ) " )
146- uninstallButton
147- updateButton
152+
153+ if viewModel. isSignedIn {
154+ Text ( " Status: Signed In " )
155+
156+ Button ( action: {
157+ viewModel. isSignedIn = false
158+ } ) {
159+ Text ( " Sign Out " )
160+ }
161+
162+ Text (
163+ " The key is stored in the keychain. The helper app may request permission to access the key, please click \" Always Allow \" to grant this access. "
164+ )
165+ . lineLimit ( 5 )
166+ . fixedSize ( horizontal: false , vertical: true )
167+ . foregroundColor ( . secondary)
168+ } else {
169+ Text ( " Status: Not Signed In " )
170+
171+ Button ( action: {
172+ isSignInPanelPresented = true
173+ } ) {
174+ Text ( " Sign In " )
175+ }
148176 }
149177 }
150-
151- if viewModel. isSignedIn {
152- Text ( " Status: Signed In " )
153-
154- Button ( action: {
155- viewModel. isSignedIn = false
156- } ) {
157- Text ( " Sign Out " )
158- }
159-
160- Text (
161- " The key is stored in the keychain. The helper app may request permission to access the key, please click \" Always Allow \" to grant this access. "
162- )
163- . lineLimit ( 5 )
164- . fixedSize ( horizontal: false , vertical: true )
165- . foregroundColor ( . secondary)
166- } else {
167- Text ( " Status: Not Signed In " )
168-
169- Button ( action: {
170- isSignInPanelPresented = true
171- } ) {
172- Text ( " Sign In " )
173- }
178+ . padding ( 8 )
179+ . frame ( maxWidth: . infinity, alignment: . leading)
180+ . overlay {
181+ RoundedRectangle ( cornerRadius: 8 )
182+ . stroke ( Color ( nsColor: . separatorColor) , style: . init( lineWidth: 1 ) )
174183 }
175- }
176- . padding ( 8 )
177- . frame ( maxWidth: . infinity, alignment: . leading)
178- . overlay {
179- RoundedRectangle ( cornerRadius: 8 )
180- . stroke ( Color ( nsColor: . separatorColor) , style: . init( lineWidth: 1 ) )
181- }
182- . sheet ( isPresented: $isSignInPanelPresented) {
183- CodeiumSignInView ( viewModel: viewModel, isPresented: $isSignInPanelPresented)
184- }
185- . onChange ( of: viewModel. installationStep) { newValue in
186- if let step = newValue {
187- switch step {
188- case . downloading:
189- toast ( Text ( " Downloading.. " ) , . info)
190- case . uninstalling:
191- toast ( Text ( " Uninstalling old version.. " ) , . info)
192- case . decompressing:
193- toast ( Text ( " Decompressing.. " ) , . info)
194- case . done:
195- toast ( Text ( " Done! " ) , . info)
184+ . sheet ( isPresented: $isSignInPanelPresented) {
185+ CodeiumSignInView ( viewModel: viewModel, isPresented: $isSignInPanelPresented)
186+ }
187+ . onChange ( of: viewModel. installationStep) { newValue in
188+ if let step = newValue {
189+ switch step {
190+ case . downloading:
191+ toast ( Text ( " Downloading.. " ) , . info)
192+ case . uninstalling:
193+ toast ( Text ( " Uninstalling old version.. " ) , . info)
194+ case . decompressing:
195+ toast ( Text ( " Decompressing.. " ) , . info)
196+ case . done:
197+ toast ( Text ( " Done! " ) , . info)
198+ }
196199 }
197200 }
201+
202+ Divider ( )
203+
204+ Form {
205+ Toggle ( " Verbose Log " , isOn: $viewModel. codeiumVerboseLog)
206+ }
198207 }
199208 }
200209}
0 commit comments