Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 11 | Rev 20 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 17
Línea 24... Línea 24...
24
    @EnvironmentObject private var appNavigation : AppNavigation
24
    @EnvironmentObject private var appNavigation : AppNavigation
Línea 25... Línea 25...
25
    
25
    
Línea 26... Línea 26...
26
    @State private var selectedTab : Int = 0
26
    @State private var selectedTab : Int = 0
27
 
-
 
28
 
27
 
29
    private let appDao = AppDao.sharedInstance
28
 
Línea 30... Línea -...
30
    private let slidePositionInitial : Int
-
 
31
    private var capsuleTitle : String = ""
29
    private var appData = AppData.sharedInstance
32
    private var viewModel : GalleryGridViewModel = GalleryGridViewModel()
-
 
33
    
-
 
Línea 34... Línea 30...
34
    
30
    private var capsuleTitle : String = ""
35
    
31
    private var viewModel : GalleryGridViewModel = GalleryGridViewModel()
36
   
-
 
37
    
-
 
38
    //init(capsuleUuid : String, position : Int)
-
 
39
    
32
    
Línea 40... Línea 33...
40
    init()
33
    
41
    {
34
  
Línea 57... Línea 50...
57
    
50
    
58
 
51
 
59
    var body: some View {
52
    var body: some View {
-
 
53
        GeometryReader { geometry in
60
        GeometryReader { geometry in
54
        ZStack {
61
        ZStack {
55
            /*
-
 
56
            if self.selectedTab > 0 {
-
 
57
                Button(action: {
-
 
58
                    appData.slideUuidActive = self.viewModel.slides[self.selectedTab - 1].uuid
62
            if self.selectedTab > 0 {
59
                    appData.save()
63
                Button(action: {
60
                    
64
                         self.selectedTab = self.selectedTab - 1
61
                    self.selectedTab = self.selectedTab - 1
65
                     }, label: {
62
                }, label: {
Línea 66... Línea 63...
66
                         Image(systemName: "arrow.left")
63
                    Image(systemName: "arrow.left")
67
                     })
64
                })
68
                
65
                
69
                .frame(width: 40.0, height: 40.0, alignment: .center)
66
                .frame(width: 40.0, height: 40.0, alignment: .center)
70
                     .cornerRadius(/*@START_MENU_TOKEN@*/3.0/*@END_MENU_TOKEN@*/)
67
                     .cornerRadius(/*@START_MENU_TOKEN@*/3.0/*@END_MENU_TOKEN@*/)
71
                .background(Color("color_button_gallery_background"))
68
                .background(Color("color_button_gallery_background"))
Línea 72... Línea 69...
72
                .foregroundColor(Color("color_button_gallery_foreground"))
69
                .foregroundColor(Color("color_button_gallery_foreground"))
73
                    .offset(x: -1 * ((geometry.size.width / 2) - 30), y :  25).zIndex(10000)
70
                    .offset(x: -1 * ((geometry.size.width / 2) - 30), y :  25).zIndex(10000)
-
 
71
            }
-
 
72
            
-
 
73
            if self.selectedTab < (self.viewModel.slides.count - 1) {
74
            }
74
                Button(action: {
75
            
75
                    appData.slideUuidActive = self.viewModel.slides[self.selectedTab + 1].uuid
76
            if self.selectedTab < (self.viewModel.slides.count - 1) {
76
                    appData.save()
77
                Button(action: {
77
                    
78
                         self.selectedTab = self.selectedTab + 1
78
                    self.selectedTab = self.selectedTab + 1
79
                     }, label: {
79
                }, label: {
80
                         Image(systemName: "arrow.right")
80
                    Image(systemName: "arrow.right")
81
                     })
81
                })
82
                .frame(width: 40.0, height: 40.0, alignment: .center)
82
                .frame(width: 40.0, height: 40.0, alignment: .center)
Línea 83... Línea 83...
83
                .background(Color("color_button_gallery_background"))
83
                .background(Color("color_button_gallery_background"))
84
                .foregroundColor(Color("color_button_gallery_foreground"))
84
                .foregroundColor(Color("color_button_gallery_foreground"))
85
                .offset(x: ((geometry.size.width  / 2) - 30), y :  25).zIndex(10000)
85
                .offset(x: ((geometry.size.width  / 2) - 30), y :  25).zIndex(10000)
86
            }
-
 
87
            
86
            }*/
88
            VStack(spacing: 0) {
-
 
89
                HStack {
-
 
90
                    Button(action: {
87
            
Línea 91... Línea 88...
91
                        var appData = appDao.selectOne()
88
            VStack(spacing: 0) {
Línea 92... Línea 89...
92
                        appData.slideUuidActive = ""
89
                HStack {
Línea 131... Línea 128...
131
                        .tag(index)
128
                        .tag(index)
132
                        .transition(.slide)
129
                        .transition(.slide)
Línea 133... Línea 130...
133
                            
130
                            
134
                    }
131
                    }
135
                }
132
                }
136
                //.tabViewStyle(PageTabViewStyle())
133
                .tabViewStyle(PageTabViewStyle(indexDisplayMode: .automatic))
Línea 137... Línea 134...
137
                .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
134
                //.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
-
 
135
 
-
 
136
                .onChange(of: self.selectedTab) { selectedTab in
-
 
137
                    appData.slideUuidActive = self.viewModel.slides[selectedTab].uuid
138
 
138
                    appData.save()
139
                .onChange(of: self.selectedTab) { selectedTab in
139
                    
-
 
140
                    completeSlide(position: self.selectedTab)
-
 
141
                }.onAppear {
-
 
142
 
-
 
143
                    var position : Int = 0
-
 
144
                    var i : Int = 0
-
 
145
                    while i < self.viewModel.slides.count {
-
 
146
                        if appData.slideUuidActive == self.viewModel.slides[i].uuid {
-
 
147
                            position = i
-
 
148
                        }
-
 
149
                        i += 1
140
                    completeSlide(position: self.selectedTab)
150
                    }
141
                }.onAppear {
151
                    
142
                    self.selectedTab =  self.slidePositionInitial
152
                    self.selectedTab =  position
Línea 143... Línea 153...
143
                    completeSlide(position: self.selectedTab)
153
                    completeSlide(position: self.selectedTab)