@ -65,60 +65,68 @@ struct ContentView<T : AbstractTimer>: View {
var body : some View {
let columns : [ GridItem ] = self . _columns ( )
let timers : [ AbstractTimer ] = Array ( self . timers )
GeometryReader { reader in
let width : CGFloat = reader . size . width / CGFloat ( columns . count ) - 15.0
VStack {
Group {
if timers . count > 0 {
ScrollView {
GeometryReader { reader in
let width : CGFloat = reader . size . width / CGFloat ( columns . count ) - 15.0
LazyVGrid (
columns : columns ,
spacing : itemSpacing
) {
VStack {
ScrollView {
LazyVGrid (
columns : columns ,
spacing : itemSpacing
) {
ReorderableForEach ( items : timers ) { timer in
DialView ( timer : timer , isEditingBinding : self . $ isEditing , frameSize : width , handler : { id in
self . _handleSiriTips ( timerId : id )
} )
. environment ( \ . managedObjectContext , viewContext )
. environmentObject ( Conductor . maestro )
. environmentObject ( boringContext )
} moveAction : { from , to in
self . _reorder ( from : from , to : to )
}
}
} . padding ( . horizontal , itemSpacing )
// i f ! s e l f . t i p s S h o w n , l e t t i p = P r e f e r e n c e s . t i p T o S h o w {
// T i p V i e w ( t i p : t i p ) {
// s e l f . _ h i d e T i p ( t i p )
// } . p a d d i n g ( )
// }
ReorderableForEach ( items : Array ( self . timers ) ) { timer in
Spacer ( )
SiriTipView ( intent : StartTimerIntent ( ) , isVisible : self . $ siriTipShown )
. siriTipViewStyle ( SiriTipViewStyle . dark ) . padding ( )
if ! conductor . liveTimers . isEmpty {
HStack ( alignment : . center ) {
VolumeView ( ) . padding ( 12.0 )
} . frame ( width : 300.0 , height : 40.0 )
. background ( Color ( white : 0.9 ) )
. cornerRadius ( 16.0 )
DialView ( timer : timer , isEditingBinding : self . $ isEditing , frameSize : width , handler : { id in
self . _handleSiriTips ( timerId : id )
} )
LiveTimerListView ( )
. environment ( \ . managedObjectContext , viewContext )
. environmentObject ( Conductor . maestro )
. environmentObject ( boringContext )
} moveAction : { from , to in
self . _reorder ( from : from , to : to )
. environmentObject ( conductor )
. foregroundColor ( . white )
. background ( Color ( white : 0.1 ) )
. cornerRadius ( 32.0 , corners : [ . topRight , . topLeft ] )
}
}
} . padding ( . horizontal , itemSpacing )
// i f ! s e l f . t i p s S h o w n , l e t t i p = P r e f e r e n c e s . t i p T o S h o w {
// T i p V i e w ( t i p : t i p ) {
// s e l f . _ h i d e T i p ( t i p )
// } . p a d d i n g ( )
// }
Spacer ( )
SiriTipView ( intent : StartTimerIntent ( ) , isVisible : self . $ siriTipShown )
. siriTipViewStyle ( SiriTipViewStyle . dark ) . padding ( )
if ! conductor . liveTimers . isEmpty {
HStack ( alignment : . center ) {
VolumeView ( ) . padding ( 12.0 )
} . frame ( width : 300.0 , height : 40.0 )
. background ( Color ( white : 0.9 ) )
. cornerRadius ( 16.0 )
LiveTimerListView ( )
. environment ( \ . managedObjectContext , viewContext )
. environmentObject ( conductor )
. foregroundColor ( . white )
. background ( Color ( white : 0.1 ) )
. cornerRadius ( 32.0 , corners : [ . topRight , . topLeft ] )
}
} else {
Text ( " You'll find your timers here. Start by creating them on the left screen " )
}
}
. navigationTitle ( " Home " )
@ -133,15 +141,6 @@ struct ContentView<T : AbstractTimer>: View {
// . e n v i r o n m e n t ( \ . m a n a g e d O b j e c t C o n t e x t , v i e w C o n t e x t )
} )
. toolbar {
// T o o l b a r I t e m ( p l a c e m e n t : . n a v i g a t i o n B a r T r a i l i n g ) {
// B u t t o n {
// s e l f . b o r i n g C o n t e x t . i s S h o w i n g N e w D a t a = t r u e
// } l a b e l : {
// H S t a c k {
// I m a g e ( s y s t e m N a m e : " p l u s " )
// }
// }
// }
ToolbarItem ( placement : . navigationBarTrailing ) {
Button {
withAnimation {
@ -154,7 +153,6 @@ struct ContentView<T : AbstractTimer>: View {
}
. onAppear {
self . _askPermissions ( )
// s e l f . s h o w L i v e T i m e r s S h e e t = ! c o n d u c t o r . l i v e T i m e r s . i s E m p t y
}
. onOpenURL { url in
self . _performActionIfPossible ( url : url )