Permalink
Browse files

軽くApplicaitonUser組み込み。まだTODO多し

  • Loading branch information...
1 parent a69c66e commit 79f904b9de6aee61db07ee7c2d7a5a11d8dbd3f8 @naoya committed Aug 21, 2012
Showing with 27 additions and 10 deletions.
  1. +9 −0 Rakefile
  2. +5 −3 app/account_config_view_controller.rb
  3. +9 −1 app/app_delegate.rb
  4. +4 −6 app/application_user.rb
View
9 Rakefile
@@ -11,9 +11,18 @@ require 'bubble-wrap/http'
require 'formotion'
require 'sugarcube'
+
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'HBFav2'
+
+ ## Keychain
+ # app.frameworks += ['Security']
+ # app.vendor_project('vendor/GenericKeychain', :xcode,
+ # :headers_dir => 'GenericKeychain')
+ # app.entitlements['keychain-access-groups'] = [
+ # app.seed_id + '.' + app.identifier
+ # ]
end
desc "Checks the syntax"
View
8 app/account_config_view_controller.rb
@@ -13,6 +13,7 @@ def init
placeholder: '必須',
auto_correction: :no,
auto_capitalization: :none,
+ value: 'naoya' # FIXME
},
{
title: "パスワード",
@@ -53,9 +54,10 @@ def cancel
def save
data = self.form.render
- ## なんでキーが string なんだ・・・
- puts data["hatena_id"]
- puts data["password"]
+ user = ApplicationUser.new
+ user.hatena_id = data["hatena_id"]
+ user.password = data["password"] || nil
+ user.save
self.dismissModalViewControllerAnimated(true)
end
View
10 app/app_delegate.rb
@@ -1,9 +1,17 @@
+# -*- coding: utf-8 -*-
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds).tap do |w|
w.rootViewController = UINavigationController.alloc.initWithRootViewController(
TimelineViewController.new.tap do |c|
- c.user = User.new({ :name => 'naoya' })
+ app_user = ApplicationUser.new
+ app_user.load
+
+ # FIXME: 管理画面から初期化できるようになったら消す
+ app_user.hatena_id ||= 'naoya'
+
+ # FIXME: User と ApplicationUser の関係整理
+ c.user = User.new({ :name => app_user.hatena_id })
c.feed_url = c.user.timeline_feed_url
c.as_home = true
end
View
10 app/application_user.rb
@@ -7,17 +7,15 @@ def initialize
end
def save
- App::Persistence['applicatoin_user'] = {
- :hatena_id => @hatena_id,
- :password => @password
- }
+ App::Persistence['hatena_id'] = @hatena_id
+ App::Persistence['password'] = @password
self
end
def load
user = App::Persistence['applicatoin_user'] || {}
- self.hatena_id = user[:hatena_id]
- self.password = user[:password]
+ self.hatena_id = App::Persistence['hatena_id']
+ self.password = App::Persistence['password']
self
end

0 comments on commit 79f904b

Please sign in to comment.