Post

Replies

Boosts

Views

Activity

Unable to apply default decoration Icons to files and folders
Hello Everyone, I'm trying to add badges to files in my File Provider Extension for macOS. I'm not trying to create my own Item decorations here, but use the default Icons provided by apple (such as com.apple.icon-decoration.badge.heart , com.apple.icon-decoration.badge.pinned). I've gone through the Sample code provided by Apple for Fruit Basket. I've tried to replicate the same thing in my Extension as well but It seems I'm unable to display Icons. I'm not even getting any Error when the Icons are not being displayed, So I've been stuck for a month on this. These are the Things that I've done below: Folder Structure : FileExplorer |- FileProviderApp | |- UI.swift | |- ContentView.swift |- Extension |- extension.swift |- item.swift |- enumerator.swift |- info.plist According to the instructions given in the Documentation for Decorations here : https://developer.apple.com/documentation/fileprovider/nsfileprovideritemdecorating. The implementation was done as follows: content inside info.plist of the File provider Extension <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSExtension</key> <dict> <key>NSExtensionFileProviderSupportsEnumeration</key> <true/> <key>NSExtensionPointIdentifier</key> <string>com.apple.fileprovider-nonui</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).FileProviderExtension</string> <key>NSFileProviderDecorations</key> <array> <dict> <key>BadgeImageType</key> <string>com.apple.icon-decoration.badge.heart</string> <key>Category</key> <string>Badge</string> <key>Identifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER).heart</string> <key>Label</key> <string>Heart Item</string> </dict> </array> </dict> </dict> </plist> In my extension's NSFileProviderItem I've also Implemented the protocol NSFileProviderItemDecorating. and the decoration's method as static let decorationPrefix = Bundle.main.bundleIdentifier! static let heartDecoration = NSFileProviderItemDecorationIdentifier(rawValue: "\(decorationPrefix).heart") var decorations: [NSFileProviderItemDecorationIdentifier]? { var decos = [NSFileProviderItemDecorationIdentifier]() decos.append(Item.heartDecoration) return decos } I was expecting to see badges on the File items in Finder, but i got nothing. When I modified the FruitBasket Project to do the same i was able to see badges, but not when I try to implement it in my Extension. Was I missing a step or is the issue something else ?
1
0
622
Sep ’23
adding Sub menu to Context Menu in MacOS
I'm trying to put a sub menu inside the context menu using the NSExtensionFileProviderActions in info.plist. Which should look like this image below I have been trying to use FPUIActionExtensionViewController for doing this task but I havent got any context menu like above. But still doing that does seem to complicate the task more. Is there a simpler way to do this task, like doing it within the info.plist so I dont have to complicate the task by creating a view controller. ?
1
0
678
Aug ’23
Unable to Add Default badges to File Icons in File Provider
I'm working with NSFileProviderReplicatedExtension for macOS app. I want to apply default badge on files(For example, com.apple.icon-decoration.badge.warning, com.apple.icon-decoration.badge.pinned, .. etc). I am unable to see any badge when I open the folder mounted by the Extension. I've defined NSFileProviderDecorations in NSExtension as follows : <dict> <key>NSFileProviderDecorations</key> <array> <dict> <key>BadgeImageType</key> <string>com.apple.icon-decoration.pinned</string> <key>Category</key> <string>Badge</string> <key>Identifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER).cyfile</string> <key>Label</key> <string>CydriveFile</string> </dict> </array> <key>NSExtensionFileProviderDocumentGroup</key> <string>$(TeamIdentifierPrefix)com.example.app-group</string> <key>NSExtensionFileProviderSupportsEnumeration</key> <true/> <key>NSExtensionPointIdentifier</key> <string>com.apple.fileprovider-nonui</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).FileProviderExtension</string> </dict> I have implemented the class Item that's implementing the following Protocols : NSObject, NSFileProviderItemProtocol, NSFileProviderItemDecorating and when returning decorations for that item I'm just doing this : class Item : ... { ... static let decorationPrefix = Bundle.main.bundleIdentifier! static let heartItem = NSFileProviderItemDecorationIdentifier(rawValue: "\(decorationPrefix).cyfile") var decorations: [NSFileProviderItemDecorationIdentifier]? { var decos = [NSFileProviderItemDecorationIdentifier]() decos.append(CyItem.heartItem) return decos } } As far as i can tell I've completed all the requirements for getting the badge to show up.
0
0
531
Aug ’23
File Provider : unable to trigger `fetchPartialContents(for:version:request:minimalRange:aligningTo:options:completionHandler:)` when opening files
https://developer.apple.com/documentation/fileprovider/nsfileproviderpartialcontentfetching/3923718-fetchpartialcontents fetchPartialContents(for:version:request:minimalRange:aligningTo:options:completionHandler:) I need to use this function to fetch contents of the files partially. But it seems I'm just unable to receive any callback when i try to open the file via double click on finder. I've tried to open files of different types and sizes but still i'm defaulting back to fetchContents(for:version:request:completionHandler:) . I've been thinking if there are any specific configurations or requirements that i have to meet , so i could trigger this callback function for all the fetch Operations for files ? If No, then where am i going wrong ?
1
0
727
Jul ’23
How do we partially load files in chunks from a remote server.
I've been building a finder extension for managing a bunch of videos in a remote server. When I try to click on a video file that is dataless it seems to always trigger fetchContents(for:version:request:completionHandler:). I have implemented fetchPartialContents(for:version:request:minimalRange:aligningTo:options:completionHandler:) but i haven't been able to trigger this method no matter how large the size of the file is. What are the conditions that i have to meet to trigger this function so i could stream the video data in chunks ?
1
0
898
Jun ’23
Reading the files directly by loading them into memory, instead of downloading the file physically.
below is the scenario... I've created a local server that'll serve me files from the system which is encrypted by a key. When i try to read the File from the server , it'll decrypt and open the file. This all is working fine in other OS systems like Windows and archLinux using Fuse and similar alternatives. Now when I'm implementing the same in macOS using File Provider. I found out that Its making a local copy which is decrypted and then opening the file (fetchContents()). This is basically breaking the whole point of the project. Is there a way to not download this file and Open directly from memory instead ? (apologies if the issue was not explained correctly or was not worth mentioning, I'm still new to macOS development)
0
0
586
Jun ’23