@@ -45,40 +45,14 @@ class Application {
4545
4646 static var dataBus : DataBus !
4747 static var updater = SUUpdater ( for: Bundle . main) !
48- static func newState ( _ state: ApplicationState ) { }
4948
50- static var supportPath : URL {
51- //Create App directory if not exists:
52- let fileManager = FileManager ( )
53- let urlPaths = fileManager. urls ( for: . applicationSupportDirectory, in: . userDomainMask)
54-
55- let appDirectory = urlPaths. first!. appendingPathComponent ( Bundle . main. bundleIdentifier! , isDirectory: true )
56- var objCTrue : ObjCBool = true
57- let path = appDirectory. path
58- if !fileManager. fileExists ( atPath: path, isDirectory: & objCTrue) {
59- try ! fileManager. createDirectory ( atPath: path, withIntermediateDirectories: true , attributes: nil )
60- }
61- return appDirectory
62- }
63-
64- static private let dispatchActionQueue = DispatchQueue ( label: " dispatchActionQueue " , qos: . userInitiated)
65- // Custom dispatch function. Need to execute all dispatches on the main thread
66- static func dispatchAction( _ action: Action , onMainThread: Bool = true ) {
67- if ( onMainThread) {
68- DispatchQueue . main. async {
69- store. dispatch ( action)
70- }
71- } else {
72- dispatchActionQueue. async {
73- store. dispatch ( action)
74- }
75- }
76- }
7749 static let store : Store = Store ( reducer: ApplicationStateReducer, state: Storage [ . state] ?? ApplicationState ( ) , middleware: [ ] )
7850
7951
8052 static public func start ( ) {
81- setupSettings ( )
53+ self . settings = Settings ( )
54+ updater. automaticallyChecksForUpdates = true
55+
8256 Networking . startMonitor ( )
8357
8458 if ( !Constants. DEBUG) {
@@ -100,11 +74,6 @@ class Application {
10074 }
10175 }
10276
103- private static func setupSettings ( ) {
104- self . settings = Settings ( )
105- updater. automaticallyChecksForUpdates = true
106- }
107-
10877 private static func setupCrashReporting ( ) {
10978 // Create a Sentry client and start crash handler
11079 SentrySDK . start { options in
@@ -525,5 +494,35 @@ class Application {
525494 static var version : String {
526495 return Bundle . main. infoDictionary![ " CFBundleVersion " ] as! String
527496 }
497+
498+ static func newState ( _ state: ApplicationState ) { }
499+
500+ static var supportPath : URL {
501+ //Create App directory if not exists:
502+ let fileManager = FileManager ( )
503+ let urlPaths = fileManager. urls ( for: . applicationSupportDirectory, in: . userDomainMask)
504+
505+ let appDirectory = urlPaths. first!. appendingPathComponent ( Bundle . main. bundleIdentifier! , isDirectory: true )
506+ var objCTrue : ObjCBool = true
507+ let path = appDirectory. path
508+ if !fileManager. fileExists ( atPath: path, isDirectory: & objCTrue) {
509+ try ! fileManager. createDirectory ( atPath: path, withIntermediateDirectories: true , attributes: nil )
510+ }
511+ return appDirectory
512+ }
513+
514+ static private let dispatchActionQueue = DispatchQueue ( label: " dispatchActionQueue " , qos: . userInitiated)
515+ // Custom dispatch function. Need to execute all dispatches on the main thread
516+ static func dispatchAction( _ action: Action , onMainThread: Bool = true ) {
517+ if ( onMainThread) {
518+ DispatchQueue . main. async {
519+ store. dispatch ( action)
520+ }
521+ } else {
522+ dispatchActionQueue. async {
523+ store. dispatch ( action)
524+ }
525+ }
526+ }
528527}
529528
0 commit comments