Commit 23e3da6
Changed files (5)
app
app/controllers/listing_controller.rb
@@ -1,16 +0,0 @@
-class ListingController < UIViewController
-
- def viewDidLoad
- super
- self.view.backgroundColor = UIColor.whiteColor
- self.title = "Latest Reviews"
-
- rightButton = UIBarButtonItem.alloc.initWithTitle("Share", style: UIBarButtonItemStyleBordered, target: self, action: 'push')
- self.navigationItem.rightBarButtonItem = rightButton
- end
-
- def push
- new_controller = RestaurantController.alloc.initWithNibName(nil, bundle: nil)
- self.navigationController.pushViewController(new_controller, animated: true)
- end
-end
app/controllers/restaurant_controller.rb
@@ -32,22 +32,5 @@ class RestaurantController < UIViewController
puts e.backtrace.inspect
end
end
-
- #access_twitter
- end
-
- def access_twitter
- @account_repository = ACAccountStore.alloc.init
- @twitter_account_type = @account_repository.accountTypeWithAccountTypeIdentifier ACAccountTypeIdentifierTwitter
- @account_repository.requestAccessToAccountsWithType @twitter_account_type, options:nil, completion: lambda { |granted, error|
- if granted
- @accounts = @account_repository.accountsWithAccountType @twitter_account_type
- p "ID: #{@accounts.first.accountProperties['user_id']} #{@accounts.first.username}"
-
- puts "GRANTED ACCESS"
- else
- puts "NOT GRANTED"
- end
- }
end
end
app/controllers/search_controller.rb
@@ -0,0 +1,12 @@
+class SearchController < UIViewController
+ def viewDidLoad
+ super
+ self.view.backgroundColor = UIColor.whiteColor
+ self.title = "Latest Reviews"
+ self.navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithTitle("Share", style: UIBarButtonItemStyleBordered, target: self, action: 'push')
+ end
+
+ def push
+ self.navigationController.pushViewController(RestaurantController.alloc.initWithNibName(nil, bundle: nil), animated: true)
+ end
+end
app/models/twitter_spike.rb
@@ -0,0 +1,16 @@
+class TwitterSpike
+ def run
+ @account_repository = ACAccountStore.alloc.init
+ @twitter_account_type = @account_repository.accountTypeWithAccountTypeIdentifier ACAccountTypeIdentifierTwitter
+ @account_repository.requestAccessToAccountsWithType @twitter_account_type, options:nil, completion: lambda { |granted, error|
+ if granted
+ @accounts = @account_repository.accountsWithAccountType @twitter_account_type
+ p "ID: #{@accounts.first.accountProperties['user_id']} #{@accounts.first.username}"
+
+ puts "GRANTED ACCESS"
+ else
+ puts "NOT GRANTED"
+ end
+ }
+ end
+end
app/app_delegate.rb
@@ -1,11 +1,7 @@
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
-
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
- @location_controller = ListingController.alloc.initWithNibName(nil, bundle:nil)
- @navigation_controller = UINavigationController.alloc.initWithRootViewController(@location_controller)
-
- @window.rootViewController = @navigation_controller
+ @window.rootViewController = UINavigationController.alloc.initWithRootViewController(SearchController.alloc.initWithNibName(nil, bundle:nil))
@window.makeKeyAndVisible
true
end