Skip to content
This repository
Browse code

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

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

0 comments on commit 79f904b

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