Skip to content

Commit f80b9af

Browse files
committed
display loading toast till preferences appears. Closes #274
1 parent 054871f commit f80b9af

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

Diff for: OpenGpxTracker/ViewController.swift

+20-5
Original file line numberDiff line numberDiff line change
@@ -977,13 +977,28 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
977977
///
978978
@objc func openPreferencesTableViewController() {
979979
print("openPreferencesTableViewController")
980-
let vc = PreferencesTableViewController(style: .grouped)
981-
vc.delegate = self
982-
let navController = UINavigationController(rootViewController: vc)
983-
self.present(navController, animated: true) { () -> Void in }
980+
981+
// Show loading toast
982+
Toast.showLoading("Loading Preferences...")
983+
984+
// Perform all operations on the main thread
985+
DispatchQueue.main.async {
986+
// Simulate a delay for testing (remove in production)
987+
//Thread.sleep(forTimeInterval: 4.5)
988+
989+
let vc = PreferencesTableViewController(style: .grouped)
990+
vc.delegate = self
991+
let navController = UINavigationController(rootViewController: vc)
992+
993+
// Hide the loading toast and present the view controller
994+
Toast.hideLoading()
995+
self.present(navController, animated: true)
996+
}
984997
}
985-
998+
999+
///
9861000
/// Opens an Activity View Controller to share the file
1001+
///
9871002
@objc func openShare() {
9881003
print("ViewController: Share Button tapped")
9891004

0 commit comments

Comments
 (0)