Skip to content

Commit

Permalink
Issue khcrysalis#113 replace the spinning indicator to percentage ind…
Browse files Browse the repository at this point in the history
…icator
  • Loading branch information
ibharathkumarp committed Oct 9, 2024
1 parent c7e8924 commit c18a067
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions iOS/Views/Sources/RepoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct RepoViewController: View {
@State private var debounceWorkItem: DispatchWorkItem?
@State private var isVerifying: Bool = false
@State private var isSyncing: Bool = false
@State private var progress: Float = 0.0
@State var sources: [Source]?

private var footerText: String {
Expand Down Expand Up @@ -88,8 +89,14 @@ struct RepoViewController: View {
}
ToolbarItem(placement: .navigationBarTrailing) {
if isVerifying || isSyncing {
ProgressView()
.progressViewStyle(CircularProgressViewStyle())
ZStack {
ProgressView()
Text("\(Int((isVerifying ? progress : 0) * 100))%")
.foregroundColor(.secondary)
.font(.system(size: 12))
.multilineTextAlignment(.center)
}
.frame(width: 40, height: 40)
} else if validationStatus == .validJSON {
Button(String.localized("ADD")) {
CoreDataManager.shared.getSourceData(urlString: repoName) { error in
Expand All @@ -108,6 +115,7 @@ struct RepoViewController: View {
}
}


extension RepoViewController {
private func debounceRequest() {
isVerifying = true
Expand Down

0 comments on commit c18a067

Please sign in to comment.