This repository has been archived by the owner on Jan 13, 2022. It is now read-only.
/
AppDelegate.m
56 lines (46 loc) · 2.31 KB
/
AppDelegate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#import "AppDelegate.h"
#import "TabBarController.h"
#import "MenuController.h"
#import "ContentController.h"
@implementation AppDelegate
///////////////////////////////////////////////////////////////////////////////////////////////////
// UIApplicationDelegate
- (void)applicationDidFinishLaunching:(UIApplication*)application {
TTNavigator* navigator = [TTNavigator navigator];
navigator.persistenceMode = TTNavigatorPersistenceModeAll;
navigator.window = [[[UIWindow alloc] initWithFrame:TTScreenBounds()] autorelease];
TTURLMap* map = navigator.URLMap;
[map from:@"*" toViewController:[TTWebController class]];
[map from:@"tt://tabBar" toSharedViewController:[TabBarController class]];
[map from:@"tt://menu/(initWithMenu:)" toSharedViewController:[MenuController class]];
[map from:@"tt://food/(initWithFood:)" toViewController:[ContentController class]];
[map from:@"tt://about/(initWithAbout:)" parent:@"tt://menu/5"
toViewController:[ContentController class] selector:nil transition:0];
[map from:@"tt://food/(initWithNutrition:)/nutrition" toViewController:[ContentController class]
transition:UIViewAnimationTransitionFlipFromLeft];
[map from:@"tt://order?waitress=(initWithWaitress:)"
toModalViewController:[ContentController class]];
[map from:@"tt://order?waitress=()#(orderAction:)" toViewController:[ContentController class]];
[map from:@"tt://order/confirm" toViewController:self selector:@selector(confirmOrder)];
[map from:@"tt://order/send" toObject:self selector:@selector(sendOrder)];
if (![navigator restoreViewControllers]) {
[navigator openURL:@"tt://tabBar" animated:NO];
}
}
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)URL {
[[TTNavigator navigator] openURL:URL.absoluteString animated:NO];
return YES;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
- (UIViewController*)confirmOrder {
TTAlertViewController* alert = [[[TTAlertViewController alloc]
initWithTitle:@"Are you sure?"
message:@"Sure you want to order?"] autorelease];
[alert addButtonWithTitle:@"Yes" URL:@"tt://order/send"];
[alert addCancelButtonWithTitle:@"No" URL:nil];
return alert;
}
- (void)sendOrder {
TTLOG(@"SENDING THE ORDER...");
}
@end