Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Transform Lists action #17

Merged
merged 1 commit into from
Jan 12, 2022
Merged

Add Transform Lists action #17

merged 1 commit into from
Jan 12, 2022

Conversation

josh
Copy link
Contributor

@josh josh commented Dec 31, 2021

Fixes #16.

Copy link
Contributor Author

@josh josh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some screenshots of the Intents editor to help code review.

IntentsExtension/Intents.intentdefinition Outdated Show resolved Hide resolved
IntentsExtension/Intents.intentdefinition Show resolved Hide resolved
<key>INIntentConfigurable</key>
<true/>
<key>INIntentDescription</key>
<string>Compares items of two lists. Even though the description says this action accepts input of type "Files", it accepts any type.</string>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sindresorhus
Copy link
Owner

Do we really need two subtraction methods? The user can just pick which list they put in the first field.

@sindresorhus
Copy link
Owner

The "Compare Lists" name kinda makes it sound like it does Set#isSubset type checks instead of actually returning a new list.

@sindresorhus
Copy link
Owner

sindresorhus commented Dec 31, 2021

It would be great if the intent description succinctly explained the 3 different operations. Shortcut users are not programmers and might not know about set theory.

}

response.result = set3.map { data in
inputFiles.first { $0.data == data }!
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will crash if the lists are empty. It's generally better to gracefully handle such situations in intents. Just remove the ! and use .compactMap instead of .map.

IntentsExtension/Intents.intentdefinition Outdated Show resolved Hide resolved
@josh
Copy link
Contributor Author

josh commented Dec 31, 2021

Do we really need two subtraction methods? The user can just pick which list they put in the first field.

👍🏻 Ha, yep that's simpler.

@josh
Copy link
Contributor Author

josh commented Dec 31, 2021

I pushed up some changes to handle customized sentences based on the type. However, it seems like a lot of the explanation text is going to be difficult to jam into one action. I could see either way. Do you have any copy editing ideas to improve the current single action approach.

Some UI things that I think could be improved if we went with distinct actions:

  • We could avoid needing to group them under the "Compare" term which there was issue with
  • Individual actions could have explainer text for the operation. We're stuck right now needing to find a terse term to pick between the operation types. So we could probably avoid the set theory operation language entirely.

@sindresorhus
Copy link
Owner

I don't think splitting them up are going to help as I don't think we can find a succinct name for each that clearly says what they do. With the latest changes, the operations are pretty clear when using the action. The only remaining issue is the action name. Any ideas for other names than "Compare Lists"? I can live with the name, but it would be nice with something that made it clearer it returns a list.

@sindresorhus
Copy link
Owner

Should Remove ${subtractingList2} items from ${subtractingList1} maybe be Get items from ${subtractingList1} that are not in ${subtractingList2}? We could maybe indicate the operation in parens for people familiar with set theory?

Get items from ${subtractingList1} that are not in ${subtractingList2} (Subtraction)

@sindresorhus
Copy link
Owner

Some naming ideas:

  • Transform Lists
  • Operate on Lists
  • Consolidate Lists
  • Merge Lists (not sure this is a correct term)

@josh
Copy link
Contributor Author

josh commented Jan 4, 2022

Pushed up some of the copy changes you suggested.

Current state of UI:

I think we're in agreement that the sentence copy is looking okay. I added that set operation at the end.

I agree that "Compare Lists" probably isn't ideal. I don't have anything else that really stands out to be. But happy with whatever you want to settle on.

Also, I don't love the state of the operation picker. But not sure what to do given the limited space here. I guess if you are poking around, seeing the sentence update might help explain it.

@sindresorhus
Copy link
Owner

Alright. Let's go with Transform Lists. Not optimal either, but I feel it's slightly better than Compare Lists.

@sindresorhus
Copy link
Owner

We could maybe indicate the operation in parens for people familiar with set theory?

I just realized this is moot as the "Operation" picker shows it anyway. Can you remove them again? Sorry for the back and forth.

let inputFiles = list1 + list2
response.result = set3.map { data in
inputFiles.first { $0.data == data }
}.compact()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}.compact()
}
.compact()

<key>INEnumValueIndex</key>
<integer>1</integer>
<key>INEnumValueName</key>
<string>subtracting</string>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<string>subtracting</string>
<string>subtraction</string>

</dict>
<dict>
<key>INEnumValueDisplayName</key>
<string>subtracting</string>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<string>subtracting</string>
<string>subtraction</string>

I also think the display names should have the first character uppercased.

<key>INEnumGeneratesHeader</key>
<true/>
<key>INEnumName</key>
<string>ComparisonType</string>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<string>ComparisonType</string>
<string>OperationType</string>

@josh
Copy link
Contributor Author

josh commented Jan 10, 2022

Pushed up new changes for "Transform Lists" and those other small suggestions.

@josh josh changed the title Add Compare Lists action Add Transform Lists action Jan 10, 2022
@sindresorhus sindresorhus merged commit 5f0182e into sindresorhus:main Jan 12, 2022
@sindresorhus
Copy link
Owner

Thank you :)

@sindresorhus
Copy link
Owner

This is now available in the latest update.

https://github.com/sindresorhus/Actions/releases/tag/v1.6.0

sindresorhus added a commit that referenced this pull request Sep 14, 2024
Add `Combine Lists` action

Add `Get Music Playlists` action

Add `Filter List` action

Add `Truncate List` action

Add `Get Emojis` action

1.2.0

Add `Send Feedback` action

Add `Is Audio Playing` action

Add `Is Bluetooth On` action

Add `Is Dark Mode` action

Add `Write or Edit Text` action

Improve the welcome screen

Add `Get User Details` action

Add `Is Connected to VPN` action

Add `Edit URL` action

1.3.0

Get `Get Title of URL` action

Add `Get Battery State` action

Add `Is Low Power Mode` action

Use larger font size in the text editor

Add `Remove Non-Printable Characters` action

Add `Format Currency` action

Add `Hide Shortcuts App` action

Add `Get Running Apps` action

Add `Spell Out Number` action

1.4.0

Add `Get Audio Playback Destination` action

Add `Is Silent Mode On` action

Fixes #8

Add `Haptic Feedback` action

Fixes #6

Add `Get File Icon` action

1.5.0

Support non-HTTPS URLs in the "Get Title of URL" action

1.5.1

Add `Transform Lists` action (#17)

Add `Truncate Text` action

Add `Round Number to Multiple` action

Fixes #11

Add `Create Color Image` action

1.6.0

Validate URL scheme in `Create URL` action

Because Foundation throws an exception if it's invalid, which we cannot handle.

Add `Is Online` action

Minor tweaks

Add `Geo URI` action

Fixes #21

Add `Symbol Image` action

1.7.0

Fix `SymbolImage` action for larger sizes

Add `Is Reachable` action

Add `Parse CSV` action

1.8.0

Fix “Parse CSV” action description

1.8.1

Add `Scan QR Code from Image` action (#25)

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>

Various tweaks

Add `Pretty Print Dictionaries` action

Add `Parse JSON5` action

Add `Merge Dictionaries` action

Add `Scan Documents` action

Add `Format Duration` action

Add `Transcribe Audio` action

Add `Get Unsplash Image` action

1.9.0

Fix an issue with the “Transcribe Audio” action

Add `Choose from List (Extended)` action

Add `Generate CSV` action

1.10.0

Add `Is Screen Locked` action

Minor tweaks

Add `Is Wi-Fi On` action

Fixes #33

Add `Get Related Words` action

1.11.0

Minor tweaks

Add `Get Query Item Value from URL` action

Fixes #36

Add `Get Query Items from URL` action

Add `Get Query Items from URL as Dictionary` action

Add `Get Device Orientation` action

Add `Is Device Orientation` action

Add `Format Number — Compact` action

1.12.0

`Transform Text`: Support transliterating text into other scripts (#42)

Minor tweaks

1.13.0

Minor tweaks

Fix reading QR codes from images with transparent background

Fixes #47

1.13.1

Minor tweaks

Rewrite the app and require macOS 13 and iOS 16

Fixes #57

Add `Format Person Name` action

Add `Blur Images` action

Add `Play Alert Sound` action

Add `Flash Screen` action

Add `Calculate with Soulver` action

`Transform Text`: Add `Slugify` transformation

Add `Authenticate` action

Add `Convert Coordinates to Location` action

Add `Get Index of List Item` action

Add `Reverse Lines` action

Add `Ask for Text with Timeout` action

Add `Is Cellular Data On` action

Add `Hex Encode` action

Refactor

Add `Overwrite File` action

Add `Generate Random Data` action

Fix macOS compatibility

2.0.0

Add back `Calculate with Soulver` action

Bug fixes

2.0.1

Add `Get Map Image of Location` action

Add `Get High-Resolution Timestamp` action

Use extension again

2.1.0

Add `Get Random Number from Seed` action

Fixes #80

Various tweaks

2.1.1

Minor tweaks

2.1.2

`Is Dark Mode On`: Fix iOS 16.2 compatibility

`Ask for Text with Timeout`: Add type parameter

Fixes #84

Add printer actions

Fixes #48

2.2.0

Minor tweaks

2.2.1

Tweaks

Fixes #104

Add `Is Host Reachable` action

Fixes #58

Add `Open URLs with App` action

Add `Global Variable` actions

Fixes #96

2.3.0

Tweaks

2.3.1

Tweaks

Fixes #122

Add `Truncate Number` action

2.4.0

Add `Set Uniform Type Identifier` action

Add `Get Average Color of Image` action

Add `Get Actions Version` action

Tweaks

Add `Ask ChatGPT` action

2.5.0

`Ask ChatGPT`: Improve error handling

2.5.1

Tweaks

2.5.2

Tweaks

Add `Get Dominant Colors of Image` action

`Ask ChatGPT`: Add more parameters

Add `Wait Milliseconds` action

2.6.0

Tweaks

Fixes #136

Add `Get Device Details (Extended)` action

Tweaks

Add `Invert Images` action

Add `Get Boolean from Input` action

Add `Is Day` action

2.7.0

Add `Get Modifier State` action

Improve contributing guide

Add `Boolean` action

Meta tweaks

Fix problem with some actions that require temporary directory

Fixes #140

Meta tweaks

2.8.0

Tweaks

2.8.1

Add `Is Cellular Low Data Mode` action

Fix the `Haptic Feedback` action

Remove `Ask ChatGPT` action

See https://sindresorhus.com/ai-actions for replacement.

Add `Is Device Locked` action

Tweaks

2.9.0

Add `Create Menu Item` action (#144)

Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>

Code style tweaks

Clean up #144

Tweaks

Add `Combine Videos` action

Tweaks

Fixes #162

Add `Is Accessibility Feature On` action

Fixes #163

Tweaks

Add `Color` action

Add `Get Average Color` action

Add `Get Image Location` action

Add `Set Image Location` action

Add `Is Shaking Device` action

Tweaks

Fixes #174

2.10.0

Add `Is Call Active` action

Tweaks

Add `Authenticate (New)` action

Add `Get Compass Heading` action

Require macOS 14 and iOS 17

Add `Is Device Moving` action

Add `Get Device Motion Data` action

Add `Get Bluetooth Devices` action

Tweaks

3.0.0

Add `Get Elevation` action

Add `Find Music Playlist` action

Fixes #212

Tweaks

Fixes #206
Fixes #214

3.1.0

Tweaks

Add `Encrypt File` action

Fixes #220

Add `Encrypt Text` action

Fixes #220

Add `Is Camera On` action

Add `Is Conforming to Uniform Type Identifier` action

Add `Join Wi-Fi` action

Fixes #223

Add `Named Clipboard` action

Add `Get Sentences from Text` action

Add `Get Paragraphs from Text` action

Tweaks

Fixes #229

Add `Is Microphone On` action

Tweaks

3.2.0

Add `Is Time` action

Tweaks

Fixes #244
Fixes #248

3.3.0

Init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Action proposal: Compare Lists
2 participants