motion-assets-library 1.3.0 → 1.3.1
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 +17 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16e9bcd714d565dd822c7085bb6d5d975d7bed0b
|
4
|
+
data.tar.gz: 14979958de66700c941139c38167e057961083ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eac8e6d1c0f5ecad6ce24687b08694e67b6866875ad59847b1de085322b054c878e6ce279d33d9ccf0b6cb775e895c2b45618cd5ad5f236aec8c61466069718d
|
7
|
+
data.tar.gz: c15a908d5a7f838d7862d318e237f4b50fe15a1f814ea0aab7b3c2bf28c2929b50d6e61d1d4f0a046dd688391a4cc06fefd0748ec63bd6033e18e3aa6cebe052
|
@@ -17,6 +17,7 @@ class Motion
|
|
17
17
|
|
18
18
|
def save(image, to_album: album_name, &block)
|
19
19
|
@success_callback = block
|
20
|
+
@album_found = false
|
20
21
|
|
21
22
|
if access_denied?
|
22
23
|
denied_callback.call if denied_callback
|
@@ -43,24 +44,28 @@ class Motion
|
|
43
44
|
})
|
44
45
|
end
|
45
46
|
|
46
|
-
def
|
47
|
-
album_found
|
47
|
+
def album_found?
|
48
|
+
!!@album_found
|
49
|
+
end
|
48
50
|
|
51
|
+
def add_asset_url(asset_url, to_album: album_name)
|
49
52
|
assets_library.enumerateGroupsWithTypes(ALAssetsGroupAlbum, usingBlock: lambda { |group, stop|
|
50
|
-
if group
|
51
|
-
|
52
|
-
|
53
|
-
assets_library.assetForURL(asset_url, resultBlock: lambda { |asset|
|
54
|
-
group.addAsset(asset)
|
55
|
-
}, failureBlock: nil)
|
56
|
-
end
|
53
|
+
if group
|
54
|
+
if album_name === group.valueForProperty(ALAssetsGroupPropertyName)
|
55
|
+
@album_found = true
|
57
56
|
|
58
|
-
if album_found == false
|
59
|
-
assets_library.addAssetsGroupAlbumWithName(album_name, resultBlock: lambda { |group|
|
60
57
|
assets_library.assetForURL(asset_url, resultBlock: lambda { |asset|
|
61
58
|
group.addAsset(asset)
|
62
59
|
}, failureBlock: nil)
|
63
|
-
|
60
|
+
end
|
61
|
+
else
|
62
|
+
unless album_found?
|
63
|
+
assets_library.addAssetsGroupAlbumWithName(album_name, resultBlock: lambda { |new_group|
|
64
|
+
assets_library.assetForURL(asset_url, resultBlock: lambda { |asset|
|
65
|
+
new_group.addAsset(asset)
|
66
|
+
}, failureBlock: nil)
|
67
|
+
}, failureBlock: nil)
|
68
|
+
end
|
64
69
|
end
|
65
70
|
}, failureBlock: nil)
|
66
71
|
end
|