comparison LazyBear/Views/Profile/ProfileView.swift @ 408:f9611c94d636

Fixes #45
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 06 Jun 2021 17:39:22 +0200
parents fd8df65927e9
children e24c9ca71824
comparison
equal deleted inserted replaced
407:c804ce7a1560 408:f9611c94d636
39 .onAppear { // Refresh API requested companies when Core Data changes 39 .onAppear { // Refresh API requested companies when Core Data changes
40 refreshList() 40 refreshList()
41 } 41 }
42 } 42 }
43 .onAppear { self.timer = Timer.publish(every: 10, on: .main, in: .common).autoconnect() } // Start timer 43 .onAppear { self.timer = Timer.publish(every: 10, on: .main, in: .common).autoconnect() } // Start timer
44 .onReceive(timer) { _ in prepareUrl(.streaming) }
45 .onDisappear { self.timer.upstream.connect().cancel() } // Stop timer 44 .onDisappear { self.timer.upstream.connect().cancel() } // Stop timer
45 .onReceive(timer) { _ in
46 if !showCreateNewWatchlist {
47 prepareUrl(.streaming)
48 }
49 }
46 .navigationTitle("My profile") 50 .navigationTitle("My profile")
47 .navigationBarTitleDisplayMode(.inline) 51 .navigationBarTitleDisplayMode(.inline)
48 .toolbar { 52 .toolbar {
49 ToolbarItem(placement: .navigationBarTrailing) { 53 ToolbarItem(placement: .navigationBarTrailing) {
50 Button(action: { showCreateNewWatchlist = true }) { 54 Button(action: { showCreateNewWatchlist = true }) {
57 WatchlistCreator() 61 WatchlistCreator()
58 .environment(\.managedObjectContext, self.moc) 62 .environment(\.managedObjectContext, self.moc)
59 } 63 }
60 } else { 64 } else {
61 ProgressView() 65 ProgressView()
62 .onAppear { prepareUrl(.initial) } 66 .onAppear {
67 print("Appeared")
68 prepareUrl(.initial) }
63 } 69 }
64 } 70 }
65 71
66 /* 72 /*
67 Get symbols in watchlists -> Prepare url -> Request 73 Get symbols in watchlists -> Prepare url -> Request