zuckermo 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f7ba3d8cf28f49471f9c5f694831ef277fc5d0b
4
- data.tar.gz: eca59206eb095baa14b94ce5874b49d2118be9fb
3
+ metadata.gz: 15862040247ad3843f1b6a5c89daf9be6770d2c7
4
+ data.tar.gz: 5f63569a8bcabed9b8c1ac3e775d7dcc6784f0ba
5
5
  SHA512:
6
- metadata.gz: 1cb5fb0cdaddf116baa247ac24edcf550a1c1ee39645ca05d369f639333851dba0945981aa37bf50215ac549508db9505626b5800b719a672297905041d9d8e7
7
- data.tar.gz: 148c0bdd9145db908b3e2f4c01d6e12377d6365cfac8166f2e20d65eaf54614485d8b2e52de3232ef8cbfcae56de1a7f0564e975b07d5409e8980f6781a46d60
6
+ metadata.gz: f282997f04544da3b75fc8f3a280ad7fe8963c15a1df8efe4a59372d35913a988d9f2a68343bde955911359eb25e081e88e39620c28e5b1297141393c4581cf1
7
+ data.tar.gz: cb7f7e4bca9ea98c2141dc958d99f314ce1aef123bafb1eb7b53840f605bbe6625ba1a6b5b2914b1cf9f3655dad9683968602ef008e72e38cd0243c38f4573f8
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Rakefile CHANGED
@@ -13,4 +13,5 @@ Motion::Project::App.setup do |app|
13
13
  app.name = 'Zuckermo'
14
14
  app.identifier = 'com.zuckermo.test'
15
15
  app.info_plist['APP_ID'] = ENV['APP_ID']
16
+ app.deployment_target = "5.1"
16
17
  end
data/lib/zuckermo.rb CHANGED
@@ -8,10 +8,12 @@ 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
+ root = File.join( File.dirname(__FILE__), '../motion' )
12
+ zuckermo_files = Dir.glob root+'/**/*.rb'
13
+
14
+ %W[#{root}/pollute.rb #{root}/facebook.rb #{root}/zuckermo.rb] + zuckermo_files.each do |file|
12
15
  app.files.unshift(file)
13
16
  end
14
- app.frameworks += ["Facebook", "Accounts"]
15
- app.deployment_target = "5.1"
17
+ app.weak_frameworks += ["Social","Accounts"]
16
18
 
17
19
  end
@@ -1,3 +1,3 @@
1
1
  module Zuckermo
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/motion/pollute.rb CHANGED
@@ -6,4 +6,4 @@ end
6
6
  class ACAccount
7
7
  alias_method :account_description, :accountDescription
8
8
  alias_method :account_type, :accountType
9
- end
9
+ end
@@ -10,56 +10,52 @@ module Zuckermo
10
10
  attr_accessor :app_id
11
11
  attr_reader :account_store
12
12
 
13
- if defined?(ACAccountTypeIdentifierFacebook) #Check's for iOS6
13
+ def facebook_supported?
14
+ UIDevice.currentDevice.systemVersion.to_f >= 6
15
+ end
14
16
 
15
- def account_type
17
+ def account_type
18
+ if facebook_supported?
16
19
  self.account_store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierFacebook)
20
+ else
21
+ nil
17
22
  end
23
+ end
18
24
 
19
- def accounts
20
- (self.account_store.accountsWithAccountType(account_type) || []).collect do |ac_account|
21
- Zuckermo::User.new ac_account
22
- end
25
+ def accounts
26
+ (self.account_store.accountsWithAccountType(account_type) || []).collect do |ac_account|
27
+ Zuckermo::User.new ac_account
23
28
  end
29
+ end
24
30
 
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
31
+ def sign_in permissions, audience, &block
32
+ @permissions, @audience, @callback = permissions, audience, block
33
+
34
+ if facebook_supported?
35
+ @options =
36
+ {
37
+ ACFacebookAppIdKey => @app_id,
38
+ ACFacebookPermissionsKey => @permissions
39
+ }
40
+
41
+ self.account_store.requestAccessToAccountsWithType( self.account_type,
42
+ options: @options,
43
+ completion: -> granted, error do
44
+ Dispatch::Queue.main.sync do
45
+ @callback.call(granted, error)
42
46
  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
47
+ end
48
+ )
49
+ else
50
+ @callback.call false, unsupported_error
53
51
  end
52
+ end
54
53
 
55
- def accounts
56
- []
57
- end
54
+ private
58
55
 
59
- def sign_in permissions, audience, &block
60
- block.call false, NotImplemented
56
+ def unsupported_error
57
+ NSError.errorWithDomain('com.zuckermo.unsupported_ios_version', code: 0, userInfo:nil)
61
58
  end
62
- end
63
59
 
64
60
  end
65
61
  end
data/spec/main_spec.rb CHANGED
@@ -8,10 +8,10 @@ describe "Accessing a Facebook account" do
8
8
  it 'allows us to retrieve the users name' do
9
9
  if Facebook.accounts.size > 0
10
10
  wait 1 do
11
- tap 'ok'
11
+ tap 'OK'
12
12
  end
13
13
  wait 1
14
- view('username').text.should.equal ENV['USER']
14
+ view('username').text.should.equal ENV['FBUSER']
15
15
  else
16
16
  warn "\n\n!!!!!!!!!!!!!\n\n No acounts on simulator"
17
17
  view('username').text.should.equal 'Fail... See Log'
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.2
4
+ version: 0.0.3
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-23 00:00:00.000000000 Z
32
+ date: 2013-05-24 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