diff --git a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index 3ef9bda..22de5ab 100644
--- a/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/FMC Planner 2.xcodeproj/xcuserdata/Kili2.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -10,43 +10,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FMC Planner 2/ViewControllerScreen.m"
- timestampString = "480450634.41493"
+ timestampString = "480456367.132317"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "95"
- endingLineNumber = "95"
- landmarkName = "-loadScreen:withOptions:"
- landmarkType = "5">
-
-
-
-
-
-
-
-
@@ -57,13 +25,13 @@
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "FMC Planner 2/ViewControllerKeyboard.m"
- timestampString = "480449369.755953"
+ filePath = "FMC Planner 2/ViewControllerScreen.m"
+ timestampString = "480457455.927911"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "117"
- endingLineNumber = "117"
- landmarkName = "-KeyTaps:"
+ startingLineNumber = "131"
+ endingLineNumber = "131"
+ landmarkName = "-loadDataToScreen"
landmarkType = "5">
@@ -73,13 +41,45 @@
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
- filePath = "FMC Planner 2/ViewControllerKeyboard.m"
- timestampString = "480449401.34365"
+ filePath = "FMC Planner 2/ViewControllerScreen.m"
+ timestampString = "480457455.927911"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "97"
- endingLineNumber = "97"
- landmarkName = "-KeyTaps:"
+ startingLineNumber = "101"
+ endingLineNumber = "101"
+ landmarkName = "-loadScreen:withOptions:"
+ landmarkType = "5">
+
+
+
+
+
+
+
+
diff --git a/FMC Planner 2/Menu.plist b/FMC Planner 2/Menu.plist
index 8fad2f4..d3537d9 100644
--- a/FMC Planner 2/Menu.plist
+++ b/FMC Planner 2/Menu.plist
@@ -2,13 +2,13 @@
- Departure
- Arrival
- Aircraft
-
+ DEPARTURE
+ ARRIVAL
+ AIRCRAFT
+ CO RTE
diff --git a/FMC Planner 2/ViewController.h b/FMC Planner 2/ViewController.h
index a188b43..eea221a 100644
--- a/FMC Planner 2/ViewController.h
+++ b/FMC Planner 2/ViewController.h
@@ -15,9 +15,13 @@
@property(strong, nonatomic) ViewControllerScreen *screen;
@property(strong, nonatomic) ViewControllerKeyboard *keys;
+@property(strong, nonatomic) NSMutableDictionary *save;
@property(strong, nonatomic) IBOutlet UIView *backdropKeys;
@property(strong, nonatomic) IBOutlet UIView *backdropScreen;
+- (void)loadSave:(NSString *)file;
+- (void)saveToFile:(NSDictionary *)save;
+
@end
diff --git a/FMC Planner 2/ViewController.m b/FMC Planner 2/ViewController.m
index 1a3eb80..cfc5087 100644
--- a/FMC Planner 2/ViewController.m
+++ b/FMC Planner 2/ViewController.m
@@ -18,6 +18,8 @@
_backdropKeys.layer.masksToBounds = YES;
_backdropScreen.layer.cornerRadius = 5;
_backdropScreen.layer.masksToBounds = YES;
+ // Setup save system
+ _save = [[NSMutableDictionary alloc] init];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
@@ -32,4 +34,22 @@
}
}
+#warning TODO: check if file already exists -- load or replace
+#warning TODO: else -> jump to file browsing for load/delete
+- (void)saveToFile:(NSDictionary *)save {
+ if (!([_save valueForKey:@"MENU@LSKR1"] == nil ||
+ [[_save valueForKey:@"MENU@LSKR1"] isEqualToString:@""])) {
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(
+ NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *documentsPath = [paths objectAtIndex:0];
+ [_save writeToFile:[documentsPath
+ stringByAppendingString:
+ [NSString
+ stringWithFormat:
+ @"/%@",
+ [_save valueForKey:@"MENU@LSKR1"]]]
+ atomically:YES];
+ }
+}
+
@end
diff --git a/FMC Planner 2/ViewControllerKeyboard.m b/FMC Planner 2/ViewControllerKeyboard.m
index 946d7a7..6ee1d73 100644
--- a/FMC Planner 2/ViewControllerKeyboard.m
+++ b/FMC Planner 2/ViewControllerKeyboard.m
@@ -6,8 +6,8 @@
// Copyright © 2016 Kilian Hofmann. All rights reserved.
//
-#import "ViewController.h"
#import "ViewControllerKeyboard.h"
+#import "ViewController.h"
@implementation ViewControllerKeyboard
diff --git a/FMC Planner 2/ViewControllerScreen.h b/FMC Planner 2/ViewControllerScreen.h
index d46369b..75c2681 100644
--- a/FMC Planner 2/ViewControllerScreen.h
+++ b/FMC Planner 2/ViewControllerScreen.h
@@ -7,6 +7,7 @@
//
#import "SharedDeclerations.h"
+#import "ViewController.h"
#import
@class ViewController;
@@ -26,5 +27,6 @@
@property(strong, nonatomic) IBOutlet NSLayoutConstraint *FrameHeight;
- (void)loadScreen:(NSString *)screenName withOptions:(NSArray *)options;
+- (void)loadDataToScreen;
@end
diff --git a/FMC Planner 2/ViewControllerScreen.m b/FMC Planner 2/ViewControllerScreen.m
index 76b2d83..562b3d1 100644
--- a/FMC Planner 2/ViewControllerScreen.m
+++ b/FMC Planner 2/ViewControllerScreen.m
@@ -6,6 +6,7 @@
// Copyright © 2016 Kilian Hofmann. All rights reserved.
//
+#import "ViewController.h"
#import "ViewControllerScreen.h"
@implementation ViewControllerScreen
@@ -65,8 +66,6 @@
for (UILabel *label in _LSK) {
label.text = @"";
}
- _Scratchpad.text = @"";
- _Header.text = @"";
}
- (void)enterLSK:(UITapGestureRecognizer *)tapReg {
@@ -76,8 +75,8 @@
((UILabel *)tapReg.view).text = _Scratchpad.text;
}
if ([((UILabel *)tapReg.view)
- .restorationIdentifier
- isEqualToString:@"LSKR6"] &&_numRoutePage = _maxNumRoutePages) {
+ .restorationIdentifier isEqualToString:@"LSKR6"] &&
+ _numRoutePage == _maxNumRoutePages) {
_maxNumRoutePages += 1;
NSRange indexSlash = [_Header.text rangeOfString:@"/"];
_Header.text = [_Header.text
@@ -91,6 +90,12 @@
_maxNumRoutePages]];
}
_Scratchpad.text = @"";
+ [_main.save
+ setObject:((UILabel *)tapReg.view).text
+ forKey:[NSString stringWithFormat:@"%@@%@", _Header.text,
+ ((UILabel *)tapReg.view)
+ .restorationIdentifier]];
+ [_main saveToFile:_main.save];
}
- (void)loadScreen:(NSString *)screenName withOptions:(NSArray *)options {
@@ -120,6 +125,24 @@
_numRoutePage,
_maxNumRoutePages]];
}
+ [self loadDataToScreen];
+}
+
+- (void)loadDataToScreen {
+ for (NSString *ident in _main.save) {
+ NSRange range = [ident rangeOfString:@"@"];
+ if ([[ident substringToIndex:range.location]
+ isEqualToString:_Header.text]) {
+ for (UILabel *label in _LSK) {
+ if ([label.restorationIdentifier
+ isEqualToString:[ident
+ substringFromIndex:range.location +
+ 1]]) {
+ label.text = [_main.save valueForKey:ident];
+ }
+ }
+ }
+ }
}
@end