[macOS] Updates Import/Export of OPML

- Created OPML UTType
- Added OPML as an importable UTI type
- `allowedFileTypes` replaced with `allowed ContentTypes`
- Moved UTType extension to single shared file
- Build flags updated
This commit is contained in:
Stuart Breckenridge
2023-05-31 16:32:51 +08:00
parent e1aa5f8c17
commit abcc836c07
6 changed files with 76 additions and 31 deletions

View File

@@ -75,7 +75,7 @@ import Account
func exportOPML(account: Account) {
let panel = NSSavePanel()
panel.allowedFileTypes = ["opml"]
panel.allowedContentTypes = [.xml]
panel.allowsOtherFileTypes = false
panel.prompt = NSLocalizedString("panel.prompt.export-opml", comment: "Export OPML")
panel.title = NSLocalizedString("panel.title.export-opml", comment: "Export OPML")

View File

@@ -85,7 +85,7 @@ import Account
panel.allowsMultipleSelection = false
panel.canChooseDirectories = false
panel.resolvesAliases = true
panel.allowedFileTypes = ["opml", "xml"]
panel.allowedContentTypes = [.xml, .opml]
panel.allowsOtherFileTypes = false
panel.beginSheetModal(for: hostWindow!) { modalResult in

View File

@@ -6,10 +6,27 @@
<string>group.$(ORGANIZATION_IDENTIFIER).NetNewsWire-Evergreen</string>
<key>AppIdentifierPrefix</key>
<string>$(AppIdentifierPrefix)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>nnwtheme</string>
</array>
<key>CFBundleTypeName</key>
<string>NetNewsWire Theme</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>com.ranchero.netnewswire.theme</string>
</array>
<key>LSTypeIsPackage</key>
<true/>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
@@ -48,6 +65,8 @@
<string>$(DEVELOPER_ENTITLEMENTS)</string>
<key>FeedURLForTestBuilds</key>
<string>https://ranchero.com/downloads/netnewswire-beta.xml</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.news</string>
<key>LSMinimumSystemVersion</key>
@@ -77,27 +96,6 @@
<string>$(ORGANIZATION_IDENTIFIER)</string>
<key>SUFeedURL</key>
<string>https://ranchero.com/downloads/netnewswire-release.xml</string>
<key>UserAgent</key>
<string>NetNewsWire (RSS Reader; https://netnewswire.com/)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>nnwtheme</string>
</array>
<key>CFBundleTypeName</key>
<string>NetNewsWire Theme</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>com.ranchero.netnewswire.theme</string>
</array>
<key>LSTypeIsPackage</key>
<true/>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
@@ -119,6 +117,27 @@
</array>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeDescription</key>
<string>OPML</string>
<key>UTTypeIcons</key>
<dict/>
<key>UTTypeIdentifier</key>
<string>public.opml</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>opml</string>
</array>
</dict>
</dict>
</array>
<key>UserAgent</key>
<string>NetNewsWire (RSS Reader; https://netnewswire.com/)</string>
</dict>
</plist>

View File

@@ -882,6 +882,9 @@
DFD406FF291FDC0C00C02962 /* DisplayAndBehaviorsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD406FE291FDC0C00C02962 /* DisplayAndBehaviorsView.swift */; };
DFD86796295D553D0070D62D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DFD86798295D553D0070D62D /* Localizable.strings */; };
DFE522A32953DEF400376B77 /* CustomInsetGroupedRowStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFE522A22953DEF400376B77 /* CustomInsetGroupedRowStyle.swift */; };
DFEB034D2A273BFE00C7573A /* UTType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEB034C2A273BFE00C7573A /* UTType.swift */; };
DFEB034E2A273BFE00C7573A /* UTType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEB034C2A273BFE00C7573A /* UTType.swift */; };
DFEB034F2A273BFE00C7573A /* UTType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEB034C2A273BFE00C7573A /* UTType.swift */; };
DFFB8FC2279B75E300AC21D7 /* Account in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 51BC2F4A24D343A500E90810 /* Account */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
DFFC4E7428E95C01006B82AF /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFFC4E7328E95C01006B82AF /* AboutView.swift */; };
FF3ABF13232599810074C542 /* ArticleSorterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF3ABF09232599450074C542 /* ArticleSorterTests.swift */; };
@@ -1701,6 +1704,7 @@
DFD6AACB27ADE80900463FAD /* NewsFax.nnwtheme */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = NewsFax.nnwtheme; sourceTree = "<group>"; };
DFD86797295D553D0070D62D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
DFE522A22953DEF400376B77 /* CustomInsetGroupedRowStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomInsetGroupedRowStyle.swift; sourceTree = "<group>"; };
DFEB034C2A273BFE00C7573A /* UTType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UTType.swift; sourceTree = "<group>"; };
DFFC4E7328E95C01006B82AF /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
FF3ABF09232599450074C542 /* ArticleSorterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorterTests.swift; sourceTree = "<group>"; };
FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleSorter.swift; sourceTree = "<group>"; };
@@ -2485,6 +2489,7 @@
84411E701FE5FBFA004B527F /* SmallIconProvider.swift */,
51BC4ADD247277DF000A6ED8 /* URL-Extensions.swift */,
51D205EE28E3CF8D007C46EF /* LinkTextField.swift */,
DFEB034C2A273BFE00C7573A /* UTType.swift */,
);
path = Extensions;
sourceTree = "<group>";
@@ -3764,6 +3769,7 @@
};
652832CF2683DD0400E6F37C /* Run Script: Delete Unnecessary Frameworks For Share Extension */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -3800,6 +3806,7 @@
};
65ED406F235DEF6C0081F399 /* Run Script: Automated build numbers */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -3833,6 +3840,7 @@
};
7180F95C265B67B800189094 /* Run Script: Delete Unnecessary Frameworks For Share Extension */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -3851,6 +3859,7 @@
};
8423E3E3220158E700C3795B /* Run Script: Code Sign Sparkle */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -3869,6 +3878,7 @@
};
84C987A52000AC9E0066B150 /* Run Script: Automated build numbers */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -4148,6 +4158,7 @@
B2B80779239C4C7300F191E0 /* RSImage-AppIcons.swift in Sources */,
65ED4026235DEF6C0081F399 /* TimelineTableRowView.swift in Sources */,
65ED4027235DEF6C0081F399 /* UnreadIndicatorView.swift in Sources */,
DFEB034E2A273BFE00C7573A /* UTType.swift in Sources */,
51A9A5F22380DE520033AADF /* AddWebFeedDefaultContainer.swift in Sources */,
65ED4028235DEF6C0081F399 /* ExtractedArticle.swift in Sources */,
65ED4029235DEF6C0081F399 /* DeleteCommand.swift in Sources */,
@@ -4233,6 +4244,7 @@
513146B2235A81A400387FDC /* AddWebFeedIntentHandler.swift in Sources */,
51D87EE12311D34700E63F03 /* ActivityType.swift in Sources */,
51C452772265091600C03939 /* MultilineUILabelSizer.swift in Sources */,
DFEB034F2A273BFE00C7573A /* UTType.swift in Sources */,
51C452A522650A2D00C03939 /* SmallIconProvider.swift in Sources */,
DF28B453294FE6C600C4D8CA /* EnableExtensionPointView.swift in Sources */,
51AB8AB323B7F4C6008F147D /* WebViewController.swift in Sources */,
@@ -4542,6 +4554,7 @@
849A97541ED9EAC0007D329B /* AddWebFeedWindowController.swift in Sources */,
DF3630EB2936183D00326FB8 /* OPMLDocument.swift in Sources */,
5144EA40227A37EC00D19003 /* ImportOPMLWindowController.swift in Sources */,
DFEB034D2A273BFE00C7573A /* UTType.swift in Sources */,
178A9F9D2549449F00AB7E9D /* AddAccountsView.swift in Sources */,
51C4CFF024D37D1F00AF9874 /* Secrets.swift in Sources */,
849A976D1ED9EBC8007D329B /* TimelineTableView.swift in Sources */,

View File

@@ -7,13 +7,7 @@
//
import Foundation
import UniformTypeIdentifiers
public extension UTType {
static var nnwTheme: UTType {
UTType("com.ranchero.netnewswire.theme")!
}
}
struct ArticleTheme: Equatable {

View File

@@ -0,0 +1,19 @@
//
// UTType.swift
// NetNewsWire
//
// Created by Stuart Breckenridge on 31/05/2023.
// Copyright © 2023 Ranchero Software. All rights reserved.
//
import Foundation
import UniformTypeIdentifiers
public extension UTType {
static var nnwTheme: UTType {
UTType("com.ranchero.netnewswire.theme")!
}
static var opml: UTType {
UTType("public.opml")!
}
}