motion-assets-library 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/project/assets_library/saver.rb +38 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b6fb3218483cf20bff7f519846017d7d75b0835
|
4
|
+
data.tar.gz: 840e892fe3c6ca95cf1990d13c680e4874c9e41b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08fa4f900b8fd7763b00c9a6d323e24f6b91b700f57f3b97294dd64fccae9a63280f4c3f63854b6b7da37d5de6f51b6bcf202950a1ebd460dad656dd34d57545
|
7
|
+
data.tar.gz: 9dc5c28d6570cf2f3d586e41f341fcaed0f18b388164447804a7628e69ffad69951c6fb4c5f3db08ea066e7f8a07fcee2be248f3696686a345c30da3508c6a19
|
@@ -26,22 +26,51 @@ class Motion
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def save_image_data(image_data, &block)
|
30
|
+
save_image_data(image_data, to_album: nil, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def save_image_data(image_data, to_album: album_name, &block)
|
34
|
+
@success_callback = block
|
35
|
+
@album_found = false
|
36
|
+
|
37
|
+
if access_denied?
|
38
|
+
denied_callback.call if denied_callback
|
39
|
+
else
|
40
|
+
do_save_data(image_data, album: album_name)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
29
44
|
private
|
30
45
|
|
31
46
|
def do_save(image, album: album_name)
|
32
47
|
asset_url = nil
|
33
48
|
|
34
|
-
asset_url = assets_library.writeImageToSavedPhotosAlbum(
|
49
|
+
asset_url = assets_library.writeImageToSavedPhotosAlbum(
|
50
|
+
image.CGImage,
|
35
51
|
orientation: image.imageOrientation,
|
36
|
-
completionBlock:
|
37
|
-
|
38
|
-
failure_callback.call(error) if failure_callback
|
39
|
-
else
|
40
|
-
add_asset_url(asset_url, to_album: album_name) if album_name
|
52
|
+
completionBlock: write_image_block(album_name))
|
53
|
+
end
|
41
54
|
|
42
|
-
|
43
|
-
|
44
|
-
|
55
|
+
def do_save_data(image_data, album: album_name)
|
56
|
+
asset_url = nil
|
57
|
+
|
58
|
+
asset_url = assets_library.writeImageDataToSavedPhotosAlbum(
|
59
|
+
image_data,
|
60
|
+
metadata: nil,
|
61
|
+
completionBlock: write_image_block(album_name))
|
62
|
+
end
|
63
|
+
|
64
|
+
def write_image_block(album_name)
|
65
|
+
lambda { |asset_url, error|
|
66
|
+
if error
|
67
|
+
failure_callback.call(error) if failure_callback
|
68
|
+
else
|
69
|
+
add_asset_url(asset_url, to_album: album_name) if album_name
|
70
|
+
|
71
|
+
success_callback.call(asset_url) if success_callback
|
72
|
+
end
|
73
|
+
}
|
45
74
|
end
|
46
75
|
|
47
76
|
def album_found?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-assets-library
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Devon Blandin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|