Commit 3600f6c7876345991aaeb5d4694ebd7b9e1d2877
1 parent
6afba472
--no commit message
Showing
18 changed files
with
1046 additions
and
84 deletions
DUREX Vendor Control/Base.lproj/Localizable.strings
... | ... | @@ -74,11 +74,16 @@ |
74 | 74 | "50c Coins" = "50c Coins"; |
75 | 75 | "Channel" = "Channel"; |
76 | 76 | "Product Code" = "Product Code"; |
77 | -"Normal Price" = "Normal Price"; | |
77 | +"Product Price" = "Product Price"; | |
78 | 78 | "Discounted Price" = "Discounted Price"; |
79 | 79 | "1€ Change" = "1€ Change"; |
80 | 80 | "50c Change" = "50c Change"; |
81 | 81 | "Money Paid" = "Money Paid"; |
82 | 82 | "Update Date & Time" = "Update Date & Time"; |
83 | 83 | "Update product price" = "Update product price"; |
84 | -"Update product name" = "Update product name"; | |
85 | 84 | \ No newline at end of file |
85 | +"Update product name" = "Update product name"; | |
86 | +"Sale on" = "Sale on"; | |
87 | +"Report sent successfully" = "Report sent successfully"; | |
88 | +"Success!" = "Success!"; | |
89 | +"Connection to server failed" = "Connection to server failed"; | |
90 | +"Error" = "Error"; | |
86 | 91 | \ No newline at end of file | ... | ... |
DUREX Vendor Control/CommunicationProtocol.h
... | ... | @@ -13,11 +13,12 @@ |
13 | 13 | #define MAX_RETRIES ((int)3) |
14 | 14 | #define MAX_PRODUCT_NAME_LENGTH ((int)64) |
15 | 15 | #define MAX_CHANNELS ((int)16) |
16 | -#define MONEY_IN_NUM_UNITS ((int)5) | |
17 | -#define MONEY_OUT_NUM_UNITS ((int)3) | |
18 | -#define CHANGE_NUM_UNITS ((int)2) | |
16 | +#define MONEY_IN_NUM_UNITS ((int)6) | |
17 | +#define MONEY_OUT_NUM_UNITS ((int)3) | |
18 | +#define CHANGE_NUM_UNITS ((int)2) | |
19 | 19 | #define MAX_PRODUCTS ((int)16) |
20 | 20 | #define SALE_STRING_LENGTH ((int)36) |
21 | +#define REPORT_SERVER_URL @"http://seneca.upc.es:8090/machine" | |
21 | 22 | |
22 | 23 | @interface CommunicationProtocol : NSObject |
23 | 24 | ... | ... |
DUREX Vendor Control/CommunicationProtocol.m
... | ... | @@ -360,7 +360,7 @@ |
360 | 360 | //NSString *answer = [self readMessage]; |
361 | 361 | |
362 | 362 | NSMutableString *answer = [[NSMutableString alloc]initWithString:@"P400255002550025510"]; |
363 | - for(int i = 0; i < 15; i++) | |
363 | + for(int i = 0; i < 18; i++) | |
364 | 364 | { |
365 | 365 | [answer appendString:@"0"]; |
366 | 366 | } |
... | ... | @@ -377,6 +377,7 @@ |
377 | 377 | |
378 | 378 | if([answer length] > 1 && [[answer substringToIndex:2]isEqualToString:@"P4"]) |
379 | 379 | { |
380 | + NSLog(@"[CommunicationProtocol.m]: sensorStatus returned: %@",answer); | |
380 | 381 | return answer; |
381 | 382 | } |
382 | 383 | return nil; |
... | ... | @@ -415,10 +416,11 @@ |
415 | 416 | [self writeMessage:command]; |
416 | 417 | //NSString *answer = [self readMessage]; |
417 | 418 | |
418 | - NSMutableString *answer = [[NSMutableString alloc]initWithString:@"P21405141651102416090662045001500512P21406141651102416090662045001500512P2P2"]; | |
419 | - | |
419 | + /*NSMutableString *answer = [[NSMutableString alloc]initWithString:@"P21405141651010000000000620850050101P21407225404000002000100621050000001P2P2"];*/ | |
420 | + NSMutableString *answer = [[NSMutableString alloc]initWithString:@"P21408161036000001000000110450000001P21409012216000100000000220900000100P21409032307000000010502330800000000P21409070540000000020000440350000001P2P2"]; | |
420 | 421 | if([answer length] > 1 && [[answer substringToIndex:2]isEqualToString:@"P2"]) |
421 | 422 | { |
423 | + NSLog(@"[CommunicationProtocol.m]: saleLog returned: %@",answer); | |
422 | 424 | return answer; |
423 | 425 | } |
424 | 426 | return nil; | ... | ... |
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.pbxproj
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | F989B60219BCE28C00657DD9 /* SalesLog.m in Sources */ = {isa = PBXBuildFile; fileRef = F989B60119BCE28C00657DD9 /* SalesLog.m */; }; |
43 | 43 | F9A8EF7C192FE201009E7532 /* Stack.m in Sources */ = {isa = PBXBuildFile; fileRef = F9A8EF7B192FE201009E7532 /* Stack.m */; }; |
44 | 44 | F9C77F50192CDE30002DBE8A /* system.json in Resources */ = {isa = PBXBuildFile; fileRef = F9C77F4F192CDE30002DBE8A /* system.json */; }; |
45 | + F9CED59A19BE086E008F3764 /* UIView+Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = F9CED59919BE086E008F3764 /* UIView+Toast.m */; }; | |
45 | 46 | F9E4D8FD19B8FD32009A7359 /* EMConnectingView_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9E4D8FF19B8FD32009A7359 /* EMConnectingView_iPad.xib */; }; |
46 | 47 | /* End PBXBuildFile section */ |
47 | 48 | |
... | ... | @@ -131,6 +132,8 @@ |
131 | 132 | F9A8EF7A192FE201009E7532 /* Stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stack.h; sourceTree = SOURCE_ROOT; }; |
132 | 133 | F9A8EF7B192FE201009E7532 /* Stack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Stack.m; sourceTree = SOURCE_ROOT; }; |
133 | 134 | F9C77F4F192CDE30002DBE8A /* system.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = system.json; sourceTree = SOURCE_ROOT; }; |
135 | + F9CED59819BE086E008F3764 /* UIView+Toast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Toast.h"; sourceTree = SOURCE_ROOT; }; | |
136 | + F9CED59919BE086E008F3764 /* UIView+Toast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Toast.m"; sourceTree = SOURCE_ROOT; }; | |
134 | 137 | F9E4D8FE19B8FD32009A7359 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/EMConnectingView_iPad.xib; sourceTree = "<group>"; }; |
135 | 138 | F9E4D90119B8FD36009A7359 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/EMConnectingView_iPad.strings; sourceTree = "<group>"; }; |
136 | 139 | F9E4D90319B8FD37009A7359 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/EMConnectingView_iPad.strings; sourceTree = "<group>"; }; |
... | ... | @@ -184,6 +187,7 @@ |
184 | 187 | 3471866618070D9300FA0FB2 /* DUREX Vendor Control */ = { |
185 | 188 | isa = PBXGroup; |
186 | 189 | children = ( |
190 | + F9CED59719BE0863008F3764 /* Toast View */, | |
187 | 191 | 3471868F18070E4300FA0FB2 /* Framework */, |
188 | 192 | 347186A718070F7F00FA0FB2 /* Device Picker */, |
189 | 193 | 347186B91807290E00FA0FB2 /* Schemas */, |
... | ... | @@ -268,6 +272,15 @@ |
268 | 272 | name = Schemas; |
269 | 273 | sourceTree = "<group>"; |
270 | 274 | }; |
275 | + F9CED59719BE0863008F3764 /* Toast View */ = { | |
276 | + isa = PBXGroup; | |
277 | + children = ( | |
278 | + F9CED59819BE086E008F3764 /* UIView+Toast.h */, | |
279 | + F9CED59919BE086E008F3764 /* UIView+Toast.m */, | |
280 | + ); | |
281 | + name = "Toast View"; | |
282 | + sourceTree = "<group>"; | |
283 | + }; | |
271 | 284 | F9ED745419B89E4600C7298D /* Views */ = { |
272 | 285 | isa = PBXGroup; |
273 | 286 | children = ( |
... | ... | @@ -401,6 +414,7 @@ |
401 | 414 | F933F80419B6819400521B90 /* DatePickerViewController.m in Sources */, |
402 | 415 | F989B5FF19BCD7A100657DD9 /* Sale.m in Sources */, |
403 | 416 | F98356D6192E835F00EA6821 /* InitialViewController.m in Sources */, |
417 | + F9CED59A19BE086E008F3764 /* UIView+Toast.m in Sources */, | |
404 | 418 | F9A8EF7C192FE201009E7532 /* Stack.m in Sources */, |
405 | 419 | 34AAB885189804FF0019860D /* EMDevicePickerViewController.m in Sources */, |
406 | 420 | F989B60219BCE28C00657DD9 /* SalesLog.m in Sources */, | ... | ... |
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/project.xcworkspace/xcuserdata/imanol.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
DUREX Vendor Control/DUREX Vendor Control.xcodeproj/xcuserdata/imanol.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
... | ... | @@ -26,11 +26,11 @@ |
26 | 26 | ignoreCount = "0" |
27 | 27 | continueAfterRunningActions = "No" |
28 | 28 | filePath = "MenuTableViewController.m" |
29 | - timestampString = "431828056.269485" | |
29 | + timestampString = "431887175.109814" | |
30 | 30 | startingColumnNumber = "9223372036854775807" |
31 | 31 | endingColumnNumber = "9223372036854775807" |
32 | - startingLineNumber = "599" | |
33 | - endingLineNumber = "599" | |
32 | + startingLineNumber = "724" | |
33 | + endingLineNumber = "724" | |
34 | 34 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
35 | 35 | landmarkType = "5"> |
36 | 36 | </BreakpointContent> |
... | ... | @@ -42,11 +42,11 @@ |
42 | 42 | ignoreCount = "0" |
43 | 43 | continueAfterRunningActions = "No" |
44 | 44 | filePath = "MenuTableViewController.m" |
45 | - timestampString = "431828056.269485" | |
45 | + timestampString = "431887175.109814" | |
46 | 46 | startingColumnNumber = "9223372036854775807" |
47 | 47 | endingColumnNumber = "9223372036854775807" |
48 | - startingLineNumber = "541" | |
49 | - endingLineNumber = "541" | |
48 | + startingLineNumber = "666" | |
49 | + endingLineNumber = "666" | |
50 | 50 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
51 | 51 | landmarkType = "5"> |
52 | 52 | </BreakpointContent> |
... | ... | @@ -58,11 +58,11 @@ |
58 | 58 | ignoreCount = "0" |
59 | 59 | continueAfterRunningActions = "No" |
60 | 60 | filePath = "MenuTableViewController.m" |
61 | - timestampString = "431828056.269485" | |
61 | + timestampString = "431887175.109814" | |
62 | 62 | startingColumnNumber = "9223372036854775807" |
63 | 63 | endingColumnNumber = "9223372036854775807" |
64 | - startingLineNumber = "423" | |
65 | - endingLineNumber = "423" | |
64 | + startingLineNumber = "522" | |
65 | + endingLineNumber = "522" | |
66 | 66 | landmarkName = "-tableView:didSelectRowAtIndexPath:" |
67 | 67 | landmarkType = "5"> |
68 | 68 | </BreakpointContent> |
... | ... | @@ -122,11 +122,11 @@ |
122 | 122 | ignoreCount = "0" |
123 | 123 | continueAfterRunningActions = "No" |
124 | 124 | filePath = "MenuTableViewController.m" |
125 | - timestampString = "431828056.269485" | |
125 | + timestampString = "431887175.109814" | |
126 | 126 | startingColumnNumber = "9223372036854775807" |
127 | 127 | endingColumnNumber = "9223372036854775807" |
128 | - startingLineNumber = "458" | |
129 | - endingLineNumber = "458" | |
128 | + startingLineNumber = "559" | |
129 | + endingLineNumber = "559" | |
130 | 130 | landmarkName = "-tableView:didSelectRowAtIndexPath:" |
131 | 131 | landmarkType = "5"> |
132 | 132 | </BreakpointContent> |
... | ... | @@ -138,11 +138,11 @@ |
138 | 138 | ignoreCount = "0" |
139 | 139 | continueAfterRunningActions = "No" |
140 | 140 | filePath = "MenuTableViewController.m" |
141 | - timestampString = "431828056.269485" | |
141 | + timestampString = "431887175.109814" | |
142 | 142 | startingColumnNumber = "9223372036854775807" |
143 | 143 | endingColumnNumber = "9223372036854775807" |
144 | - startingLineNumber = "457" | |
145 | - endingLineNumber = "457" | |
144 | + startingLineNumber = "558" | |
145 | + endingLineNumber = "558" | |
146 | 146 | landmarkName = "-tableView:didSelectRowAtIndexPath:" |
147 | 147 | landmarkType = "5"> |
148 | 148 | </BreakpointContent> |
... | ... | @@ -182,7 +182,7 @@ |
182 | 182 | <BreakpointProxy |
183 | 183 | BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> |
184 | 184 | <BreakpointContent |
185 | - shouldBeEnabled = "Yes" | |
185 | + shouldBeEnabled = "No" | |
186 | 186 | ignoreCount = "0" |
187 | 187 | continueAfterRunningActions = "No" |
188 | 188 | filePath = "SalesLog.m" |
... | ... | @@ -198,11 +198,11 @@ |
198 | 198 | <BreakpointProxy |
199 | 199 | BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> |
200 | 200 | <BreakpointContent |
201 | - shouldBeEnabled = "Yes" | |
201 | + shouldBeEnabled = "No" | |
202 | 202 | ignoreCount = "0" |
203 | 203 | continueAfterRunningActions = "No" |
204 | 204 | filePath = "SalesLog.m" |
205 | - timestampString = "431826425.066356" | |
205 | + timestampString = "431872273.448636" | |
206 | 206 | startingColumnNumber = "9223372036854775807" |
207 | 207 | endingColumnNumber = "9223372036854775807" |
208 | 208 | startingLineNumber = "61" |
... | ... | @@ -218,11 +218,267 @@ |
218 | 218 | ignoreCount = "0" |
219 | 219 | continueAfterRunningActions = "No" |
220 | 220 | filePath = "MenuTableViewController.m" |
221 | - timestampString = "431828716.255822" | |
221 | + timestampString = "431887175.109814" | |
222 | + startingColumnNumber = "9223372036854775807" | |
223 | + endingColumnNumber = "9223372036854775807" | |
224 | + startingLineNumber = "775" | |
225 | + endingLineNumber = "775" | |
226 | + landmarkName = "-tableView:cellForRowAtIndexPath:" | |
227 | + landmarkType = "5"> | |
228 | + </BreakpointContent> | |
229 | + </BreakpointProxy> | |
230 | + <BreakpointProxy | |
231 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
232 | + <BreakpointContent | |
233 | + shouldBeEnabled = "No" | |
234 | + ignoreCount = "0" | |
235 | + continueAfterRunningActions = "No" | |
236 | + filePath = "CommunicationProtocol.m" | |
237 | + timestampString = "431854565.924087" | |
238 | + startingColumnNumber = "9223372036854775807" | |
239 | + endingColumnNumber = "9223372036854775807" | |
240 | + startingLineNumber = "210" | |
241 | + endingLineNumber = "210" | |
242 | + landmarkName = "-writeMessage:" | |
243 | + landmarkType = "5"> | |
244 | + </BreakpointContent> | |
245 | + </BreakpointProxy> | |
246 | + <BreakpointProxy | |
247 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
248 | + <BreakpointContent | |
249 | + shouldBeEnabled = "No" | |
250 | + ignoreCount = "0" | |
251 | + continueAfterRunningActions = "No" | |
252 | + filePath = "MenuTableViewController.m" | |
253 | + timestampString = "431867660.218473" | |
254 | + startingColumnNumber = "9223372036854775807" | |
255 | + endingColumnNumber = "9223372036854775807" | |
256 | + startingLineNumber = "91" | |
257 | + endingLineNumber = "91" | |
258 | + landmarkName = "-generateMaintenanceLevel" | |
259 | + landmarkType = "5"> | |
260 | + </BreakpointContent> | |
261 | + </BreakpointProxy> | |
262 | + <BreakpointProxy | |
263 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
264 | + <BreakpointContent | |
265 | + shouldBeEnabled = "No" | |
266 | + ignoreCount = "0" | |
267 | + continueAfterRunningActions = "No" | |
268 | + filePath = "MenuTableViewController.m" | |
269 | + timestampString = "431867660.218473" | |
270 | + startingColumnNumber = "9223372036854775807" | |
271 | + endingColumnNumber = "9223372036854775807" | |
272 | + startingLineNumber = "124" | |
273 | + endingLineNumber = "124" | |
274 | + landmarkName = "-generateSaleListNavLevel" | |
275 | + landmarkType = "5"> | |
276 | + </BreakpointContent> | |
277 | + </BreakpointProxy> | |
278 | + <BreakpointProxy | |
279 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
280 | + <BreakpointContent | |
281 | + shouldBeEnabled = "No" | |
282 | + ignoreCount = "0" | |
283 | + continueAfterRunningActions = "No" | |
284 | + filePath = "MenuTableViewController.m" | |
285 | + timestampString = "431867660.218473" | |
286 | + startingColumnNumber = "9223372036854775807" | |
287 | + endingColumnNumber = "9223372036854775807" | |
288 | + startingLineNumber = "127" | |
289 | + endingLineNumber = "127" | |
290 | + landmarkName = "-generateSaleListNavLevel" | |
291 | + landmarkType = "5"> | |
292 | + </BreakpointContent> | |
293 | + </BreakpointProxy> | |
294 | + <BreakpointProxy | |
295 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
296 | + <BreakpointContent | |
297 | + shouldBeEnabled = "No" | |
298 | + ignoreCount = "0" | |
299 | + continueAfterRunningActions = "No" | |
300 | + filePath = "MenuTableViewController.m" | |
301 | + timestampString = "431867660.218473" | |
302 | + startingColumnNumber = "9223372036854775807" | |
303 | + endingColumnNumber = "9223372036854775807" | |
304 | + startingLineNumber = "136" | |
305 | + endingLineNumber = "136" | |
306 | + landmarkName = "-generateSaleListNavLevel" | |
307 | + landmarkType = "5"> | |
308 | + </BreakpointContent> | |
309 | + </BreakpointProxy> | |
310 | + <BreakpointProxy | |
311 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
312 | + <BreakpointContent | |
313 | + shouldBeEnabled = "No" | |
314 | + ignoreCount = "0" | |
315 | + continueAfterRunningActions = "No" | |
316 | + filePath = "MenuTableViewController.m" | |
317 | + timestampString = "431884750.147748" | |
318 | + startingColumnNumber = "9223372036854775807" | |
319 | + endingColumnNumber = "9223372036854775807" | |
320 | + startingLineNumber = "208" | |
321 | + endingLineNumber = "208" | |
322 | + landmarkName = "-changeNavLevel::" | |
323 | + landmarkType = "5"> | |
324 | + </BreakpointContent> | |
325 | + </BreakpointProxy> | |
326 | + <BreakpointProxy | |
327 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
328 | + <BreakpointContent | |
329 | + shouldBeEnabled = "No" | |
330 | + ignoreCount = "0" | |
331 | + continueAfterRunningActions = "No" | |
332 | + filePath = "MenuTableViewController.m" | |
333 | + timestampString = "431887175.109814" | |
334 | + startingColumnNumber = "9223372036854775807" | |
335 | + endingColumnNumber = "9223372036854775807" | |
336 | + startingLineNumber = "507" | |
337 | + endingLineNumber = "507" | |
338 | + landmarkName = "-tableView:numberOfRowsInSection:" | |
339 | + landmarkType = "5"> | |
340 | + </BreakpointContent> | |
341 | + </BreakpointProxy> | |
342 | + <BreakpointProxy | |
343 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
344 | + <BreakpointContent | |
345 | + shouldBeEnabled = "No" | |
346 | + ignoreCount = "0" | |
347 | + continueAfterRunningActions = "No" | |
348 | + filePath = "MenuTableViewController.m" | |
349 | + timestampString = "431887175.109814" | |
350 | + startingColumnNumber = "9223372036854775807" | |
351 | + endingColumnNumber = "9223372036854775807" | |
352 | + startingLineNumber = "651" | |
353 | + endingLineNumber = "651" | |
354 | + landmarkName = "-tableView:indentationLevelForRowAtIndexPath:" | |
355 | + landmarkType = "5"> | |
356 | + </BreakpointContent> | |
357 | + </BreakpointProxy> | |
358 | + <BreakpointProxy | |
359 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
360 | + <BreakpointContent | |
361 | + shouldBeEnabled = "No" | |
362 | + ignoreCount = "0" | |
363 | + continueAfterRunningActions = "No" | |
364 | + filePath = "MenuTableViewController.m" | |
365 | + timestampString = "431887175.109814" | |
366 | + startingColumnNumber = "9223372036854775807" | |
367 | + endingColumnNumber = "9223372036854775807" | |
368 | + startingLineNumber = "671" | |
369 | + endingLineNumber = "671" | |
370 | + landmarkName = "-tableView:cellForRowAtIndexPath:" | |
371 | + landmarkType = "5"> | |
372 | + </BreakpointContent> | |
373 | + </BreakpointProxy> | |
374 | + <BreakpointProxy | |
375 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
376 | + <BreakpointContent | |
377 | + shouldBeEnabled = "No" | |
378 | + ignoreCount = "0" | |
379 | + continueAfterRunningActions = "No" | |
380 | + filePath = "MenuTableViewController.m" | |
381 | + timestampString = "431887175.109814" | |
382 | + startingColumnNumber = "9223372036854775807" | |
383 | + endingColumnNumber = "9223372036854775807" | |
384 | + startingLineNumber = "864" | |
385 | + endingLineNumber = "864" | |
386 | + landmarkName = "-tableView:cellForRowAtIndexPath:" | |
387 | + landmarkType = "5"> | |
388 | + </BreakpointContent> | |
389 | + </BreakpointProxy> | |
390 | + <BreakpointProxy | |
391 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
392 | + <BreakpointContent | |
393 | + shouldBeEnabled = "No" | |
394 | + ignoreCount = "0" | |
395 | + continueAfterRunningActions = "No" | |
396 | + filePath = "MenuTableViewController.m" | |
397 | + timestampString = "431887175.109814" | |
398 | + startingColumnNumber = "9223372036854775807" | |
399 | + endingColumnNumber = "9223372036854775807" | |
400 | + startingLineNumber = "865" | |
401 | + endingLineNumber = "865" | |
402 | + landmarkName = "-tableView:cellForRowAtIndexPath:" | |
403 | + landmarkType = "5"> | |
404 | + </BreakpointContent> | |
405 | + </BreakpointProxy> | |
406 | + <BreakpointProxy | |
407 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
408 | + <BreakpointContent | |
409 | + shouldBeEnabled = "No" | |
410 | + ignoreCount = "0" | |
411 | + continueAfterRunningActions = "No" | |
412 | + filePath = "SalesLog.m" | |
413 | + timestampString = "431870901.753946" | |
414 | + startingColumnNumber = "9223372036854775807" | |
415 | + endingColumnNumber = "9223372036854775807" | |
416 | + startingLineNumber = "51" | |
417 | + endingLineNumber = "51" | |
418 | + landmarkName = "-parseResponse" | |
419 | + landmarkType = "5"> | |
420 | + </BreakpointContent> | |
421 | + </BreakpointProxy> | |
422 | + <BreakpointProxy | |
423 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
424 | + <BreakpointContent | |
425 | + shouldBeEnabled = "No" | |
426 | + ignoreCount = "0" | |
427 | + continueAfterRunningActions = "No" | |
428 | + filePath = "MenuTableViewController.m" | |
429 | + timestampString = "431887175.109814" | |
430 | + startingColumnNumber = "9223372036854775807" | |
431 | + endingColumnNumber = "9223372036854775807" | |
432 | + startingLineNumber = "984" | |
433 | + endingLineNumber = "984" | |
434 | + landmarkName = "-tableView:cellForRowAtIndexPath:" | |
435 | + landmarkType = "5"> | |
436 | + </BreakpointContent> | |
437 | + </BreakpointProxy> | |
438 | + <BreakpointProxy | |
439 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
440 | + <BreakpointContent | |
441 | + shouldBeEnabled = "No" | |
442 | + ignoreCount = "0" | |
443 | + continueAfterRunningActions = "No" | |
444 | + filePath = "MenuTableViewController.m" | |
445 | + timestampString = "431887175.109814" | |
446 | + startingColumnNumber = "9223372036854775807" | |
447 | + endingColumnNumber = "9223372036854775807" | |
448 | + startingLineNumber = "463" | |
449 | + endingLineNumber = "463" | |
450 | + landmarkName = "-toggleDropList:" | |
451 | + landmarkType = "5"> | |
452 | + </BreakpointContent> | |
453 | + </BreakpointProxy> | |
454 | + <BreakpointProxy | |
455 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
456 | + <BreakpointContent | |
457 | + shouldBeEnabled = "No" | |
458 | + ignoreCount = "0" | |
459 | + continueAfterRunningActions = "No" | |
460 | + filePath = "MenuTableViewController.m" | |
461 | + timestampString = "431887175.109814" | |
462 | + startingColumnNumber = "9223372036854775807" | |
463 | + endingColumnNumber = "9223372036854775807" | |
464 | + startingLineNumber = "1069" | |
465 | + endingLineNumber = "1069" | |
466 | + landmarkName = "-tableView:cellForRowAtIndexPath:" | |
467 | + landmarkType = "5"> | |
468 | + </BreakpointContent> | |
469 | + </BreakpointProxy> | |
470 | + <BreakpointProxy | |
471 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
472 | + <BreakpointContent | |
473 | + shouldBeEnabled = "No" | |
474 | + ignoreCount = "0" | |
475 | + continueAfterRunningActions = "No" | |
476 | + filePath = "MenuTableViewController.m" | |
477 | + timestampString = "431887175.109814" | |
222 | 478 | startingColumnNumber = "9223372036854775807" |
223 | 479 | endingColumnNumber = "9223372036854775807" |
224 | - startingLineNumber = "650" | |
225 | - endingLineNumber = "650" | |
480 | + startingLineNumber = "1061" | |
481 | + endingLineNumber = "1061" | |
226 | 482 | landmarkName = "-tableView:cellForRowAtIndexPath:" |
227 | 483 | landmarkType = "5"> |
228 | 484 | </BreakpointContent> | ... | ... |
DUREX Vendor Control/FirstAppExample/Base.lproj/MainStoryboard.storyboard
1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6"> | |
2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="kWw-Rk-wD6"> | |
3 | 3 | <dependencies> |
4 | 4 | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/> |
5 | 5 | </dependencies> |
... | ... | @@ -119,25 +119,42 @@ |
119 | 119 | </subviews> |
120 | 120 | </tableViewCellContentView> |
121 | 121 | </tableViewCell> |
122 | - <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SaleListCell" textLabel="HRc-DC-qxG" detailTextLabel="dhY-17-9fo" style="IBUITableViewCellStyleValue1" id="gpr-Mk-KfN"> | |
122 | + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SaleListCell" textLabel="HRc-DC-qxG" style="IBUITableViewCellStyleDefault" id="gpr-Mk-KfN"> | |
123 | 123 | <rect key="frame" x="0.0" y="218" width="320" height="44"/> |
124 | 124 | <autoresizingMask key="autoresizingMask"/> |
125 | 125 | <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gpr-Mk-KfN" id="bFe-TX-iWA"> |
126 | - <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> | |
126 | + <rect key="frame" x="0.0" y="0.0" width="287" height="43"/> | |
127 | 127 | <autoresizingMask key="autoresizingMask"/> |
128 | 128 | <subviews> |
129 | 129 | <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HRc-DC-qxG"> |
130 | + <rect key="frame" x="15" y="0.0" width="270" height="43"/> | |
131 | + <autoresizingMask key="autoresizingMask"/> | |
132 | + <fontDescription key="fontDescription" type="system" pointSize="18"/> | |
133 | + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | |
134 | + <nil key="highlightedColor"/> | |
135 | + </label> | |
136 | + </subviews> | |
137 | + </tableViewCellContentView> | |
138 | + </tableViewCell> | |
139 | + <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SaleCell" textLabel="WrA-En-smn" detailTextLabel="gIS-s7-3GC" style="IBUITableViewCellStyleValue1" id="F4h-vD-VzY"> | |
140 | + <rect key="frame" x="0.0" y="262" width="320" height="44"/> | |
141 | + <autoresizingMask key="autoresizingMask"/> | |
142 | + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="F4h-vD-VzY" id="0zh-2N-ywu"> | |
143 | + <rect key="frame" x="0.0" y="0.0" width="320" height="43"/> | |
144 | + <autoresizingMask key="autoresizingMask"/> | |
145 | + <subviews> | |
146 | + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="WrA-En-smn"> | |
130 | 147 | <rect key="frame" x="15" y="11" width="33" height="21"/> |
131 | 148 | <autoresizingMask key="autoresizingMask"/> |
132 | 149 | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
133 | 150 | <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> |
134 | 151 | <nil key="highlightedColor"/> |
135 | 152 | </label> |
136 | - <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="dhY-17-9fo"> | |
153 | + <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gIS-s7-3GC"> | |
137 | 154 | <rect key="frame" x="261" y="11" width="44" height="21"/> |
138 | 155 | <autoresizingMask key="autoresizingMask"/> |
139 | 156 | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
140 | - <color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="calibratedRGB"/> | |
157 | + <color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/> | |
141 | 158 | <nil key="highlightedColor"/> |
142 | 159 | </label> |
143 | 160 | </subviews> | ... | ... |
DUREX Vendor Control/FirstAppExample/EMDevicePickerViewController.m
... | ... | @@ -105,7 +105,7 @@ |
105 | 105 | |
106 | 106 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath |
107 | 107 | { |
108 | - [self performSegueWithIdentifier:@"ConnectionSegue" sender:self]; | |
108 | + //[self performSegueWithIdentifier:@"ConnectionSegue" sender:self]; | |
109 | 109 | if(![[[[tableView cellForRowAtIndexPath:indexPath] textLabel] text] isEqualToString:NSLocalizedString(@"Searching for devices...",nil)]) |
110 | 110 | { |
111 | 111 | [self _showConnectingView]; | ... | ... |
DUREX Vendor Control/MenuTableViewController.h
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | #import "NameChangerViewController.h" |
16 | 16 | #import "Sensors.h" |
17 | 17 | #import "SalesLog.h" |
18 | +#import "UIView+Toast.h" | |
18 | 19 | |
19 | 20 | #define num(x) [NSNumber numberWithUnsignedInt:x] |
20 | 21 | |
... | ... | @@ -26,16 +27,17 @@ |
26 | 27 | |
27 | 28 | #define MAINTENANCE_ELEMENTS @">[2000]Channels Present",@">[2001]Product Present in Channel",@">[2002]Channel Engine Status",@"[2003]Door Sensor",@"[2004]Coil Sensor",@">[2005]Money Collected",@">[2006]Money Returned",@">[2007]Products Sold",@">[2008]Change Available",@"[2009]Sales log",@"[2010]Incident report",@"[2011]Send report" |
28 | 29 | #define MAINTENANCE_CHANNELS @"*Channel 1",@"*Channel 2",@"*Channel 3",@"*Channel 4",@"*Channel 5",@"*Channel 6",@"*Channel 7",@"*Channel 8",@"*Channel 9",@"*Channel 10",@"*Channel 11",@"*Channel 12",@"*Channel 13",@"*Channel 14",@"*Channel 15",@"*Channel 16" |
29 | -#define MAINTENANCE_MONEY_IN @"*10€ Notes",@"*5€ Notes",@"*2€ Coins",@"*1€ Coins",@"*50c Coins" | |
30 | +#define MAINTENANCE_MONEY_IN @"*20€ Notes",@"*10€ Notes",@"*5€ Notes",@"*2€ Coins",@"*1€ Coins",@"*50c Coins" | |
30 | 31 | #define MAINTENANCE_MONEY_OUT @"*2€ Coins",@"*1€ Coins",@"*50c Coins" |
31 | 32 | #define MAINTENANCE_CHANGE @"*1€ Coins",@"*50c Coins" |
32 | 33 | #define MAINTENANCE_PRODUCTS @"*Product 1",@"*Product 2",@"*Product 3",@"*Product 4",@"*Product 5",@"*Product 6",@"*Product 7",@"*Product 8",@"*Product 9",@"*Product 10",@"*Product 11",@"*Product 12",@"*Product 13",@"*Product 14",@"*Product 15",@"*Product 16" |
33 | 34 | #define MAINTENANCE_CELLS_PER_SECTION num(9),num(3) |
34 | 35 | #define MAINTENANCE_HEADERS NSLocalizedString(@"Sensors", nil),NSLocalizedString(@"Commands", nil) |
35 | 36 | |
36 | -#define SALE_ELEMENTS @"[3000]Money Paid",@"[3001]Channel",@"[3002]Product Code",@"[3003]Normal Price",@"[3004]Discounted Price",@"[3005]Money Returned" | |
37 | -#define SALE_MONEY_PAID @"10€ Notes",@"5€ Notes",@"2€ Coins",@"1€ Coins",@"50c Coins" | |
38 | -#define SALE_MONEY_RETURNED @"1€ Change",@"50c Change" | |
37 | +#define SALE_ELEMENTS @">[3000]Money Paid",@"[3001]Channel",@"[3002]Product Code",@"[3003]Product Price",@">[3004]Money Returned" | |
38 | +#define SALE_MONEY_PAID @"*20€ Notes",@"*10€ Notes",@"*5€ Notes",@"*2€ Coins",@"*1€ Coins",@"*50c Coins" | |
39 | +#define SALE_MONEY_RETURNED @"*2€ Coins",@"*1€ Coins",@"*50c Coins" | |
40 | +#define SALE_CELLS_PER_SECTION num(5) | |
39 | 41 | #define SALE_HEADERS nil |
40 | 42 | |
41 | 43 | #define CONFIGURATION_ELEMENTS @"[4000]Update Date & Time",@"[4001]Update product price",@"[4002]Update product name" |
... | ... | @@ -53,7 +55,7 @@ enum { |
53 | 55 | REPORT, |
54 | 56 | } navigationLevel; |
55 | 57 | |
56 | -@interface MenuTableViewController : UITableViewController <DatePickerViewControllerDelegate,PriceChangerViewControllerDelegate,NameChangerViewControllerDelegate> | |
58 | +@interface MenuTableViewController : UITableViewController <DatePickerViewControllerDelegate,PriceChangerViewControllerDelegate,NameChangerViewControllerDelegate,NSURLConnectionDataDelegate> | |
57 | 59 | |
58 | 60 | @property (strong,nonatomic) Stack *parentLayout; |
59 | 61 | @property (strong,nonatomic) DatePickerViewController *datePickerViewController; |
... | ... | @@ -61,6 +63,8 @@ enum { |
61 | 63 | @property (strong,nonatomic) NameChangerViewController *nameChangerViewController; |
62 | 64 | @property (strong,nonatomic) Sensors *sensorStatus; |
63 | 65 | @property (strong,nonatomic) SalesLog *salesLog; |
66 | +@property (strong,nonatomic) Sale *currentSale; | |
67 | +@property (strong,nonatomic) NSString *machineMACAddr; | |
64 | 68 | |
65 | 69 | - (void) navBack; |
66 | 70 | ... | ... |
DUREX Vendor Control/MenuTableViewController.m
... | ... | @@ -25,6 +25,10 @@ |
25 | 25 | @property (nonatomic,strong) const NSMutableArray *saleListStructure; |
26 | 26 | @property (nonatomic,strong) const NSMutableArray *saleListHeaders; |
27 | 27 | |
28 | +@property (nonatomic,strong) const NSMutableArray *saleElements; | |
29 | +@property (nonatomic,strong) const NSMutableArray *saleStructure; | |
30 | +@property (nonatomic,strong) const NSMutableArray *saleHeaders; | |
31 | + | |
28 | 32 | @property (nonatomic,strong) const NSMutableArray *configElements; |
29 | 33 | @property (nonatomic,strong) const NSMutableArray *configStructure; |
30 | 34 | @property (nonatomic,strong) const NSMutableArray *configHeaders; |
... | ... | @@ -81,6 +85,9 @@ |
81 | 85 | |
82 | 86 | - (Boolean) generateMaintenanceLevel |
83 | 87 | { |
88 | + //Initialize sensor status | |
89 | + [self setSensorStatus:[[Sensors alloc]init]]; | |
90 | + | |
84 | 91 | NSString *sensorData = [_protocol readSensorData]; |
85 | 92 | if(sensorData == nil) |
86 | 93 | { |
... | ... | @@ -103,6 +110,9 @@ |
103 | 110 | |
104 | 111 | - (Boolean) generateSaleListNavLevel |
105 | 112 | { |
113 | + //Initialize sales log | |
114 | + [self setSalesLog:[[SalesLog alloc]init]]; | |
115 | + | |
106 | 116 | //LAUNCH DATE RANGE SELECTOR |
107 | 117 | NSString *salesData = [_protocol readSalesLog: nil : nil]; |
108 | 118 | if(salesData == nil) |
... | ... | @@ -111,12 +121,37 @@ |
111 | 121 | return FALSE; |
112 | 122 | } |
113 | 123 | [[self salesLog] setResponseValue:salesData]; |
114 | - [self setSaleListElements:[[NSMutableArray alloc] initWithObjects:nil, nil]]; | |
115 | - [self setSaleListStructure:[[NSMutableArray alloc] initWithObjects:nil, nil]]; | |
124 | + NSMutableArray *dateArray = [[NSMutableArray alloc] init]; | |
125 | + for(int i = 0; i < [[[self salesLog] sales]count]; i++) | |
126 | + { | |
127 | + Sale *currentSale = [[[self salesLog] sales]objectAtIndex:i]; | |
128 | + NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
129 | + NSCalendarUnit units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit; | |
130 | + NSDateComponents *components = [calendar components:units fromDate:[currentSale saleTime]]; | |
131 | + [dateArray insertObject:[NSString stringWithFormat:@"[%d%d%d%d%d]%02d/%02d/%d %02d:%02d",[components day],[components month],[components year],[components hour],[components minute],[components day],[components month],[components year],[components hour],[components minute]] atIndex:i]; | |
132 | + } | |
133 | + [self setSaleListElements:[[NSMutableArray alloc] initWithArray:dateArray]]; | |
134 | + [self setSaleListStructure:[[NSMutableArray alloc] initWithObjects:[NSNumber numberWithInt:[dateArray count]], nil]]; | |
116 | 135 | [self setSaleListHeaders:nil]; |
117 | 136 | return TRUE; |
118 | 137 | } |
119 | 138 | |
139 | +- (Boolean) generateSaleNavLevel : (NSInteger) numSale | |
140 | +{ | |
141 | + [self setSaleElements:[[NSMutableArray alloc] initWithObjects:SALE_ELEMENTS, nil]]; | |
142 | + [self setSaleStructure:[[NSMutableArray alloc] initWithObjects:SALE_CELLS_PER_SECTION, nil]]; | |
143 | + if([[self saleStructure] count] > 1) | |
144 | + { | |
145 | + [self setSaleHeaders:[[NSMutableArray alloc] initWithObjects:SALE_HEADERS, nil]]; | |
146 | + } | |
147 | + else | |
148 | + { | |
149 | + [self setSaleHeaders:nil]; | |
150 | + } | |
151 | + [self setCurrentSale:[[[self salesLog]sales]objectAtIndex:numSale]]; | |
152 | + return TRUE; | |
153 | +} | |
154 | + | |
120 | 155 | - (void) changeNavLevel: (uint8_t) level : (BOOL) push |
121 | 156 | { |
122 | 157 | NSLog(@"[MenuTableViewController.m]: navLevel is %d",level); |
... | ... | @@ -128,7 +163,8 @@ |
128 | 163 | [self setCurrentCellIdentifier:[[self cellIdentifiers] objectAtIndex:[self currentNavLevel]]]; |
129 | 164 | if([self currentNavLevel] == MENU) |
130 | 165 | { |
131 | - [[self navigationItem] setTitle:[[[EMConnectionManager sharedManager] connectedDevice] name]]; | |
166 | + [self setMachineMACAddr:[[[EMConnectionManager sharedManager] connectedDevice] name]]; | |
167 | + [[self navigationItem] setTitle:[self machineMACAddr]]; | |
132 | 168 | [self setCurrentElements:[self menuElements]]; |
133 | 169 | [self setCurrentStructure:[self menuStructure]]; |
134 | 170 | [self setCurrentHeaders:[self menuHeaders]]; |
... | ... | @@ -147,6 +183,16 @@ |
147 | 183 | [self setCurrentStructure:[self saleListStructure]]; |
148 | 184 | [self setCurrentHeaders:[self saleListHeaders]]; |
149 | 185 | } |
186 | + else if([self currentNavLevel] == SALE) | |
187 | + { | |
188 | + NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
189 | + NSCalendarUnit units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit; | |
190 | + NSDateComponents *components = [calendar components:units fromDate:[[self currentSale] saleTime]]; | |
191 | + [[self navigationItem] setTitle:[NSString stringWithFormat:@"%@ %02d/%02d/%d %02d:%02d",NSLocalizedString(@"Sale on", nil),[components day],[components month],[components year],[components hour],[components minute]]]; | |
192 | + [self setCurrentElements:[self saleElements]]; | |
193 | + [self setCurrentStructure:[self saleStructure]]; | |
194 | + [self setCurrentHeaders:[self saleHeaders]]; | |
195 | + } | |
150 | 196 | else if([self currentNavLevel] == BASIC_CONFIGURATION) |
151 | 197 | { |
152 | 198 | [[self navigationItem] setTitle:NSLocalizedString(@"Basic Configuration", nil)]; |
... | ... | @@ -155,6 +201,10 @@ |
155 | 201 | [self setCurrentHeaders:[self configHeaders]]; |
156 | 202 | } |
157 | 203 | //AND SO ON... |
204 | + NSLog(@"MenuTableViewController.m]: New elements: %@",[self currentElements]); | |
205 | + NSLog(@"MenuTableViewController.m]: New structure: %@",[self currentStructure]); | |
206 | + NSLog(@"MenuTableViewController.m]: New headers: %@",[self currentHeaders]); | |
207 | + NSLog(@"MenuTableViewController.m]: New cell identifier: %@",[self currentCellIdentifier]); | |
158 | 208 | [self reloadTable:UITableViewRowAnimationAutomatic]; |
159 | 209 | } |
160 | 210 | |
... | ... | @@ -198,6 +248,32 @@ |
198 | 248 | } |
199 | 249 | } |
200 | 250 | |
251 | +- (void) sendMaintenanceReport : (NSString*) status : (NSString*) date : (NSString*) machineid | |
252 | +{ | |
253 | + NSString *content = [NSString stringWithFormat:@"status=%@&date=%@&machineid=%@",status,date,machineid]; | |
254 | + | |
255 | + NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:REPORT_SERVER_URL]]; | |
256 | + [request setHTTPMethod:@"POST"]; | |
257 | + [request setHTTPBody:[content dataUsingEncoding:NSUTF8StringEncoding]]; | |
258 | + | |
259 | + // generates an autoreleased NSURLConnection | |
260 | + [NSURLConnection connectionWithRequest:request delegate:self]; | |
261 | +} | |
262 | + | |
263 | +- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data | |
264 | +{ | |
265 | + // Append the new data to receivedData. | |
266 | + // receivedData is an instance variable declared elsewhere. | |
267 | + NSLog(@"[MenuTableViewController.m]: Received response from report server: %@",[NSString stringWithUTF8String:[data bytes]]); | |
268 | + [self.view makeToast:NSLocalizedString(@"Report sent successfully", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Success!", nil) image:[UIImage imageNamed:@"icon_checkmark"]]; | |
269 | +} | |
270 | + | |
271 | +- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error | |
272 | +{ | |
273 | + NSLog(@"[MenuTableViewController.m]: Error connecting to server: %@ %@",[error localizedDescription],[[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]); | |
274 | + [self.view makeToast:NSLocalizedString(@"Connection to server failed", nil) duration:3 position:[NSValue valueWithCGPoint:CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2)] title:NSLocalizedString(@"Error", nil) image:[UIImage imageNamed:@"icon_delete"]]; | |
275 | +} | |
276 | + | |
201 | 277 | - (void)viewDidLoad |
202 | 278 | { |
203 | 279 | [super viewDidLoad]; |
... | ... | @@ -227,13 +303,7 @@ |
227 | 303 | [self initializeMenuEntries]; |
228 | 304 | self.currentNavLevel = 255; |
229 | 305 | [self changeNavLevel:MENU:FALSE]; |
230 | - | |
231 | - //Initialize sensor status | |
232 | - [self setSensorStatus:[[Sensors alloc]init]]; | |
233 | - | |
234 | - //Initialize sales log | |
235 | - [self setSalesLog:[[SalesLog alloc]init]]; | |
236 | -} | |
306 | + } | |
237 | 307 | |
238 | 308 | -(void)viewDidAppear:(BOOL)animated |
239 | 309 | { |
... | ... | @@ -386,6 +456,35 @@ |
386 | 456 | } |
387 | 457 | } |
388 | 458 | } |
459 | + else if([self currentNavLevel] == SALE) | |
460 | + { | |
461 | + if([cellName isEqualToString:@"Money Paid"]) | |
462 | + { | |
463 | + NSMutableArray *newRows = [[NSMutableArray alloc] initWithObjects:SALE_MONEY_PAID, nil]; | |
464 | + if(folded) | |
465 | + { | |
466 | + [self addTags: newRows : cellTag]; | |
467 | + [self addRowsAtIndexPath: newRows : index]; | |
468 | + } | |
469 | + else | |
470 | + { | |
471 | + [self removeRowsAtIndexPath: [newRows count] : index]; | |
472 | + } | |
473 | + } | |
474 | + else if([cellName isEqualToString:@"Money Returned"]) | |
475 | + { | |
476 | + NSMutableArray *newRows = [[NSMutableArray alloc] initWithObjects:SALE_MONEY_RETURNED, nil]; | |
477 | + if(folded) | |
478 | + { | |
479 | + [self addTags: newRows : cellTag]; | |
480 | + [self addRowsAtIndexPath: newRows : index]; | |
481 | + } | |
482 | + else | |
483 | + { | |
484 | + [self removeRowsAtIndexPath: [newRows count] : index]; | |
485 | + } | |
486 | + } | |
487 | + } | |
389 | 488 | [self reloadTable:UITableViewRowAnimationNone]; |
390 | 489 | } |
391 | 490 | |
... | ... | @@ -422,6 +521,7 @@ |
422 | 521 | NSLog(@"[MenuTableViewController.m]: Changing to navLevel: MAINTENANCE"); |
423 | 522 | if([self generateMaintenanceLevel]) |
424 | 523 | { |
524 | + [NSThread sleepForTimeInterval:1]; | |
425 | 525 | [self changeNavLevel:MAINTENANCE:TRUE]; |
426 | 526 | } |
427 | 527 | else |
... | ... | @@ -454,6 +554,7 @@ |
454 | 554 | } |
455 | 555 | else if([cellName isEqualToString:NSLocalizedString(@"Sales log", nil)]) |
456 | 556 | { |
557 | + [NSThread sleepForTimeInterval:1]; | |
457 | 558 | NSLog(@"[MenuTableViewController.m]: Changing to navLevel: SALE_LIST"); |
458 | 559 | if([self generateSaleListNavLevel]) |
459 | 560 | { |
... | ... | @@ -464,6 +565,14 @@ |
464 | 565 | NSLog(@"[MenuTableViewController.m]: Error while changing to navLevel: SALE_LIST"); |
465 | 566 | } |
466 | 567 | } |
568 | + else if([cellName isEqualToString:NSLocalizedString(@"Send report", nil)]) | |
569 | + { | |
570 | + NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; | |
571 | + NSCalendarUnit units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; | |
572 | + NSDateComponents *components = [calendar components:units fromDate:[NSDate date]]; | |
573 | + NSString *date = [NSString stringWithFormat:@"%02d/%02d/%d %02d:%02d:%02d",[components day],[components month],[components year],[components hour],[components minute],[components second]]; | |
574 | + [self sendMaintenanceReport: [[self sensorStatus] response] : date: [self machineMACAddr]]; | |
575 | + } | |
467 | 576 | } |
468 | 577 | //Cells in BASIC_CONFIGURATION |
469 | 578 | else if([self currentNavLevel] == BASIC_CONFIGURATION) |
... | ... | @@ -517,6 +626,22 @@ |
517 | 626 | } |
518 | 627 | } |
519 | 628 | } |
629 | + else if([self currentNavLevel] == SALE_LIST) | |
630 | + { | |
631 | + if([self generateSaleNavLevel: [indexPath row]]) | |
632 | + { | |
633 | + [self changeNavLevel:SALE:TRUE]; | |
634 | + } | |
635 | + } | |
636 | + else if([self currentNavLevel] == SALE) | |
637 | + { | |
638 | + if([cellName isEqualToString:NSLocalizedString(@"Money Paid", nil)] || | |
639 | + [cellName isEqualToString:NSLocalizedString(@"Money Returned", nil)]) | |
640 | + { | |
641 | + [self toggleDropList:indexPath]; | |
642 | + } | |
643 | + | |
644 | + } | |
520 | 645 | } |
521 | 646 | |
522 | 647 | #pragma mark - Table view data source |
... | ... | @@ -701,11 +826,12 @@ |
701 | 826 | else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"Money Collected",nil)]) |
702 | 827 | { |
703 | 828 | double numCollected = 0; |
704 | - numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:0] intValue] * 10; | |
705 | - numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:1] intValue] * 5; | |
706 | - numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:2] intValue] * 2; | |
707 | - numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:3] intValue] * 1; | |
708 | - numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:4] intValue] * 0.50; | |
829 | + numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:0] intValue] * 20; | |
830 | + numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:1] intValue] * 10; | |
831 | + numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:2] intValue] * 5; | |
832 | + numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:3] intValue] * 2; | |
833 | + numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:4] intValue] * 1; | |
834 | + numCollected += [[[[self sensorStatus] moneyCollected] objectAtIndex:5] intValue] * 0.50; | |
709 | 835 | [[cell detailTextLabel] setText:[NSString stringWithFormat:@"%.2f",numCollected]]; |
710 | 836 | } |
711 | 837 | else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"Money Returned",nil)]) |
... | ... | @@ -746,26 +872,33 @@ |
746 | 872 | } |
747 | 873 | } |
748 | 874 | } |
749 | - else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"10€ Notes",nil)]) | |
875 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"20€ Notes",nil)]) | |
750 | 876 | { |
751 | 877 | if([cell tag] == 2005) |
752 | 878 | { |
753 | 879 | [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:0] stringValue]]; |
754 | 880 | } |
755 | 881 | } |
756 | - else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"5€ Notes",nil)]) | |
882 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"10€ Notes",nil)]) | |
757 | 883 | { |
758 | 884 | if([cell tag] == 2005) |
759 | 885 | { |
760 | 886 | [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:1] stringValue]]; |
761 | 887 | } |
762 | 888 | } |
763 | - else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"2€ Coins",nil)]) | |
889 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"5€ Notes",nil)]) | |
764 | 890 | { |
765 | 891 | if([cell tag] == 2005) |
766 | 892 | { |
767 | 893 | [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:2] stringValue]]; |
768 | 894 | } |
895 | + } | |
896 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"2€ Coins",nil)]) | |
897 | + { | |
898 | + if([cell tag] == 2005) | |
899 | + { | |
900 | + [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:3] stringValue]]; | |
901 | + } | |
769 | 902 | else if([cell tag] == 2006) |
770 | 903 | { |
771 | 904 | [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyReturned] objectAtIndex:0] stringValue]]; |
... | ... | @@ -775,7 +908,7 @@ |
775 | 908 | { |
776 | 909 | if([cell tag] == 2005) |
777 | 910 | { |
778 | - [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:3] stringValue]]; | |
911 | + [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:4] stringValue]]; | |
779 | 912 | } |
780 | 913 | else if([cell tag] == 2006) |
781 | 914 | { |
... | ... | @@ -797,7 +930,7 @@ |
797 | 930 | { |
798 | 931 | if([cell tag] == 2005) |
799 | 932 | { |
800 | - [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:4] stringValue]]; | |
933 | + [[cell detailTextLabel] setText:[[[[self sensorStatus] moneyCollected] objectAtIndex:5] stringValue]]; | |
801 | 934 | } |
802 | 935 | else if([cell tag] == 2006) |
803 | 936 | { |
... | ... | @@ -824,6 +957,119 @@ |
824 | 957 | [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; |
825 | 958 | } |
826 | 959 | } |
960 | + else if([self currentNavLevel] == SALE) | |
961 | + { | |
962 | + [[[cell contentView] viewWithTag:CELL_CARAT_TAG] removeFromSuperview]; | |
963 | + [[cell detailTextLabel] setText:@""]; | |
964 | + [cell setAccessoryView:nil]; | |
965 | + [cell setAccessoryType:UITableViewCellAccessoryNone]; | |
966 | + if(foldedList) | |
967 | + { | |
968 | + NSInteger cellHeight = cell.contentView.frame.size.height; | |
969 | + UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,cellHeight/2 - (11/2),11,11)]; | |
970 | + imageView.image = [UIImage imageNamed:@"carat.png"]; | |
971 | + imageView.tag = CELL_CARAT_TAG; | |
972 | + [cell.contentView addSubview:imageView]; | |
973 | + } | |
974 | + else if(unfoldedList) | |
975 | + { | |
976 | + NSInteger cellHeight = cell.contentView.frame.size.height; | |
977 | + UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,cellHeight/2 - (11/2),11,11)]; | |
978 | + imageView.image = [UIImage imageNamed:@"carat-open.png"]; | |
979 | + imageView.tag = CELL_CARAT_TAG; | |
980 | + [cell.contentView addSubview:imageView]; | |
981 | + } | |
982 | + if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"Money Paid",nil)]) | |
983 | + { | |
984 | + double numCollected = 0; | |
985 | + numCollected += [[[[self currentSale] moneyPaid] objectAtIndex:0] intValue] * 20; | |
986 | + numCollected += [[[[self currentSale] moneyPaid] objectAtIndex:1] intValue] * 10; | |
987 | + numCollected += [[[[self currentSale] moneyPaid] objectAtIndex:2] intValue] * 5; | |
988 | + numCollected += [[[[self currentSale] moneyPaid] objectAtIndex:3] intValue] * 2; | |
989 | + numCollected += [[[[self currentSale] moneyPaid] objectAtIndex:4] intValue] * 1; | |
990 | + numCollected += [[[[self currentSale] moneyPaid] objectAtIndex:5] intValue] * 0.50; | |
991 | + [[cell detailTextLabel] setText:[NSString stringWithFormat:@"%.2f",numCollected]]; | |
992 | + [cell setAccessoryView:nil]; | |
993 | + } | |
994 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"Channel",nil)]) | |
995 | + { | |
996 | + [[cell detailTextLabel] setText:[[self currentSale] channel]]; | |
997 | + [cell setAccessoryView:nil]; | |
998 | + } | |
999 | + if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"Product Code",nil)]) | |
1000 | + { | |
1001 | + [[cell detailTextLabel] setText:[[self currentSale] productCode]]; | |
1002 | + [cell setAccessoryView:nil]; | |
1003 | + } | |
1004 | + if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"Product Price",nil)]) | |
1005 | + { | |
1006 | + [[cell detailTextLabel] setText:[[self currentSale] normalPrice]]; | |
1007 | + [cell setAccessoryView:nil]; | |
1008 | + } | |
1009 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"Money Returned",nil)]) | |
1010 | + { | |
1011 | + double numReturned = 0; | |
1012 | + numReturned += [[[[self currentSale] moneyReturned] objectAtIndex:0] intValue] * 2; | |
1013 | + numReturned += [[[[self currentSale] moneyReturned] objectAtIndex:1] intValue] * 1; | |
1014 | + numReturned += [[[[self currentSale] moneyReturned] objectAtIndex:2] intValue] * 0.50; | |
1015 | + [[cell detailTextLabel] setText:[NSString stringWithFormat:@"%.2f",numReturned]]; | |
1016 | + [cell setAccessoryView:nil]; | |
1017 | + } | |
1018 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"20€ Notes",nil)]) | |
1019 | + { | |
1020 | + if([cell tag] == 3000) | |
1021 | + { | |
1022 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyPaid] objectAtIndex:0] stringValue]]; | |
1023 | + } | |
1024 | + } | |
1025 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"10€ Notes",nil)]) | |
1026 | + { | |
1027 | + if([cell tag] == 3000) | |
1028 | + { | |
1029 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyPaid] objectAtIndex:1] stringValue]]; | |
1030 | + } | |
1031 | + } | |
1032 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"5€ Notes",nil)]) | |
1033 | + { | |
1034 | + if([cell tag] == 3000) | |
1035 | + { | |
1036 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyPaid] objectAtIndex:2] stringValue]]; | |
1037 | + } | |
1038 | + } | |
1039 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"2€ Coins",nil)]) | |
1040 | + { | |
1041 | + if([cell tag] == 3000) | |
1042 | + { | |
1043 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyPaid] objectAtIndex:3] stringValue]]; | |
1044 | + } | |
1045 | + else if([cell tag] == 3004) | |
1046 | + { | |
1047 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyReturned] objectAtIndex:0] stringValue]]; | |
1048 | + } | |
1049 | + } | |
1050 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"1€ Coins",nil)]) | |
1051 | + { | |
1052 | + if([cell tag] == 3000) | |
1053 | + { | |
1054 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyPaid] objectAtIndex:4] stringValue]]; | |
1055 | + } | |
1056 | + else if([cell tag] == 3004) | |
1057 | + { | |
1058 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyReturned] objectAtIndex:1] stringValue]]; | |
1059 | + } | |
1060 | + } | |
1061 | + else if([[[cell textLabel] text] isEqualToString:NSLocalizedString(@"50c Coins",nil)]) | |
1062 | + { | |
1063 | + if([cell tag] == 3000) | |
1064 | + { | |
1065 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyPaid]objectAtIndex:5] stringValue]]; | |
1066 | + } | |
1067 | + else if([cell tag] == 3004) | |
1068 | + { | |
1069 | + [[cell detailTextLabel] setText:[[[[self currentSale] moneyReturned] objectAtIndex:2] stringValue]]; | |
1070 | + } | |
1071 | + } | |
1072 | + } | |
827 | 1073 | return cell; |
828 | 1074 | } |
829 | 1075 | ... | ... |
DUREX Vendor Control/Sale.h
DUREX Vendor Control/SalesLog.m
... | ... | @@ -38,24 +38,24 @@ |
38 | 38 | [saleDate setDay:[[[self response] substringWithRange:NSMakeRange(6 + currentSale*SALE_STRING_LENGTH, 2)] intValue]]; |
39 | 39 | [saleDate setHour:[[[self response] substringWithRange:NSMakeRange(8 + currentSale*SALE_STRING_LENGTH, 2)] intValue]]; |
40 | 40 | [saleDate setMinute:[[[self response] substringWithRange:NSMakeRange(10 + currentSale*SALE_STRING_LENGTH, 2)] intValue]]; |
41 | - [sale setSaleTime:[saleDate date]]; | |
42 | - NSLog(@"date: %@",saleDate); | |
41 | + [sale setSaleTime:[calendar dateFromComponents:saleDate]]; | |
42 | + NSLog(@"date: %@",[calendar dateFromComponents:saleDate]); | |
43 | 43 | [[sale moneyPaid] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(12 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:0]; |
44 | 44 | [[sale moneyPaid] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(14 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:1]; |
45 | 45 | [[sale moneyPaid] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(16 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:2]; |
46 | 46 | [[sale moneyPaid] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(18 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:3]; |
47 | 47 | [[sale moneyPaid] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(20 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:4]; |
48 | + [[sale moneyPaid] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(22 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:5]; | |
48 | 49 | NSLog(@"moneyPaid: %@",[sale moneyPaid]); |
49 | - [sale setChannel:[[self response] substringWithRange:NSMakeRange(22 + currentSale*SALE_STRING_LENGTH, 1)]]; | |
50 | + [sale setChannel:[[self response] substringWithRange:NSMakeRange(24 + currentSale*SALE_STRING_LENGTH, 1)]]; | |
50 | 51 | NSLog(@"channel: %@",[sale channel]); |
51 | - [sale setProductCode:[[self response] substringWithRange:NSMakeRange(23 + currentSale*SALE_STRING_LENGTH, 1)]]; | |
52 | + [sale setProductCode:[[self response] substringWithRange:NSMakeRange(25 + currentSale*SALE_STRING_LENGTH, 1)]]; | |
52 | 53 | NSLog(@"productCode: %@",[sale productCode]); |
53 | - [sale setNormalPrice: [NSString stringWithFormat:@"%d,%02d",[[[self response] substringWithRange:NSMakeRange(24 + currentSale*SALE_STRING_LENGTH, 2)] intValue],[[[self response] substringWithRange:NSMakeRange(26 + currentSale*SALE_STRING_LENGTH, 2)] intValue]]]; | |
54 | + [sale setNormalPrice: [NSString stringWithFormat:@"%d,%02d €",[[[self response] substringWithRange:NSMakeRange(26 + currentSale*SALE_STRING_LENGTH, 2)] intValue],[[[self response] substringWithRange:NSMakeRange(28 + currentSale*SALE_STRING_LENGTH, 2)] intValue]]]; | |
54 | 55 | NSLog(@"normalPrice: %@",[sale normalPrice]); |
55 | - [sale setDiscountedPrice: [NSString stringWithFormat:@"%d,%02d",[[[self response] substringWithRange:NSMakeRange(28 + currentSale*SALE_STRING_LENGTH, 2)] intValue],[[[self response] substringWithRange:NSMakeRange(30 + currentSale*SALE_STRING_LENGTH, 2)] intValue]]]; | |
56 | - NSLog(@"discountedPrice: %@",[sale discountedPrice]); | |
57 | - [[sale moneyReturned] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(32 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:0]; | |
58 | - [[sale moneyReturned] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(34 + currentSale*SALE_STRING_LENGTH , 2)] intValue]] atIndex:1]; | |
56 | + [[sale moneyReturned] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(30 + currentSale*SALE_STRING_LENGTH, 2)] intValue]] atIndex:0]; | |
57 | + [[sale moneyReturned] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(32 + currentSale*SALE_STRING_LENGTH , 2)] intValue]] atIndex:1]; | |
58 | + [[sale moneyReturned] insertObject:[NSNumber numberWithInt:[[[self response] substringWithRange:NSMakeRange(34 + currentSale*SALE_STRING_LENGTH , 2)] intValue]] atIndex:2]; | |
59 | 59 | NSLog(@"moneyReturned: %@",[sale moneyReturned]); |
60 | 60 | [[self sales] insertObject:sale atIndex:currentSale]; |
61 | 61 | currentSale++; | ... | ... |
DUREX Vendor Control/Sensors.m
... | ... | @@ -126,7 +126,7 @@ |
126 | 126 | substrRange.location += 2; |
127 | 127 | } |
128 | 128 | |
129 | - if([[self response] characterAtIndex:75] == '1') | |
129 | + if([[self response] characterAtIndex:78] == '1') | |
130 | 130 | { |
131 | 131 | [[self changeAvailable]insertObject:[NSNumber numberWithBool:TRUE] atIndex:0]; |
132 | 132 | } |
... | ... | @@ -135,7 +135,7 @@ |
135 | 135 | [[self changeAvailable]insertObject:[NSNumber numberWithBool:FALSE] atIndex:0]; |
136 | 136 | } |
137 | 137 | |
138 | - if([[self response] characterAtIndex:76] == '1') | |
138 | + if([[self response] characterAtIndex:79] == '1') | |
139 | 139 | { |
140 | 140 | [[self changeAvailable]insertObject:[NSNumber numberWithBool:TRUE] atIndex:1]; |
141 | 141 | } | ... | ... |
DUREX Vendor Control/UIView+Toast.h
0 → 100755
1 | +/*************************************************************************** | |
2 | + | |
3 | +UIView+Toast.h | |
4 | +Toast | |
5 | + | |
6 | +Copyright (c) 2013 Charles Scalesse. | |
7 | + | |
8 | +Permission is hereby granted, free of charge, to any person obtaining a | |
9 | +copy of this software and associated documentation files (the | |
10 | +"Software"), to deal in the Software without restriction, including | |
11 | +without limitation the rights to use, copy, modify, merge, publish, | |
12 | +distribute, sublicense, and/or sell copies of the Software, and to | |
13 | +permit persons to whom the Software is furnished to do so, subject to | |
14 | +the following conditions: | |
15 | + | |
16 | +The above copyright notice and this permission notice shall be included | |
17 | +in all copies or substantial portions of the Software. | |
18 | + | |
19 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
20 | +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
21 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
22 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
23 | +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
24 | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
25 | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
26 | + | |
27 | +***************************************************************************/ | |
28 | + | |
29 | + | |
30 | +#import <Foundation/Foundation.h> | |
31 | + | |
32 | +@interface UIView (Toast) | |
33 | + | |
34 | +// each makeToast method creates a view and displays it as toast | |
35 | +- (void)makeToast:(NSString *)message; | |
36 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position; | |
37 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position image:(UIImage *)image; | |
38 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title; | |
39 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title image:(UIImage *)image; | |
40 | + | |
41 | +// displays toast with an activity spinner | |
42 | +- (void)makeToastActivity; | |
43 | +- (void)makeToastActivity:(id)position; | |
44 | +- (void)hideToastActivity; | |
45 | + | |
46 | +// the showToast methods display any view as toast | |
47 | +- (void)showToast:(UIView *)toast; | |
48 | +- (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point; | |
49 | + | |
50 | +@end | ... | ... |
DUREX Vendor Control/UIView+Toast.m
0 → 100755
1 | +// | |
2 | +// UIView+Toast.m | |
3 | +// Toast | |
4 | +// | |
5 | +// Copyright 2013 Charles Scalesse. | |
6 | +// | |
7 | + | |
8 | +#import "UIView+Toast.h" | |
9 | +#import <QuartzCore/QuartzCore.h> | |
10 | +#import <objc/runtime.h> | |
11 | + | |
12 | +/* | |
13 | + * CONFIGURE THESE VALUES TO ADJUST LOOK & FEEL, | |
14 | + * DISPLAY DURATION, ETC. | |
15 | + */ | |
16 | + | |
17 | +// general appearance | |
18 | +static const CGFloat CSToastMaxWidth = 0.8; // 80% of parent view width | |
19 | +static const CGFloat CSToastMaxHeight = 0.8; // 80% of parent view height | |
20 | +static const CGFloat CSToastHorizontalPadding = 10.0; | |
21 | +static const CGFloat CSToastVerticalPadding = 10.0; | |
22 | +static const CGFloat CSToastCornerRadius = 10.0; | |
23 | +static const CGFloat CSToastOpacity = 0.8; | |
24 | +static const CGFloat CSToastFontSize = 16.0; | |
25 | +static const CGFloat CSToastMaxTitleLines = 0; | |
26 | +static const CGFloat CSToastMaxMessageLines = 0; | |
27 | +static const NSTimeInterval CSToastFadeDuration = 0.2; | |
28 | + | |
29 | +// shadow appearance | |
30 | +static const CGFloat CSToastShadowOpacity = 0.8; | |
31 | +static const CGFloat CSToastShadowRadius = 6.0; | |
32 | +static const CGSize CSToastShadowOffset = { 4.0, 4.0 }; | |
33 | +static const BOOL CSToastDisplayShadow = YES; | |
34 | + | |
35 | +// display duration and position | |
36 | +static const NSString * CSToastDefaultPosition = @"bottom"; | |
37 | +static const NSTimeInterval CSToastDefaultDuration = 3.0; | |
38 | + | |
39 | +// image view size | |
40 | +static const CGFloat CSToastImageViewWidth = 80.0; | |
41 | +static const CGFloat CSToastImageViewHeight = 80.0; | |
42 | + | |
43 | +// activity | |
44 | +static const CGFloat CSToastActivityWidth = 100.0; | |
45 | +static const CGFloat CSToastActivityHeight = 100.0; | |
46 | +static const NSString * CSToastActivityDefaultPosition = @"center"; | |
47 | + | |
48 | +// interaction | |
49 | +static const BOOL CSToastHidesOnTap = YES; // excludes activity views | |
50 | + | |
51 | +// associative reference keys | |
52 | +static const NSString * CSToastTimerKey = @"CSToastTimerKey"; | |
53 | +static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey"; | |
54 | + | |
55 | +@interface UIView (ToastPrivate) | |
56 | + | |
57 | +- (void)hideToast:(UIView *)toast; | |
58 | +- (void)toastTimerDidFinish:(NSTimer *)timer; | |
59 | +- (void)handleToastTapped:(UITapGestureRecognizer *)recognizer; | |
60 | +- (CGPoint)centerPointForPosition:(id)position withToast:(UIView *)toast; | |
61 | +- (UIView *)viewForMessage:(NSString *)message title:(NSString *)title image:(UIImage *)image; | |
62 | +- (CGSize)sizeForString:(NSString *)string font:(UIFont *)font constrainedToSize:(CGSize)constrainedSize lineBreakMode:(NSLineBreakMode)lineBreakMode; | |
63 | + | |
64 | +@end | |
65 | + | |
66 | + | |
67 | +@implementation UIView (Toast) | |
68 | + | |
69 | +#pragma mark - Toast Methods | |
70 | + | |
71 | +- (void)makeToast:(NSString *)message { | |
72 | + [self makeToast:message duration:CSToastDefaultDuration position:CSToastDefaultPosition]; | |
73 | +} | |
74 | + | |
75 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position { | |
76 | + UIView *toast = [self viewForMessage:message title:nil image:nil]; | |
77 | + [self showToast:toast duration:duration position:position]; | |
78 | +} | |
79 | + | |
80 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position title:(NSString *)title { | |
81 | + UIView *toast = [self viewForMessage:message title:title image:nil]; | |
82 | + [self showToast:toast duration:duration position:position]; | |
83 | +} | |
84 | + | |
85 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position image:(UIImage *)image { | |
86 | + UIView *toast = [self viewForMessage:message title:nil image:image]; | |
87 | + [self showToast:toast duration:duration position:position]; | |
88 | +} | |
89 | + | |
90 | +- (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position title:(NSString *)title image:(UIImage *)image { | |
91 | + UIView *toast = [self viewForMessage:message title:title image:image]; | |
92 | + [self showToast:toast duration:duration position:position]; | |
93 | +} | |
94 | + | |
95 | +- (void)showToast:(UIView *)toast { | |
96 | + [self showToast:toast duration:CSToastDefaultDuration position:CSToastDefaultPosition]; | |
97 | +} | |
98 | + | |
99 | +- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)point { | |
100 | + toast.center = [self centerPointForPosition:point withToast:toast]; | |
101 | + toast.alpha = 0.0; | |
102 | + | |
103 | + if (CSToastHidesOnTap) { | |
104 | + UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:toast action:@selector(handleToastTapped:)]; | |
105 | + [toast addGestureRecognizer:recognizer]; | |
106 | + toast.userInteractionEnabled = YES; | |
107 | + toast.exclusiveTouch = YES; | |
108 | + } | |
109 | + | |
110 | + [self addSubview:toast]; | |
111 | + | |
112 | + [UIView animateWithDuration:CSToastFadeDuration | |
113 | + delay:0.0 | |
114 | + options:(UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction) | |
115 | + animations:^{ | |
116 | + toast.alpha = 1.0; | |
117 | + } completion:^(BOOL finished) { | |
118 | + NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:duration target:self selector:@selector(toastTimerDidFinish:) userInfo:toast repeats:NO]; | |
119 | + // associate the timer with the toast view | |
120 | + objc_setAssociatedObject (toast, &CSToastTimerKey, timer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
121 | + }]; | |
122 | + | |
123 | +} | |
124 | + | |
125 | +- (void)hideToast:(UIView *)toast { | |
126 | + [UIView animateWithDuration:CSToastFadeDuration | |
127 | + delay:0.0 | |
128 | + options:(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) | |
129 | + animations:^{ | |
130 | + toast.alpha = 0.0; | |
131 | + } completion:^(BOOL finished) { | |
132 | + [toast removeFromSuperview]; | |
133 | + }]; | |
134 | +} | |
135 | + | |
136 | +#pragma mark - Events | |
137 | + | |
138 | +- (void)toastTimerDidFinish:(NSTimer *)timer { | |
139 | + [self hideToast:(UIView *)timer.userInfo]; | |
140 | +} | |
141 | + | |
142 | +- (void)handleToastTapped:(UITapGestureRecognizer *)recognizer { | |
143 | + NSTimer *timer = (NSTimer *)objc_getAssociatedObject(self, &CSToastTimerKey); | |
144 | + [timer invalidate]; | |
145 | + | |
146 | + [self hideToast:recognizer.view]; | |
147 | +} | |
148 | + | |
149 | +#pragma mark - Toast Activity Methods | |
150 | + | |
151 | +- (void)makeToastActivity { | |
152 | + [self makeToastActivity:CSToastActivityDefaultPosition]; | |
153 | +} | |
154 | + | |
155 | +- (void)makeToastActivity:(id)position { | |
156 | + // sanity | |
157 | + UIView *existingActivityView = (UIView *)objc_getAssociatedObject(self, &CSToastActivityViewKey); | |
158 | + if (existingActivityView != nil) return; | |
159 | + | |
160 | + UIView *activityView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CSToastActivityWidth, CSToastActivityHeight)]; | |
161 | + activityView.center = [self centerPointForPosition:position withToast:activityView]; | |
162 | + activityView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:CSToastOpacity]; | |
163 | + activityView.alpha = 0.0; | |
164 | + activityView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); | |
165 | + activityView.layer.cornerRadius = CSToastCornerRadius; | |
166 | + | |
167 | + if (CSToastDisplayShadow) { | |
168 | + activityView.layer.shadowColor = [UIColor blackColor].CGColor; | |
169 | + activityView.layer.shadowOpacity = CSToastShadowOpacity; | |
170 | + activityView.layer.shadowRadius = CSToastShadowRadius; | |
171 | + activityView.layer.shadowOffset = CSToastShadowOffset; | |
172 | + } | |
173 | + | |
174 | + UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; | |
175 | + activityIndicatorView.center = CGPointMake(activityView.bounds.size.width / 2, activityView.bounds.size.height / 2); | |
176 | + [activityView addSubview:activityIndicatorView]; | |
177 | + [activityIndicatorView startAnimating]; | |
178 | + | |
179 | + // associate the activity view with self | |
180 | + objc_setAssociatedObject (self, &CSToastActivityViewKey, activityView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
181 | + | |
182 | + [self addSubview:activityView]; | |
183 | + | |
184 | + [UIView animateWithDuration:CSToastFadeDuration | |
185 | + delay:0.0 | |
186 | + options:UIViewAnimationOptionCurveEaseOut | |
187 | + animations:^{ | |
188 | + activityView.alpha = 1.0; | |
189 | + } completion:nil]; | |
190 | +} | |
191 | + | |
192 | +- (void)hideToastActivity { | |
193 | + UIView *existingActivityView = (UIView *)objc_getAssociatedObject(self, &CSToastActivityViewKey); | |
194 | + if (existingActivityView != nil) { | |
195 | + [UIView animateWithDuration:CSToastFadeDuration | |
196 | + delay:0.0 | |
197 | + options:(UIViewAnimationOptionCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState) | |
198 | + animations:^{ | |
199 | + existingActivityView.alpha = 0.0; | |
200 | + } completion:^(BOOL finished) { | |
201 | + [existingActivityView removeFromSuperview]; | |
202 | + objc_setAssociatedObject (self, &CSToastActivityViewKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | |
203 | + }]; | |
204 | + } | |
205 | +} | |
206 | + | |
207 | +#pragma mark - Helpers | |
208 | + | |
209 | +- (CGPoint)centerPointForPosition:(id)point withToast:(UIView *)toast { | |
210 | + if([point isKindOfClass:[NSString class]]) { | |
211 | + // convert string literals @"top", @"bottom", @"center", or any point wrapped in an NSValue object into a CGPoint | |
212 | + if([point caseInsensitiveCompare:@"top"] == NSOrderedSame) { | |
213 | + return CGPointMake(self.bounds.size.width/2, (toast.frame.size.height / 2) + CSToastVerticalPadding); | |
214 | + } else if([point caseInsensitiveCompare:@"bottom"] == NSOrderedSame) { | |
215 | + return CGPointMake(self.bounds.size.width/2, (self.bounds.size.height - (toast.frame.size.height / 2)) - CSToastVerticalPadding); | |
216 | + } else if([point caseInsensitiveCompare:@"center"] == NSOrderedSame) { | |
217 | + return CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2); | |
218 | + } | |
219 | + } else if ([point isKindOfClass:[NSValue class]]) { | |
220 | + return [point CGPointValue]; | |
221 | + } | |
222 | + | |
223 | + NSLog(@"Warning: Invalid position for toast."); | |
224 | + return [self centerPointForPosition:CSToastDefaultPosition withToast:toast]; | |
225 | +} | |
226 | + | |
227 | +- (CGSize)sizeForString:(NSString *)string font:(UIFont *)font constrainedToSize:(CGSize)constrainedSize lineBreakMode:(NSLineBreakMode)lineBreakMode { | |
228 | + if ([string respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) { | |
229 | + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; | |
230 | + paragraphStyle.lineBreakMode = lineBreakMode; | |
231 | + NSDictionary *attributes = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paragraphStyle}; | |
232 | + CGRect boundingRect = [string boundingRectWithSize:constrainedSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil]; | |
233 | + return CGSizeMake(ceilf(boundingRect.size.width), ceilf(boundingRect.size.height)); | |
234 | + } | |
235 | + | |
236 | +#pragma clang diagnostic push | |
237 | +#pragma clang diagnostic ignored "-Wdeprecated-declarations" | |
238 | + return [string sizeWithFont:font constrainedToSize:constrainedSize lineBreakMode:lineBreakMode]; | |
239 | +#pragma clang diagnostic pop | |
240 | +} | |
241 | + | |
242 | +- (UIView *)viewForMessage:(NSString *)message title:(NSString *)title image:(UIImage *)image { | |
243 | + // sanity | |
244 | + if((message == nil) && (title == nil) && (image == nil)) return nil; | |
245 | + | |
246 | + // dynamically build a toast view with any combination of message, title, & image. | |
247 | + UILabel *messageLabel = nil; | |
248 | + UILabel *titleLabel = nil; | |
249 | + UIImageView *imageView = nil; | |
250 | + | |
251 | + // create the parent view | |
252 | + UIView *wrapperView = [[UIView alloc] init]; | |
253 | + wrapperView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); | |
254 | + wrapperView.layer.cornerRadius = CSToastCornerRadius; | |
255 | + | |
256 | + if (CSToastDisplayShadow) { | |
257 | + wrapperView.layer.shadowColor = [UIColor blackColor].CGColor; | |
258 | + wrapperView.layer.shadowOpacity = CSToastShadowOpacity; | |
259 | + wrapperView.layer.shadowRadius = CSToastShadowRadius; | |
260 | + wrapperView.layer.shadowOffset = CSToastShadowOffset; | |
261 | + } | |
262 | + | |
263 | + wrapperView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:CSToastOpacity]; | |
264 | + | |
265 | + if(image != nil) { | |
266 | + imageView = [[UIImageView alloc] initWithImage:image]; | |
267 | + imageView.contentMode = UIViewContentModeScaleAspectFit; | |
268 | + imageView.frame = CGRectMake(CSToastHorizontalPadding, CSToastVerticalPadding, CSToastImageViewWidth, CSToastImageViewHeight); | |
269 | + } | |
270 | + | |
271 | + CGFloat imageWidth, imageHeight, imageLeft; | |
272 | + | |
273 | + // the imageView frame values will be used to size & position the other views | |
274 | + if(imageView != nil) { | |
275 | + imageWidth = imageView.bounds.size.width; | |
276 | + imageHeight = imageView.bounds.size.height; | |
277 | + imageLeft = CSToastHorizontalPadding; | |
278 | + } else { | |
279 | + imageWidth = imageHeight = imageLeft = 0.0; | |
280 | + } | |
281 | + | |
282 | + if (title != nil) { | |
283 | + titleLabel = [[UILabel alloc] init]; | |
284 | + titleLabel.numberOfLines = CSToastMaxTitleLines; | |
285 | + titleLabel.font = [UIFont boldSystemFontOfSize:CSToastFontSize]; | |
286 | + titleLabel.textAlignment = NSTextAlignmentLeft; | |
287 | + titleLabel.lineBreakMode = NSLineBreakByWordWrapping; | |
288 | + titleLabel.textColor = [UIColor whiteColor]; | |
289 | + titleLabel.backgroundColor = [UIColor clearColor]; | |
290 | + titleLabel.alpha = 1.0; | |
291 | + titleLabel.text = title; | |
292 | + | |
293 | + // size the title label according to the length of the text | |
294 | + CGSize maxSizeTitle = CGSizeMake((self.bounds.size.width * CSToastMaxWidth) - imageWidth, self.bounds.size.height * CSToastMaxHeight); | |
295 | + CGSize expectedSizeTitle = [self sizeForString:title font:titleLabel.font constrainedToSize:maxSizeTitle lineBreakMode:titleLabel.lineBreakMode]; | |
296 | + titleLabel.frame = CGRectMake(0.0, 0.0, expectedSizeTitle.width, expectedSizeTitle.height); | |
297 | + } | |
298 | + | |
299 | + if (message != nil) { | |
300 | + messageLabel = [[UILabel alloc] init]; | |
301 | + messageLabel.numberOfLines = CSToastMaxMessageLines; | |
302 | + messageLabel.font = [UIFont systemFontOfSize:CSToastFontSize]; | |
303 | + messageLabel.lineBreakMode = NSLineBreakByWordWrapping; | |
304 | + messageLabel.textColor = [UIColor whiteColor]; | |
305 | + messageLabel.backgroundColor = [UIColor clearColor]; | |
306 | + messageLabel.alpha = 1.0; | |
307 | + messageLabel.text = message; | |
308 | + | |
309 | + // size the message label according to the length of the text | |
310 | + CGSize maxSizeMessage = CGSizeMake((self.bounds.size.width * CSToastMaxWidth) - imageWidth, self.bounds.size.height * CSToastMaxHeight); | |
311 | + CGSize expectedSizeMessage = [self sizeForString:message font:messageLabel.font constrainedToSize:maxSizeMessage lineBreakMode:messageLabel.lineBreakMode]; | |
312 | + messageLabel.frame = CGRectMake(0.0, 0.0, expectedSizeMessage.width, expectedSizeMessage.height); | |
313 | + } | |
314 | + | |
315 | + // titleLabel frame values | |
316 | + CGFloat titleWidth, titleHeight, titleTop, titleLeft; | |
317 | + | |
318 | + if(titleLabel != nil) { | |
319 | + titleWidth = titleLabel.bounds.size.width; | |
320 | + titleHeight = titleLabel.bounds.size.height; | |
321 | + titleTop = CSToastVerticalPadding; | |
322 | + titleLeft = imageLeft + imageWidth + CSToastHorizontalPadding; | |
323 | + } else { | |
324 | + titleWidth = titleHeight = titleTop = titleLeft = 0.0; | |
325 | + } | |
326 | + | |
327 | + // messageLabel frame values | |
328 | + CGFloat messageWidth, messageHeight, messageLeft, messageTop; | |
329 | + | |
330 | + if(messageLabel != nil) { | |
331 | + messageWidth = messageLabel.bounds.size.width; | |
332 | + messageHeight = messageLabel.bounds.size.height; | |
333 | + messageLeft = imageLeft + imageWidth + CSToastHorizontalPadding; | |
334 | + messageTop = titleTop + titleHeight + CSToastVerticalPadding; | |
335 | + } else { | |
336 | + messageWidth = messageHeight = messageLeft = messageTop = 0.0; | |
337 | + } | |
338 | + | |
339 | + CGFloat longerWidth = MAX(titleWidth, messageWidth); | |
340 | + CGFloat longerLeft = MAX(titleLeft, messageLeft); | |
341 | + | |
342 | + // wrapper width uses the longerWidth or the image width, whatever is larger. same logic applies to the wrapper height | |
343 | + CGFloat wrapperWidth = MAX((imageWidth + (CSToastHorizontalPadding * 2)), (longerLeft + longerWidth + CSToastHorizontalPadding)); | |
344 | + CGFloat wrapperHeight = MAX((messageTop + messageHeight + CSToastVerticalPadding), (imageHeight + (CSToastVerticalPadding * 2))); | |
345 | + | |
346 | + wrapperView.frame = CGRectMake(0.0, 0.0, wrapperWidth, wrapperHeight); | |
347 | + | |
348 | + if(titleLabel != nil) { | |
349 | + titleLabel.frame = CGRectMake(titleLeft, titleTop, titleWidth, titleHeight); | |
350 | + [wrapperView addSubview:titleLabel]; | |
351 | + } | |
352 | + | |
353 | + if(messageLabel != nil) { | |
354 | + messageLabel.frame = CGRectMake(messageLeft, messageTop, messageWidth, messageHeight); | |
355 | + [wrapperView addSubview:messageLabel]; | |
356 | + } | |
357 | + | |
358 | + if(imageView != nil) { | |
359 | + [wrapperView addSubview:imageView]; | |
360 | + } | |
361 | + | |
362 | + return wrapperView; | |
363 | +} | |
364 | + | |
365 | +@end | ... | ... |
DUREX Vendor Control/en.lproj/Localizable.strings
... | ... | @@ -74,11 +74,16 @@ |
74 | 74 | "50c Coins" = "50c Coins"; |
75 | 75 | "Channel" = "Channel"; |
76 | 76 | "Product Code" = "Product Code"; |
77 | -"Normal Price" = "Normal Price"; | |
77 | +"Product Price" = "Product Price"; | |
78 | 78 | "Discounted Price" = "Discounted Price"; |
79 | 79 | "Money Paid" = "Money Paid"; |
80 | 80 | "1€ Change" = "1€ Change"; |
81 | 81 | "50c Change" = "50c Change"; |
82 | 82 | "Update Date & Time" = "Update Date & Time"; |
83 | 83 | "Update product price" = "Update product price"; |
84 | -"Update product name" = "Update product name"; | |
85 | 84 | \ No newline at end of file |
85 | +"Update product name" = "Update product name"; | |
86 | +"Sale on" = "Sale on"; | |
87 | +"Report sent successfully" = "Report sent successfully"; | |
88 | +"Success!" = "Success!"; | |
89 | +"Connection to server failed" = "Connection to server failed"; | |
90 | +"Error" = "Error"; | |
86 | 91 | \ No newline at end of file | ... | ... |
DUREX Vendor Control/es.lproj/Localizable.strings
... | ... | @@ -74,11 +74,16 @@ |
74 | 74 | "50c Coins" = "Monedas de 50c"; |
75 | 75 | "Channel" = "Canal"; |
76 | 76 | "Product Code" = "Código del producto"; |
77 | -"Normal Price" = "Precio Normal"; | |
77 | +"Product Price" = "Precio del Producto"; | |
78 | 78 | "Discounted Price" = "Precio con descuento"; |
79 | 79 | "Money Paid" = "Efectivo Pagado"; |
80 | 80 | "1€ Change" = "Cambio de 1€"; |
81 | 81 | "50c Change" = "Cambio de 50c"; |
82 | 82 | "Update Date & Time" = "Actualizar fecha y hora"; |
83 | 83 | "Update product price" = "Actualizar precio del producto"; |
84 | -"Update product name" = "Actualizar nombre del producto"; | |
85 | 84 | \ No newline at end of file |
85 | +"Update product name" = "Actualizar nombre del producto"; | |
86 | +"Sale on" = "Venta el"; | |
87 | +"Report sent successfully" = "Informe enviado satisfactoriamente"; | |
88 | +"Success!" = "Éxito!"; | |
89 | +"Connection to server failed" = "Conexión al servidor fallida"; | |
90 | +"Error" = "Error"; | |
86 | 91 | \ No newline at end of file | ... | ... |
TODO
... | ... | @@ -7,13 +7,6 @@ BUGS: |
7 | 7 | |
8 | 8 | TODO: |
9 | 9 | |
10 | -- Populate sale list with dates | |
11 | -- On select any date, generate navlevel with index in salesLog | |
12 | -- Generate sale navLevel | |
13 | - | |
14 | -- Implement sensor status logging and sending to remote server | |
15 | -- Lewis infrastructure for data viewing (SQL, Webpage, CSV parser) | |
16 | - | |
17 | 10 | - Channels and codes to 2 ciphers |
18 | 11 | |
19 | 12 | - Incident class |
... | ... | @@ -24,4 +17,4 @@ TODO: |
24 | 17 | - Implement master key. |
25 | 18 | |
26 | 19 | CHECK: |
27 | -- Layouts on another iPhone | |
20 | +- Layouts on another iPhone (4 inch) | ... | ... |