Skip to content
This repository
Browse code

Extend private site logic for custom iOS Apps

The logic was there to account for private sites, it just needed some extra
logic to get it working with Custom iOS Apps.

I also modified the easyAppOven script to use spaces instead of tabs (Git hub wasn't
happy with tab characters). The script will now also ask the user running the
script if the site is private or not, and add the correct logic for custom
private iOS apps.
  • Loading branch information...
commit cf2d127ea2203edeeaa746132164547cbbaef367 1 parent 8587624
Stefan Ayala BaseInfinity authored
10 Classes/BookmarksViewController.m
@@ -363,10 +363,14 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger
363 363 // Remove the edit button.
364 364 self.navigationItem.rightBarButtonItem = nil;
365 365
366   - if ([Config currentConfig].private) {
  366 + // On Dozuki App
  367 + if ([Config currentConfig].dozuki && [Config currentConfig].private) {
367 368 [(iFixitAppDelegate*)[[UIApplication sharedApplication] delegate] showDozukiSplash];
368   - }
369   - else {
  369 + // On a custom private app
  370 + } else if ([Config currentConfig].private) {
  371 + [(iFixitAppDelegate*)[[UIApplication sharedApplication] delegate] showSiteSplash];
  372 + // Everyone else who is public
  373 + } else {
370 374 [self showLogin];
371 375 }
372 376 }
15 Classes/iFixitAppDelegate.m
@@ -169,12 +169,15 @@ - (void)showSiteSplash {
169 169 nvc.navigationBar.tintColor = [Config currentConfig].toolbarColor;
170 170 [vc release];
171 171
172   - UIImage *icon = [UIImage imageNamed:@"backtosites.png"];
173   - UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStyleBordered
174   - target:self
175   - action:@selector(showDozukiSplash)];
176   - vc.navigationItem.leftBarButtonItem = button;
177   - [button release];
  172 + // We only need this button if on Dozuki App
  173 + if ([Config currentConfig].dozuki) {
  174 + UIImage *icon = [UIImage imageNamed:@"backtosites.png"];
  175 + UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStyleBordered
  176 + target:self
  177 + action:@selector(showDozukiSplash)];
  178 + vc.navigationItem.leftBarButtonItem = button;
  179 + [button release];
  180 + }
178 181
179 182 // iPad: display in form sheet
180 183 if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
87 easyAppOven.rb
@@ -17,7 +17,7 @@
17 17 #####
18 18
19 19 puts "Easy App Oven!"
20   -configName = nanoSite = appName = ''
  20 +configName = nanoSite = appName = userInput = configPrivate = ''
21 21
22 22 # Ask the user for nanosite
23 23 until nanoSite.match(/^[a-z-]+/)
@@ -35,6 +35,13 @@
35 35 puts "\nEnter the App Name:"
36 36 appName = gets.chomp
37 37
  38 +# Ask the user if the nanosite is private
  39 +until userInput.match(/[y|n]/)
  40 + puts "\nIs the nanosite private? (y/n)"
  41 + userInput = gets.chomp
  42 + configPrivate = userInput.eql?('y') ? 'YES' : 'NO'
  43 +end
  44 +
38 45 ####
39 46 # Each dictionary in the recipe's array is a 'clump' of code changes
40 47 # :file == Path to Class file
@@ -47,7 +54,7 @@
47 54 ####
48 55 recipes = [
49 56 # Add logo title image, along with resizing logic for portrait/landscape
50   - { :file => 'Classes/Config.h',
  57 + { :file => 'Classes/Config.h',
51 58 :pattern => /\/\*EAOConfig\*\//,
52 59 :ingredient => "#{configName},\n" + "\s" * 4 + "/*EAOConfig*/" },
53 60
@@ -55,63 +62,63 @@
55 62 { :file => 'Classes/GuideIntroViewController.m',
56 63 :pattern => /\/\*EAOGuideIntro\*\//,
57 64 :ingredient => "case #{configName}:\n" +
58   - "\t" * 4 + "image = [UIImage imageNamed:@\"logo_#{nanoSite}.png\"];\n" +
59   - "\t" * 4 + "headerImageLogo.frame = CGRectMake(headerImageLogo.frame.origin.x, headerImageLogo.frame.origin.y, image.size.width, image.size.height);\n" +
60   - "\t" * 4 + "headerImageLogo.image = image;\n" +
61   - "\t" * 4 + "[image release];\n" +
62   - "\t" * 4 + "break;\n\t" + "\t" * 2 + "/*EAOGuideIntro*/" },
  65 + "\s" * 16 + "image = [UIImage imageNamed:@\"logo_#{nanoSite}.png\"];\n" +
  66 + "\s" * 16 + "headerImageLogo.frame = CGRectMake(headerImageLogo.frame.origin.x, headerImageLogo.frame.origin.y, image.size.width, image.size.height);\n" +
  67 + "\s" * 16 + "headerImageLogo.image = image;\n" +
  68 + "\s" * 16 + "[image release];\n" +
  69 + "\s" * 16 + "break;\n" + "\s" * 12 + "/*EAOGuideIntro*/" },
63 70
64 71 # Add config settings such as base url and other options
65 72 { :file => 'Classes/Config.m',
66 73 :pattern => /\/\*EAOOptions\*\//,
67 74 :ingredient => "case #{configName}:\n" +
68   - "\t" * 3 + "self.host = @\"#{nanoSite}.dozuki.com\";\n" +
69   - "\t" * 3 + "self.baseURL = @\"http://#{nanoSite}.dozuki.com\";\n" +
70   - "\t" * 3 + "answersEnabled = NO;\n" +
71   - "\t" * 3 + "collectionsEnabled = NO;\n" +
72   - "\t" * 3 + "self.store = nil;\n" +
73   - "\t" * 3 + "break;\n" + "\t" * 2 + "/*EAOOptions*/" },
  75 + "\s" * 12 + "self.host = @\"#{nanoSite}.dozuki.com\";\n" +
  76 + "\s" * 12 + "self.baseURL = @\"http://#{nanoSite}.dozuki.com\";\n" +
  77 + "\s" * 12 + "answersEnabled = NO;\n" +
  78 + "\s" * 12 + "collectionsEnabled = NO;\n" +
  79 + "\s" * 12 + "self.store = nil;\n" +
  80 + "\s" * 12 + "self.private = #{configPrivate};\n" +
  81 + "\s" * 12 + "break;\n" + "\s" * 8 + "/*EAOOptions*/" },
74 82
75 83 # Add title image logo and resizing logic for title image logo
76 84 { :file => 'Classes/CategoriesViewController.m',
77 85 :pattern => [ /\/\*EAOTitle\*\//, /\/\*EAOLandscapeResize\*\//, /\/\*EAOPortraitResize\*\// ],
78 86 :ingredient => [ "case #{configName}:\n" +
79   - "\t" * 4 + "titleImage = [UIImage imageNamed:@\"titleImage#{nanoSite.capitalize}.png\"];\n" +
80   - "\t" * 4 + "imageTitle = [[UIImageView alloc] initWithImage:titleImage];\n" +
81   - "\t" * 4 + "self.navigationItem.titleView = imageTitle;\n" +
82   - "\t" * 4 + "[imageTitle release];\n" +
83   - "\t" * 4 + "[titleImage release];\n" + "\t" * 4 + "break;\n" +
84   - "\t" * 3 + "/*EAOTitle*/",
  87 + "\s" * 16 + "titleImage = [UIImage imageNamed:@\"titleImage#{nanoSite.capitalize}.png\"];\n" +
  88 + "\s" * 16 + "imageTitle = [[UIImageView alloc] initWithImage:titleImage];\n" +
  89 + "\s" * 16 + "self.navigationItem.titleView = imageTitle;\n" +
  90 + "\s" * 16 + "[titleImage release];\n" + "\s" * 16 + "break;\n" +
  91 + "\s" * 12 + "/*EAOTitle*/",
85 92 "case #{configName}:\n" +
86   - "\t" * 4 + "frame = self.navigationItem.titleView.frame;\n" +
87   - "\t" * 4 + "frame.size.width = 0.0;\n" +
88   - "\t" * 4 + "frame.size.height = 0.0;\n" +
89   - "\t" * 4 + "self.navigationItem.titleView.frame = frame;\n" + "\t" * 4 +
90   - "break;\n" + "\t" * 3 + "/*EAOLandscapeResize*/",
  93 + "\s" * 16 + "frame = self.navigationItem.titleView.frame;\n" +
  94 + "\s" * 16 + "frame.size.width = 0.0;\n" +
  95 + "\s" * 16 + "frame.size.height = 0.0;\n" +
  96 + "\s" * 16 + "self.navigationItem.titleView.frame = frame;\n" + "\s" * 16 +
  97 + "break;\n" + "\s" * 12 + "/*EAOLandscapeResize*/",
91 98 "case #{configName}:\n" +
92   - "\t" * 4 + "frame = self.navigationItem.titleView.frame;\n" +
93   - "\t" * 4 + "frame.size.width = 0.0;\n" +
94   - "\t" * 4 + "frame.size.height = 0.0;\n" +
95   - "\t" * 4 + "self.navigationItem.titleView.frame = frame;\n" + "\t" * 4 +
96   - "break;\n" + "\t" * 3 + "/*EAOPortraitResize*/" ] },
  99 + "\s" * 16 + "frame = self.navigationItem.titleView.frame;\n" +
  100 + "\s" * 16 + "frame.size.width = 0.0;\n" +
  101 + "\s" * 16 + "frame.size.height = 0.0;\n" +
  102 + "\s" * 16 + "self.navigationItem.titleView.frame = frame;\n" + "\s" * 16 +
  103 + "break;\n" + "\s" * 12 + "/*EAOPortraitResize*/" ] },
97 104
98 105 # Add large background iPad logo and resizing logic for logo
99 106 { :file => 'Classes/DetailIntroViewController.m',
100 107 :pattern => [ /\/\*EAOLandscape\*\//, /\/\*EAOPortrait\*\//, /\/\*EAOiPadLogo\*\// ],
101 108 :ingredient => [ "case #{configName}:\n" +
102   - "\t" * 4 + "frame.origin.y = 0.0;\n" +
103   - "\t" * 4 + "frame.origin.x = 0.0;\n" +
104   - "\t" * 4 + "break;\n\t" + "\t" * 2 + "/*EAOLandscape*/",
  109 + "\s" * 16 + "frame.origin.y = 0.0;\n" +
  110 + "\s" * 16 + "frame.origin.x = 0.0;\n" +
  111 + "\s" * 16 + "break;\n" + "\s" * 12 + "/*EAOLandscape*/",
105 112 "case #{configName}:\n" +
106   - "\t" * 4 + "frame.origin.y = 0.0;\n" +
107   - "\t" * 4 + "frame.origin.x = 0.0;\n" +
108   - "\t" * 4 + "break;\n\t" + "\t" * 2 + "/*EAOPortrait*/",
  113 + "\s" * 16 + "frame.origin.y = 0.0;\n" +
  114 + "\s" * 16 + "frame.origin.x = 0.0;\n" +
  115 + "\s" * 16 + "break;\n" + "\s" * 12 + "/*EAOPortrait*/",
109 116 "case #{configName}:\n" +
110   - "\t" * 3 + "image.image = [UIImage imageNamed:@\"#{nanoSite}_logo_transparent.png\"];\n" +
111   - "\t" * 3 + "image.frame = CGRectMake(image.frame.origin.x, image.frame.origin.y, 0.0, 0.0);\n" +
112   - "\t" * 3 + "image.center = self.view.center;\n" +
113   - "\t" * 3 + "text.image = [UIImage imageNamed:@\"detailViewText#{nanoSite.capitalize}.png\"];\n" +
114   - "\t" * 3 + "break;\n" + "\t" * 2 + "/*EAOiPadLogo*/" ] },
  117 + "\s" * 12 + "image.image = [UIImage imageNamed:@\"#{nanoSite}_logo_transparent.png\"];\n" +
  118 + "\s" * 12 + "image.frame = CGRectMake(image.frame.origin.x, image.frame.origin.y, 0.0, 0.0);\n" +
  119 + "\s" * 12 + "image.center = self.view.center;\n" +
  120 + "\s" * 12 + "text.image = [UIImage imageNamed:@\"detailViewText#{nanoSite.capitalize}.png\"];\n" +
  121 + "\s" * 12 + "break;\n" + "\s" * 8 + "/*EAOiPadLogo*/" ] },
115 122
116 123 # Add code to our bash script that switches between iOS apps
117 124 { :file => 'dozuki.sh',

0 comments on commit cf2d127

Please sign in to comment.
Something went wrong with that request. Please try again.