|
@@ -9,8 +9,11 @@ |
9 |
9 |
|
#import "DataManager.h" |
10 |
10 |
|
#import "SFAPercorso.h" |
11 |
11 |
|
#import "LoginVC.h" |
|
12 |
+ |
#import "AlertVC.h" |
12 |
13 |
|
|
13 |
|
- |
@implementation DataManager |
|
14 |
+ |
|
|
15 |
+ |
|
|
16 |
+ |
@implementation DataManager |
14 |
17 |
|
|
15 |
18 |
|
#pragma mark - DataManager Initialization |
16 |
19 |
|
|
|
@@ -95,59 +98,97 @@ |
95 |
98 |
|
|
96 |
99 |
|
#pragma mark - UIALERT |
97 |
100 |
|
|
98 |
|
- |
- (void) showMessageWithAlert:(id)delegate message:(NSString*)message { |
|
101 |
+ |
- (void) showMessageWithAlert:(id)delegate message:(NSString*)message tag:(NSInteger)tag{ |
|
102 |
+ |
|
|
103 |
+ |
CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init]; |
|
104 |
+ |
[alertView setContainerView:[self createAlertViewWithMessage:@"Safari D'Arte" :message]]; |
|
105 |
+ |
[alertView setButtonTitles:[NSMutableArray arrayWithObjects:NSLocalizedString(@"Yes", nil), NSLocalizedString(@"No", nil), nil]]; |
|
106 |
+ |
|
|
107 |
+ |
[alertView setDelegate:delegate]; |
|
108 |
+ |
[alertView setUseMotionEffects:true]; |
|
109 |
+ |
alertView.tag=tag; |
|
110 |
+ |
[alertView show]; |
99 |
111 |
|
|
100 |
|
- |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:APP_NAME |
101 |
|
- |
message:message |
102 |
|
- |
delegate:delegate |
103 |
|
- |
cancelButtonTitle:NSLocalizedString(@"No", nil) |
104 |
|
- |
otherButtonTitles:NSLocalizedString(@"Yes", nil), nil]; |
105 |
|
- |
[alert show]; |
|
112 |
+ |
|
106 |
113 |
|
} |
107 |
114 |
|
|
|
115 |
+ |
- (void) showAlert:(id)delegate withTitle:(NSString*)title message:(NSString*)message tag:(NSInteger)tag{ |
|
116 |
+ |
|
|
117 |
+ |
CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init]; |
|
118 |
+ |
[alertView setContainerView:[self createAlertViewWithMessage:title :message]]; |
|
119 |
+ |
[alertView setButtonTitles:[NSMutableArray arrayWithObjects:NSLocalizedString(@"Ok", nil), nil]]; |
|
120 |
+ |
|
|
121 |
+ |
[alertView setDelegate:delegate]; |
|
122 |
+ |
[alertView setUseMotionEffects:true]; |
|
123 |
+ |
alertView.tag=tag; |
|
124 |
+ |
[alertView show]; |
|
125 |
+ |
} |
108 |
126 |
|
|
109 |
127 |
|
- (void) showErrorAlert:(id)delegate message:(NSString*)message tag:(NSInteger)tag { |
|
128 |
+ |
|
|
129 |
+ |
CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init]; |
|
130 |
+ |
[alertView setContainerView:[self createAlertViewWithMessage:@"Safari D'Arte" :message]]; |
|
131 |
+ |
[alertView setButtonTitles:[NSMutableArray arrayWithObjects:NSLocalizedString(@"Ok", nil), nil]]; |
|
132 |
+ |
alertView.tag=tag; |
|
133 |
+ |
[alertView setDelegate:delegate]; |
|
134 |
+ |
[alertView setUseMotionEffects:true]; |
|
135 |
+ |
|
110 |
136 |
|
|
111 |
|
- |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:APP_NAME |
112 |
|
- |
message:message |
113 |
|
- |
delegate:delegate |
114 |
|
- |
cancelButtonTitle:NSLocalizedString(@"Ok", nil) |
115 |
|
- |
otherButtonTitles:nil]; |
116 |
|
- |
alert.tag = tag; |
117 |
|
- |
[alert show]; |
|
137 |
+ |
[alertView show]; |
|
138 |
+ |
|
118 |
139 |
|
} |
119 |
140 |
|
|
120 |
141 |
|
- (void) showErrorAlert2Btns:(id)delegate message:(NSString*)message tag:(NSInteger)tag { |
121 |
142 |
|
|
122 |
|
- |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:APP_NAME |
123 |
|
- |
message:message |
124 |
|
- |
delegate:delegate |
125 |
|
- |
cancelButtonTitle:NSLocalizedString(@"No", nil) |
126 |
|
- |
otherButtonTitles:NSLocalizedString(@"Yes", nil), nil]; |
127 |
|
- |
alert.tag = tag; |
128 |
|
- |
[alert show]; |
|
143 |
+ |
CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init]; |
|
144 |
+ |
[alertView setContainerView:[self createAlertViewWithMessage:@"Safari D'Arte" :message]]; |
|
145 |
+ |
[alertView setButtonTitles:[NSMutableArray arrayWithObjects:NSLocalizedString(@"Yes", nil), NSLocalizedString(@"No", nil), nil]]; |
|
146 |
+ |
alertView.tag=tag; |
|
147 |
+ |
[alertView setDelegate:delegate]; |
|
148 |
+ |
[alertView setUseMotionEffects:true]; |
|
149 |
+ |
|
|
150 |
+ |
|
|
151 |
+ |
[alertView show]; |
|
152 |
+ |
|
|
153 |
+ |
} |
|
154 |
+ |
|
|
155 |
+ |
- (void) showGPSAlert:(id)delegate message:(NSString*)message tag:(NSInteger)tag { |
|
156 |
+ |
|
|
157 |
+ |
CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init]; |
|
158 |
+ |
[alertView setContainerView:[self createAlertViewWithMessage:@"Safari D'Arte" :message]]; |
|
159 |
+ |
[alertView setButtonTitles:[NSMutableArray arrayWithObjects:NSLocalizedString(@"Cancel", nil), NSLocalizedString(@"menu_4", nil), nil]]; |
|
160 |
+ |
alertView.tag=tag; |
|
161 |
+ |
[alertView setDelegate:delegate]; |
|
162 |
+ |
[alertView setUseMotionEffects:true]; |
|
163 |
+ |
|
|
164 |
+ |
|
|
165 |
+ |
[alertView show]; |
|
166 |
+ |
|
129 |
167 |
|
} |
130 |
168 |
|
|
131 |
|
- |
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ |
|
169 |
+ |
|
|
170 |
+ |
- (UIView *)createAlertViewWithMessage:(NSString*)title :(NSString *)message |
|
171 |
+ |
{ |
|
172 |
+ |
|
|
173 |
+ |
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"AlertVC" owner:self options:nil]; |
|
174 |
+ |
UIView *aView = [[nibObjects objectAtIndex:0]initWithMessage:title :message]; |
|
175 |
+ |
return aView; |
|
176 |
+ |
} |
|
177 |
+ |
|
|
178 |
+ |
|
|
179 |
+ |
- (void)customIOS7dialogButtonTouchUpInside: (CustomIOSAlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex |
|
180 |
+ |
{ |
|
181 |
+ |
|
132 |
182 |
|
if(alertView.tag == 107 || alertView.tag == 101) { |
133 |
183 |
|
|
134 |
184 |
|
LoginVC *loginVC = [[LoginVC alloc] init]; |
135 |
185 |
|
APPDEL.nc.viewControllers = @[loginVC]; |
136 |
186 |
|
} |
137 |
|
- |
} |
138 |
187 |
|
|
139 |
|
- |
- (void) showAlertOrder:(id)delegate message:(NSString *)message tag:(NSInteger)tag{ |
140 |
188 |
|
|
141 |
|
- |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:APP_NAME |
142 |
|
- |
message:message |
143 |
|
- |
delegate:delegate |
144 |
|
- |
cancelButtonTitle:NSLocalizedString(@"Duration", nil) |
145 |
|
- |
otherButtonTitles:NSLocalizedString(@"Length", nil), nil]; |
146 |
|
- |
alert.tag = tag; |
147 |
|
- |
[alert show]; |
148 |
|
- |
|
|
189 |
+ |
|
|
190 |
+ |
[alertView close]; |
149 |
191 |
|
} |
150 |
|
- |
|
151 |
192 |
|
#pragma mark - POIs Management - Stored data |
152 |
193 |
|
|
153 |
194 |
|
- (void) savePOIforRoute:(SFAPercorso*)route poiIndex:(NSNumber*)poiIndex { |