File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import GBVersionTracking
16
16
class AppDelegate : UIResponder , UIApplicationDelegate {
17
17
18
18
var window : UIWindow ?
19
+
20
+ var mainViewController : MainViewController ?
19
21
20
22
func application( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ UIApplicationLaunchOptionsKey : Any ] ? ) -> Bool {
21
23
// We need this for views to not be hidden under the keyboard
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ class MainViewController: UIViewController {
47
47
override func viewDidLoad( ) {
48
48
super. viewDidLoad ( )
49
49
50
+ ( UIApplication . shared. delegate as? AppDelegate ) ? . mainViewController = self
50
51
view. backgroundColor = . lightestBlackWhiteColor
51
52
}
52
53
Original file line number Diff line number Diff line change @@ -26,18 +26,18 @@ public class MessageQueue {
26
26
27
27
private var messageQueue = [ Message] ( )
28
28
private var queueTimer : Timer ?
29
- private var md : MessageDisplayer ? {
30
- return ( UIApplication . shared. delegate as? AppDelegate ) ? . window ? . rootViewController as? MessageDisplayer
29
+ private var messageDisplayer : MessageDisplayer ? {
30
+ return ( UIApplication . shared. delegate as? AppDelegate ) ? . mainViewController
31
31
}
32
32
33
33
public func append( _ message: Message ) {
34
34
messageQueue. append ( message)
35
35
36
36
if queueTimer == nil {
37
- md ? . messageQueueStarted ? ( )
37
+ messageDisplayer ? . messageQueueStarted ? ( )
38
38
39
39
queueTimer = Timer . scheduledTimer ( withTimeInterval: messageDisplayTime, repeats: true ) { ( timer) in
40
- if let md = self . md {
40
+ if let md = self . messageDisplayer {
41
41
42
42
if self . messageQueue. count == 0 {
43
43
self . queueTimer? . invalidate ( )
You can’t perform that action at this time.
0 commit comments