zuckermo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feef88c44599df583a08a5ee88ea6a09cf6861fc
4
- data.tar.gz: b1732bb2765e50dea642bb256633545c9504218e
3
+ metadata.gz: 6f7ba3d8cf28f49471f9c5f694831ef277fc5d0b
4
+ data.tar.gz: eca59206eb095baa14b94ce5874b49d2118be9fb
5
5
  SHA512:
6
- metadata.gz: e3103e463ef45cee931ba02f85776b1cba7ea86ce8f3f9feacdfbe7754b5ed860810929541d575f6f876ff7d9050d5f98efe7f30a8de22a60ed8981ebb89e77f
7
- data.tar.gz: 0258481f673bf66eb0fe2c45985cb9f318813a599422c37444bde4f005b15e10ea79f3d8da33685a08c58a1ec7aa643ef78dfb03a773896182a8d2a81e35f5da
6
+ metadata.gz: 1cb5fb0cdaddf116baa247ac24edcf550a1c1ee39645ca05d369f639333851dba0945981aa37bf50215ac549508db9505626b5800b719a672297905041d9d8e7
7
+ data.tar.gz: 148c0bdd9145db908b3e2f4c01d6e12377d6365cfac8166f2e20d65eaf54614485d8b2e52de3232ef8cbfcae56de1a7f0564e975b07d5409e8980f6781a46d60
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ build
4
4
  resources/*.nib
5
5
  resources/*.momd
6
6
  resources/*.storyboardc
7
+ pkg/*
data/Rakefile CHANGED
@@ -12,4 +12,5 @@ Motion::Project::App.setup do |app|
12
12
  # Use `rake config' to see complete project settings.
13
13
  app.name = 'Zuckermo'
14
14
  app.identifier = 'com.zuckermo.test'
15
+ app.info_plist['APP_ID'] = ENV['APP_ID']
15
16
  end
data/app/app_delegate.rb CHANGED
@@ -13,7 +13,7 @@ class AppDelegate
13
13
  @label.setText '...'
14
14
  @controller.view.addSubview @label
15
15
 
16
- Facebook.app_id = ENV['APP_ID']
16
+ Facebook.app_id = NSBundle.mainBundle.objectForInfoDictionaryKey('APP_ID')
17
17
  Facebook.sign_in do |granted, error|
18
18
  if granted
19
19
  @label.setText Facebook.accounts[0].username
data/lib/zuckermo.rb CHANGED
@@ -7,8 +7,11 @@ end
7
7
  require 'bubble-wrap'
8
8
 
9
9
  Motion::Project::App.setup do |app|
10
+
10
11
  Dir.glob(File.join(File.dirname(__FILE__), '../motion/**/*.rb')).each do |file|
11
12
  app.files.unshift(file)
12
13
  end
13
14
  app.frameworks += ["Facebook", "Accounts"]
15
+ app.deployment_target = "5.1"
16
+
14
17
  end
@@ -1,3 +1,3 @@
1
1
  module Zuckermo
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -10,33 +10,55 @@ module Zuckermo
10
10
  attr_accessor :app_id
11
11
  attr_reader :account_store
12
12
 
13
- def account_type
14
- self.account_store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierFacebook)
15
- end
13
+ if defined?(ACAccountTypeIdentifierFacebook) #Check's for iOS6
16
14
 
17
- def accounts
18
- self.account_store.accountsWithAccountType(account_type).collect do |ac_account|
19
- Zuckermo::User.new ac_account
15
+ def account_type
16
+ self.account_store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierFacebook)
17
+ end
18
+
19
+ def accounts
20
+ (self.account_store.accountsWithAccountType(account_type) || []).collect do |ac_account|
21
+ Zuckermo::User.new ac_account
22
+ end
20
23
  end
21
- end
22
24
 
23
- def sign_in permissions, audience, &block
24
- @permissions, @audience, @callback = permissions, audience, block
25
-
26
- @options =
27
- {
28
- ACFacebookAppIdKey => @app_id,
29
- ACFacebookPermissionsKey => @permissions
30
- }
31
-
32
- self.account_store.requestAccessToAccountsWithType( self.account_type,
33
- options: @options,
34
- completion: -> granted, error do
35
- Dispatch::Queue.main.sync do
36
- @callback.call(granted, error)
37
- end
38
- end
39
- )
25
+ def sign_in permissions, audience, &block
26
+ @permissions, @audience, @callback = permissions, audience, block
27
+
28
+ if accounts.size > 0
29
+
30
+ @options =
31
+ {
32
+ ACFacebookAppIdKey => @app_id,
33
+ ACFacebookPermissionsKey => @permissions
34
+ }
35
+
36
+ self.account_store.requestAccessToAccountsWithType( self.account_type,
37
+ options: @options,
38
+ completion: -> granted, error do
39
+ Dispatch::Queue.main.sync do
40
+ @callback.call(granted, error)
41
+ end
42
+ end
43
+ )
44
+ else
45
+ @callback.call false, NSError.alloc.initWithDomain( 'com.zuckermo.no_accounts', code: 0, userInfo: nil )
46
+ end
47
+ end
48
+
49
+ else # We currently don't support iOS5
50
+
51
+ def account_type
52
+ raise NotImplemented
53
+ end
54
+
55
+ def accounts
56
+ []
57
+ end
58
+
59
+ def sign_in permissions, audience, &block
60
+ block.call false, NotImplemented
61
+ end
40
62
  end
41
63
 
42
64
  end
data/spec/main_spec.rb CHANGED
@@ -6,11 +6,15 @@ describe "Accessing a Facebook account" do
6
6
  end
7
7
 
8
8
  it 'allows us to retrieve the users name' do
9
- wait 1 do
10
- tap 'ok'
11
- end
12
- wait 1 do
9
+ if Facebook.accounts.size > 0
10
+ wait 1 do
11
+ tap 'ok'
12
+ end
13
+ wait 1
13
14
  view('username').text.should.equal ENV['USER']
15
+ else
16
+ warn "\n\n!!!!!!!!!!!!!\n\n No acounts on simulator"
17
+ view('username').text.should.equal 'Fail... See Log'
14
18
  end
15
19
  end
16
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuckermo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
@@ -29,7 +29,7 @@ cert_chain:
29
29
  2feWfO4gCNmvfFjULOAYHq9JHEjN5SLSXvj5HdSnDcCyIfJKn5Ya3JahWQaWIsXf
30
30
  /NPE/mB57TOwj+d7XUa2NC4HUadF8R51IYEcIB0PpIEzJlKtfXFcOZxO
31
31
  -----END CERTIFICATE-----
32
- date: 2013-05-22 00:00:00.000000000 Z
32
+ date: 2013-05-23 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: bubble-wrap
metadata.gz.sig CHANGED
Binary file