Skip to content

Commit d2cf657

Browse files
committed
Added Thumbnail and Meta-information generator to Local and Dropbox
1 parent f2d54c7 commit d2cf657

10 files changed

Lines changed: 768 additions & 18 deletions

FileProvider.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "FileProvider"
19-
s.version = "0.8.3"
19+
s.version = "0.9.0"
2020
s.summary = "FileManager replacement for Local and Remote (WebDAV/Dropbox/SMB2) files on iOS and macOS."
2121

2222
# This description is used to generate tags and improve search results.

FileProvider.xcodeproj/project.pbxproj

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@
9292
799396E01D48C02300086753 /* WebDAVFileProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799396A61D48C02300086753 /* WebDAVFileProvider.swift */; };
9393
799396E11D48C02300086753 /* WebDAVFileProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799396A61D48C02300086753 /* WebDAVFileProvider.swift */; };
9494
799396E21D48C02300086753 /* WebDAVFileProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799396A61D48C02300086753 /* WebDAVFileProvider.swift */; };
95+
79BD638C1E2CC2300035128C /* ExtendedLocalFileProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD638B1E2CC2300035128C /* ExtendedLocalFileProvider.swift */; };
96+
79BD638D1E2CC2300035128C /* ExtendedLocalFileProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD638B1E2CC2300035128C /* ExtendedLocalFileProvider.swift */; };
97+
79BD638E1E2CC2300035128C /* ExtendedLocalFileProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BD638B1E2CC2300035128C /* ExtendedLocalFileProvider.swift */; };
98+
79BD63A81E2CC2940035128C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63A71E2CC2940035128C /* CoreGraphics.framework */; };
99+
79BD63AA1E2CC2BB0035128C /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63A91E2CC2BB0035128C /* AVFoundation.framework */; };
100+
79BD63AC1E2CC2C20035128C /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63AB1E2CC2C20035128C /* ImageIO.framework */; };
101+
79BD63AE1E2CC2EB0035128C /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63AD1E2CC2EB0035128C /* MediaPlayer.framework */; };
102+
79BD63B01E2CC3300035128C /* libxml2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63AF1E2CC3300035128C /* libxml2.tbd */; };
103+
79BD63B21E2CC3350035128C /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63B11E2CC3350035128C /* ImageIO.framework */; };
104+
79BD63B41E2CC33D0035128C /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63B31E2CC33D0035128C /* MediaPlayer.framework */; };
105+
79BD63B61E2CC3860035128C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63B51E2CC3860035128C /* CoreFoundation.framework */; };
106+
79BD63B81E2CC38D0035128C /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63B71E2CC38D0035128C /* AVFoundation.framework */; };
107+
79BD63BA1E2CC39B0035128C /* libxml2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63B91E2CC39B0035128C /* libxml2.tbd */; };
108+
79BD63BC1E2CC3B90035128C /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63BB1E2CC3B90035128C /* MediaPlayer.framework */; };
109+
79BD63BE1E2CC3C20035128C /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63BD1E2CC3C20035128C /* ImageIO.framework */; };
110+
79BD63C01E2CC3CD0035128C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63BF1E2CC3CD0035128C /* CoreGraphics.framework */; };
111+
79BD63C21E2CC3D30035128C /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79BD63C11E2CC3D30035128C /* AVFoundation.framework */; };
95112
79F5745B1DFDB10B00179ABF /* FileObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F5745A1DFDB10A00179ABF /* FileObject.swift */; };
96113
79F5745C1DFDB10B00179ABF /* FileObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F5745A1DFDB10A00179ABF /* FileObject.swift */; };
97114
79F5745D1DFDB10B00179ABF /* FileObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F5745A1DFDB10A00179ABF /* FileObject.swift */; };
@@ -134,6 +151,21 @@
134151
799396A31D48C02300086753 /* SMB2Types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SMB2Types.swift; sourceTree = "<group>"; };
135152
799396A41D48C02300086753 /* SMBErrorType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SMBErrorType.swift; sourceTree = "<group>"; };
136153
799396A61D48C02300086753 /* WebDAVFileProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebDAVFileProvider.swift; sourceTree = "<group>"; };
154+
79BD638B1E2CC2300035128C /* ExtendedLocalFileProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtendedLocalFileProvider.swift; sourceTree = "<group>"; };
155+
79BD63A71E2CC2940035128C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
156+
79BD63A91E2CC2BB0035128C /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
157+
79BD63AB1E2CC2C20035128C /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; };
158+
79BD63AD1E2CC2EB0035128C /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
159+
79BD63AF1E2CC3300035128C /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = usr/lib/libxml2.tbd; sourceTree = SDKROOT; };
160+
79BD63B11E2CC3350035128C /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
161+
79BD63B31E2CC33D0035128C /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
162+
79BD63B51E2CC3860035128C /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
163+
79BD63B71E2CC38D0035128C /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
164+
79BD63B91E2CC39B0035128C /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.1.sdk/usr/lib/libxml2.tbd; sourceTree = DEVELOPER_DIR; };
165+
79BD63BB1E2CC3B90035128C /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
166+
79BD63BD1E2CC3C20035128C /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.1.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; };
167+
79BD63BF1E2CC3CD0035128C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
168+
79BD63C11E2CC3D30035128C /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.1.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
137169
79F5745A1DFDB10A00179ABF /* FileObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileObject.swift; sourceTree = "<group>"; };
138170
/* End PBXFileReference section */
139171

@@ -142,6 +174,10 @@
142174
isa = PBXFrameworksBuildPhase;
143175
buildActionMask = 2147483647;
144176
files = (
177+
79BD63AA1E2CC2BB0035128C /* AVFoundation.framework in Frameworks */,
178+
79BD63AC1E2CC2C20035128C /* ImageIO.framework in Frameworks */,
179+
79BD63A81E2CC2940035128C /* CoreGraphics.framework in Frameworks */,
180+
79BD63AE1E2CC2EB0035128C /* MediaPlayer.framework in Frameworks */,
145181
791950F51DE58A5400B4426E /* libxml2.tbd in Frameworks */,
146182
);
147183
runOnlyForDeploymentPostprocessing = 0;
@@ -150,13 +186,23 @@
150186
isa = PBXFrameworksBuildPhase;
151187
buildActionMask = 2147483647;
152188
files = (
189+
79BD63B81E2CC38D0035128C /* AVFoundation.framework in Frameworks */,
190+
79BD63B61E2CC3860035128C /* CoreFoundation.framework in Frameworks */,
191+
79BD63B21E2CC3350035128C /* ImageIO.framework in Frameworks */,
192+
79BD63B41E2CC33D0035128C /* MediaPlayer.framework in Frameworks */,
193+
79BD63B01E2CC3300035128C /* libxml2.tbd in Frameworks */,
153194
);
154195
runOnlyForDeploymentPostprocessing = 0;
155196
};
156197
7993967E1D48B82700086753 /* Frameworks */ = {
157198
isa = PBXFrameworksBuildPhase;
158199
buildActionMask = 2147483647;
159200
files = (
201+
79BD63C21E2CC3D30035128C /* AVFoundation.framework in Frameworks */,
202+
79BD63C01E2CC3CD0035128C /* CoreGraphics.framework in Frameworks */,
203+
79BD63BE1E2CC3C20035128C /* ImageIO.framework in Frameworks */,
204+
79BD63BC1E2CC3B90035128C /* MediaPlayer.framework in Frameworks */,
205+
79BD63BA1E2CC39B0035128C /* libxml2.tbd in Frameworks */,
160206
);
161207
runOnlyForDeploymentPostprocessing = 0;
162208
};
@@ -166,6 +212,20 @@
166212
791950F31DE58A5300B4426E /* Frameworks */ = {
167213
isa = PBXGroup;
168214
children = (
215+
79BD63C11E2CC3D30035128C /* AVFoundation.framework */,
216+
79BD63BF1E2CC3CD0035128C /* CoreGraphics.framework */,
217+
79BD63BD1E2CC3C20035128C /* ImageIO.framework */,
218+
79BD63BB1E2CC3B90035128C /* MediaPlayer.framework */,
219+
79BD63B91E2CC39B0035128C /* libxml2.tbd */,
220+
79BD63B71E2CC38D0035128C /* AVFoundation.framework */,
221+
79BD63B51E2CC3860035128C /* CoreFoundation.framework */,
222+
79BD63B31E2CC33D0035128C /* MediaPlayer.framework */,
223+
79BD63B11E2CC3350035128C /* ImageIO.framework */,
224+
79BD63AF1E2CC3300035128C /* libxml2.tbd */,
225+
79BD63AD1E2CC2EB0035128C /* MediaPlayer.framework */,
226+
79BD63AB1E2CC2C20035128C /* ImageIO.framework */,
227+
79BD63A91E2CC2BB0035128C /* AVFoundation.framework */,
228+
79BD63A71E2CC2940035128C /* CoreGraphics.framework */,
169229
791950F41DE58A5400B4426E /* libxml2.tbd */,
170230
);
171231
name = Frameworks;
@@ -186,6 +246,7 @@
186246
7993965B1D48B7BF00086753 = {
187247
isa = PBXGroup;
188248
children = (
249+
79E34A101E2AC6C600E1293B /* Extra */,
189250
799396911D48C02300086753 /* Sources */,
190251
7993968A1D48B8C700086753 /* Pod */,
191252
799396681D48B7F600086753 /* Products */,
@@ -225,6 +286,7 @@
225286
79F5745A1DFDB10A00179ABF /* FileObject.swift */,
226287
799396961D48C02300086753 /* LocalFileProvider.swift */,
227288
792572401DF23BDA006A1526 /* LocalHelper.swift */,
289+
79BD638B1E2CC2300035128C /* ExtendedLocalFileProvider.swift */,
228290
7902C0851D61B56D00564440 /* RemoteSession.swift */,
229291
7924B1A81D89F79200589DB7 /* FPSStreamTask.swift */,
230292
799396971D48C02300086753 /* SMBClient.swift */,
@@ -254,6 +316,13 @@
254316
path = SMBTypes;
255317
sourceTree = "<group>";
256318
};
319+
79E34A101E2AC6C600E1293B /* Extra */ = {
320+
isa = PBXGroup;
321+
children = (
322+
);
323+
name = Extra;
324+
sourceTree = "<group>";
325+
};
257326
/* End PBXGroup section */
258327

259328
/* Begin PBXHeadersBuildPhase section */
@@ -428,6 +497,7 @@
428497
799396C21D48C02300086753 /* SMB2FileHandle.swift in Sources */,
429498
799396CB1D48C02300086753 /* SMB2Query.swift in Sources */,
430499
799396AA1D48C02300086753 /* DropboxFileProvider.swift in Sources */,
500+
79BD638C1E2CC2300035128C /* ExtendedLocalFileProvider.swift in Sources */,
431501
7924B1B31D89FD6400589DB7 /* SMBClient.swift in Sources */,
432502
7924B1A51D89DAE000589DB7 /* Parser.swift in Sources */,
433503
799396B01D48C02300086753 /* FileProvider.swift in Sources */,
@@ -464,6 +534,7 @@
464534
799396C31D48C02300086753 /* SMB2FileHandle.swift in Sources */,
465535
799396CC1D48C02300086753 /* SMB2Query.swift in Sources */,
466536
7924B1AD1D89F7D800589DB7 /* SMBClient.swift in Sources */,
537+
79BD638D1E2CC2300035128C /* ExtendedLocalFileProvider.swift in Sources */,
467538
799396AB1D48C02300086753 /* DropboxFileProvider.swift in Sources */,
468539
7924B1A61D89DAE000589DB7 /* Parser.swift in Sources */,
469540
799396B11D48C02300086753 /* FileProvider.swift in Sources */,
@@ -500,6 +571,7 @@
500571
799396C41D48C02300086753 /* SMB2FileHandle.swift in Sources */,
501572
799396CD1D48C02300086753 /* SMB2Query.swift in Sources */,
502573
7924B1AE1D89F7D900589DB7 /* SMBClient.swift in Sources */,
574+
79BD638E1E2CC2300035128C /* ExtendedLocalFileProvider.swift in Sources */,
503575
799396AC1D48C02300086753 /* DropboxFileProvider.swift in Sources */,
504576
7924B1A71D89DAE000589DB7 /* Parser.swift in Sources */,
505577
799396B21D48C02300086753 /* FileProvider.swift in Sources */,
@@ -694,6 +766,7 @@
694766
DYLIB_COMPATIBILITY_VERSION = 1;
695767
DYLIB_CURRENT_VERSION = 1;
696768
DYLIB_INSTALL_NAME_BASE = "@rpath";
769+
ENABLE_BITCODE = NO;
697770
ENABLE_STRICT_OBJC_MSGSEND = YES;
698771
ENABLE_TESTABILITY = YES;
699772
FRAMEWORK_VERSION = A;
@@ -749,6 +822,7 @@
749822
DYLIB_COMPATIBILITY_VERSION = 1;
750823
DYLIB_CURRENT_VERSION = 1;
751824
DYLIB_INSTALL_NAME_BASE = "@rpath";
825+
ENABLE_BITCODE = NO;
752826
ENABLE_NS_ASSERTIONS = NO;
753827
ENABLE_STRICT_OBJC_MSGSEND = YES;
754828
FRAMEWORK_VERSION = A;

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,41 @@ documentsProvider.unregisterNotifcation(path: provider.currentPath)
328328

329329
* **Please note** in LocalFileProvider it will also monitor changes in subfolders. This behaviour can varies according to file system specification.
330330

331+
### Thumbnail and meta-information
332+
333+
Providers which conform `ExtendedFileProvider` are able to generate thumbnail or provide file meta-information for images, media and pdf files.
334+
335+
Local and Dropbox providers support this functionality.
336+
337+
##### Thumbnails
338+
To check either file thumbnail is supported or not and fetch thumbnail, use (and modify) these example code:
339+
340+
```swift
341+
let path = "/newImage.jpg"
342+
let thumbSize = CGSize(width: 64, height: 64)
343+
if documentsProvider.thumbnailOfFileSupported(path: path {
344+
documentsProvider..thumbnailOfFile(path: file.path, dimension: thumbSize, completionHandler: { (image, error) in
345+
DispatchQueue.main.async {
346+
self.previewImage.image = image
347+
}
348+
}
349+
}
350+
```
351+
352+
##### Meta-informations
353+
354+
To get meta-information like image/video taken date, dimension, etc., use (and modify) these example code:
355+
356+
```swift
357+
if documentsProvider..propertiesOfFile(path: file.path, completionHandler: { (propertiesDictionary, keys, error) in
358+
for key in keys {
359+
print("\(key): \(propertiesDictionary[key])")
360+
}
361+
}
362+
```
363+
364+
* **Bonus:** You can modify/extend Local provider generator by setting `LocalFileInformationGenerator` static variables and methods
365+
331366
## Contribute
332367

333368
We would love for you to contribute to **FileProvider**, check the `LICENSE` file for more info.

0 commit comments

Comments
 (0)