ソースを参照

intent

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 年 前
コミット
1ca0c5569f

+ 18 - 8
Nextcloud.xcodeproj/project.pbxproj

@@ -241,9 +241,9 @@
 		F75B0ABD244C4DBB00E58DCA /* NCFunctionCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75B0ABC244C4DBB00E58DCA /* NCFunctionCenter.swift */; };
 		F75C0C4823D1FAE300163CC8 /* NCRichWorkspaceCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75C0C4723D1FAE300163CC8 /* NCRichWorkspaceCommon.swift */; };
 		F75D19E325EFE09000D74598 /* NCTrash+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75D19E225EFE09000D74598 /* NCTrash+Menu.swift */; };
-		F75DD761290AB35F002EB562 /* Intent.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F75DD760290AB35F002EB562 /* Intent.intentdefinition */; };
-		F75DD762290AB35F002EB562 /* Intent.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F75DD760290AB35F002EB562 /* Intent.intentdefinition */; };
-		F75DD763290AB35F002EB562 /* Intent.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F75DD760290AB35F002EB562 /* Intent.intentdefinition */; };
+		F75DD765290ABB25002EB562 /* Intent.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F75DD769290ABB25002EB562 /* Intent.intentdefinition */; };
+		F75DD766290ABB25002EB562 /* Intent.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F75DD769290ABB25002EB562 /* Intent.intentdefinition */; };
+		F75DD767290ABB25002EB562 /* Intent.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F75DD769290ABB25002EB562 /* Intent.intentdefinition */; };
 		F75E57BD25BF0EC1002B72C2 /* SVGKit in Frameworks */ = {isa = PBXBuildFile; productRef = F75E57BC25BF0EC1002B72C2 /* SVGKit */; };
 		F75E57BF25BF0EC8002B72C2 /* SVGKit in Frameworks */ = {isa = PBXBuildFile; productRef = F75E57BE25BF0EC8002B72C2 /* SVGKit */; };
 		F75E57C125BF0ECD002B72C2 /* SVGKit in Frameworks */ = {isa = PBXBuildFile; productRef = F75E57C025BF0ECD002B72C2 /* SVGKit */; };
@@ -827,7 +827,8 @@
 		F75B923D1ECAE55E00199C96 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F75C0C4723D1FAE300163CC8 /* NCRichWorkspaceCommon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCRichWorkspaceCommon.swift; sourceTree = "<group>"; };
 		F75D19E225EFE09000D74598 /* NCTrash+Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCTrash+Menu.swift"; sourceTree = "<group>"; };
-		F75DD760290AB35F002EB562 /* Intent.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = Intent.intentdefinition; sourceTree = "<group>"; };
+		F75DD768290ABB25002EB562 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intent.intentdefinition; sourceTree = "<group>"; };
+		F75DD76B290ABB2F002EB562 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intent.strings; sourceTree = "<group>"; };
 		F75EDFBC1E8C112F00E6F369 /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
 		F75EDFBE1E8C116D00E6F369 /* libstdc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libstdc++.tbd"; path = "usr/lib/libstdc++.tbd"; sourceTree = SDKROOT; };
 		F760329D252F0F8E0015A421 /* NCTransferCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NCTransferCell.swift; path = iOSClient/Transfers/NCTransferCell.swift; sourceTree = SOURCE_ROOT; };
@@ -1502,7 +1503,7 @@
 		F75DD764290AB369002EB562 /* Intent */ = {
 			isa = PBXGroup;
 			children = (
-				F75DD760290AB35F002EB562 /* Intent.intentdefinition */,
+				F75DD769290ABB25002EB562 /* Intent.intentdefinition */,
 			);
 			path = Intent;
 			sourceTree = "<group>";
@@ -2819,7 +2820,7 @@
 				F72EA95828B7BC4F00C88F0C /* FilesData.swift in Sources */,
 				F793E59E28B763C2005E4B02 /* NCAskAuthorization.swift in Sources */,
 				F78302FF28B4C45000B84583 /* NCUtilityFileSystem.swift in Sources */,
-				F75DD762290AB35F002EB562 /* Intent.intentdefinition in Sources */,
+				F75DD766290ABB25002EB562 /* Intent.intentdefinition in Sources */,
 				F78302F628B4C3C500B84583 /* NCDatabase.swift in Sources */,
 				F7D68FCD28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */,
 				F783030128B4C49700B84583 /* UIImage+Extensions.swift in Sources */,
@@ -2949,7 +2950,7 @@
 				F7239871253D86B600257F49 /* NCEmptyDataSet.swift in Sources */,
 				AFCE353327E4ED1900FEA6C2 /* UIToolbar+Extension.swift in Sources */,
 				8491B1CD273BBA82001C8C5B /* UIViewController+Menu.swift in Sources */,
-				F75DD761290AB35F002EB562 /* Intent.intentdefinition in Sources */,
+				F75DD765290ABB25002EB562 /* Intent.intentdefinition in Sources */,
 				F702F2F725EE5CED008F8E80 /* NCLogin.swift in Sources */,
 				F7E98C1627E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */,
 				F7F4F11227ECDC52008676F9 /* UIFont+Extension.swift in Sources */,
@@ -3046,7 +3047,7 @@
 				F7C9739528F17131002C43E2 /* IntentHandler.swift in Sources */,
 				F7A8D73D28F181D3008BBE1C /* NCUtilityFileSystem.swift in Sources */,
 				F7A8D74528F1828E008BBE1C /* CCUtility.m in Sources */,
-				F75DD763290AB35F002EB562 /* Intent.intentdefinition in Sources */,
+				F75DD767290ABB25002EB562 /* Intent.intentdefinition in Sources */,
 				F7A8D73F28F181EF008BBE1C /* NCGlobal.swift in Sources */,
 				F7A8D74328F1826F008BBE1C /* String+Extensions.swift in Sources */,
 				F7A8D73728F17E1E008BBE1C /* NCManageDatabase+Account.swift in Sources */,
@@ -3152,6 +3153,15 @@
 			path = "Supporting Files";
 			sourceTree = "<group>";
 		};
+		F75DD769290ABB25002EB562 /* Intent.intentdefinition */ = {
+			isa = PBXVariantGroup;
+			children = (
+				F75DD768290ABB25002EB562 /* Base */,
+				F75DD76B290ABB2F002EB562 /* en */,
+			);
+			name = Intent.intentdefinition;
+			sourceTree = "<group>";
+		};
 		F7E70DE91A24DE4100E1B66A /* Localizable.strings */ = {
 			isa = PBXVariantGroup;
 			children = (

+ 2 - 2
Widget/Dashboard/DashboardData.swift

@@ -91,7 +91,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
         return completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: nil, buttons: nil, isPlaceholder: true, isEmpty: false, titleImage: UIImage(named: "widget")!, title: "Dashboard", footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " dashboard"))
     }
 
-    let accountIdentifier: String = configuration?.Accounts?.identifier ?? "active"
+    let accountIdentifier: String = configuration?.accounts?.identifier ?? "active"
     if accountIdentifier == "active" {
         account = NCManageDatabase.shared.getActiveAccount()
     } else {
@@ -104,7 +104,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
 
     // Default widget
     let result = NCManageDatabase.shared.getDashboardWidgetApplications(account: account.account).first
-    let id: String = configuration?.Applications?.identifier ?? (result?.id ?? "recommendations")
+    let id: String = configuration?.applications?.identifier ?? (result?.id ?? "recommendations")
 
     let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: account.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor)
     guard serverVersionMajor >= NCGlobal.shared.nextcloudVersion25 else {

+ 1 - 1
Widget/Files/FilesData.swift

@@ -91,7 +91,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
         return completion(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, tile: getTitleFilesWidget(account: nil), footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " files"))
     }
 
-    let accountIdentifier: String = configuration?.Accounts?.identifier ?? "active"
+    let accountIdentifier: String = configuration?.accounts?.identifier ?? "active"
     if accountIdentifier == "active" {
         account = NCManageDatabase.shared.getActiveAccount()
     } else {

+ 9 - 9
Widget/Intent/Intent.intentdefinition → Widget/Intent/Base.lproj/Intent.intentdefinition

@@ -43,7 +43,7 @@
 					<key>INIntentParameterDisplayPriority</key>
 					<integer>1</integer>
 					<key>INIntentParameterName</key>
-					<string>Accounts</string>
+					<string>accounts</string>
 					<key>INIntentParameterObjectType</key>
 					<string>Accounts</string>
 					<key>INIntentParameterObjectTypeNamespace</key>
@@ -66,7 +66,7 @@
 							<key>INIntentParameterPromptDialogCustom</key>
 							<true/>
 							<key>INIntentParameterPromptDialogFormatString</key>
-							<string>There are ${count} options matching ‘${Accounts}’.</string>
+							<string>There are ${count} options matching ‘${accounts}’.</string>
 							<key>INIntentParameterPromptDialogFormatStringID</key>
 							<string>ObH8NN</string>
 							<key>INIntentParameterPromptDialogType</key>
@@ -76,7 +76,7 @@
 							<key>INIntentParameterPromptDialogCustom</key>
 							<true/>
 							<key>INIntentParameterPromptDialogFormatString</key>
-							<string>Just to confirm, you wanted ‘${Accounts}’?</string>
+							<string>Just to confirm, you wanted ‘${accounts}’?</string>
 							<key>INIntentParameterPromptDialogFormatStringID</key>
 							<string>q5lvSu</string>
 							<key>INIntentParameterPromptDialogType</key>
@@ -143,7 +143,7 @@
 					<key>INIntentParameterDisplayPriority</key>
 					<integer>1</integer>
 					<key>INIntentParameterName</key>
-					<string>Accounts</string>
+					<string>accounts</string>
 					<key>INIntentParameterObjectType</key>
 					<string>Accounts</string>
 					<key>INIntentParameterObjectTypeNamespace</key>
@@ -166,7 +166,7 @@
 							<key>INIntentParameterPromptDialogCustom</key>
 							<true/>
 							<key>INIntentParameterPromptDialogFormatString</key>
-							<string>There are ${count} options matching ‘${Accounts}’.</string>
+							<string>There are ${count} options matching ‘${accounts}’.</string>
 							<key>INIntentParameterPromptDialogFormatStringID</key>
 							<string>296XDb</string>
 							<key>INIntentParameterPromptDialogType</key>
@@ -176,7 +176,7 @@
 							<key>INIntentParameterPromptDialogCustom</key>
 							<true/>
 							<key>INIntentParameterPromptDialogFormatString</key>
-							<string>Just to confirm, you wanted ‘${Accounts}’?</string>
+							<string>Just to confirm, you wanted ‘${accounts}’?</string>
 							<key>INIntentParameterPromptDialogFormatStringID</key>
 							<string>TVGjNQ</string>
 							<key>INIntentParameterPromptDialogType</key>
@@ -200,7 +200,7 @@
 					<key>INIntentParameterDisplayPriority</key>
 					<integer>2</integer>
 					<key>INIntentParameterName</key>
-					<string>Applications</string>
+					<string>applications</string>
 					<key>INIntentParameterObjectType</key>
 					<string>Applications</string>
 					<key>INIntentParameterObjectTypeNamespace</key>
@@ -223,7 +223,7 @@
 							<key>INIntentParameterPromptDialogCustom</key>
 							<true/>
 							<key>INIntentParameterPromptDialogFormatString</key>
-							<string>There are ${count} options matching ‘${Applications}’.</string>
+							<string>There are ${count} options matching ‘${applications}’.</string>
 							<key>INIntentParameterPromptDialogFormatStringID</key>
 							<string>XjFf0X</string>
 							<key>INIntentParameterPromptDialogType</key>
@@ -233,7 +233,7 @@
 							<key>INIntentParameterPromptDialogCustom</key>
 							<true/>
 							<key>INIntentParameterPromptDialogFormatString</key>
-							<string>Just to confirm, you wanted ‘${Applications}’?</string>
+							<string>Just to confirm, you wanted ‘${applications}’?</string>
 							<key>INIntentParameterPromptDialogFormatStringID</key>
 							<string>Am6y6p</string>
 							<key>INIntentParameterPromptDialogType</key>

+ 30 - 0
Widget/Intent/en.lproj/Intent.strings

@@ -0,0 +1,30 @@
+"13zjVT" = "Account";
+
+"296XDb" = "There are ${count} options matching ‘${Accounts}’.";
+
+"Am6y6p" = "Just to confirm, you wanted ‘${Applications}’?";
+
+"CAIVXf" = "Applications";
+
+"DN8Bxl" = "Account";
+
+"LIw8E9" = "Widget";
+
+"NO1rJU" = "Dashboard";
+
+"ObH8NN" = "There are ${count} options matching ‘${Accounts}’.";
+
+"TVGjNQ" = "Just to confirm, you wanted ‘${Accounts}’?";
+
+"V3exc2" = "Account";
+
+"VfbA9C" = "Account";
+
+"XjFf0X" = "There are ${count} options matching ‘${Applications}’.";
+
+"ZgvlYN" = "Dashboard Widget";
+
+"q5lvSu" = "Just to confirm, you wanted ‘${Accounts}’?";
+
+"tAlZ1R" = "Accounts";
+

+ 1 - 1
Widget/Lockscreen/LockscreenData.swift

@@ -42,7 +42,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, comp
         return completion(LockscreenData(date: Date(), isPlaceholder: true, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: ""))
     }
 
-    let accountIdentifier: String = configuration?.Accounts?.identifier ?? "active"
+    let accountIdentifier: String = configuration?.accounts?.identifier ?? "active"
     if accountIdentifier == "active" {
         account = NCManageDatabase.shared.getActiveAccount()
     } else {

+ 9 - 1
WidgetDashboardIntentHandler/IntentHandler.swift

@@ -52,8 +52,16 @@ class IntentHandler: INExtension, DashboardIntentHandling, AccountIntentHandling
     func provideApplicationsOptionsCollection(for intent: DashboardIntent, with completion: @escaping (INObjectCollection<Applications>?, Error?) -> Void) {
 
         var applications: [Applications] = []
+        var account: tableAccount?
 
-        guard let account = NCManageDatabase.shared.getActiveAccount() else {
+        let accountIdentifier: String = intent.accounts?.identifier ?? "active"
+        if accountIdentifier == "active" {
+            account = NCManageDatabase.shared.getActiveAccount()
+        } else {
+            account = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", accountIdentifier))
+        }
+
+        guard let account = account else {
             return completion(nil, nil)
         }