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 Append note Intent #1582

Merged
merged 12 commits into from
May 13, 2024
Merged

Add Append note Intent #1582

merged 12 commits into from
May 13, 2024

Conversation

charliescheer
Copy link
Contributor

Fix

So continuing on with the shortcut improvements. One of the requested shortcuts is to be able to append to an existing note. Makes sense that you would want to be able to use shortcuts to easily add to one of your existing notes. So in this PR I have done just that.

This PR adds a new intent Append Note. With Append note you can specify an existing note and content that you want to add to it. You can also choose to select the note and the content at the time which makes this shortcut a pretty versatile way to add content to existing Simplenote notes from outside of the app.

Test

  1. launch Simplenote with this branch and log into an account (you may need to do this on device to make the new entitlements work)
  2. background Simplenote and go to the shortcuts app. Add a new shortcut, add action and look for Simplenote. Select Append note
  3. Tap on the content button and choose "ask every time" and then tap on the note and select a note to use
  4. Run the shortcut, add some content to your note.
  5. Open Simplenote again and confirm that your note has been updated with the new content.

A few things to consider while testing this:

  • make sure that tags stay the same
  • make sure that system tags stay the same
  • make sure a published note continues to be published

Review

(Required) Add instructions for reviewers. For example:

Only one developer is required to review these changes, but anyone can perform the review.

Release

(Required) Add a concise statement to RELEASE-NOTES.txt if the changes should be included in release notes. Include details about updating the notes in this section. For example:

These changes do not require release notes.

(When the last of the shortcuts are added then I will update the release notes)

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 8, 2024

You can test the changes in simplenote-ios from this Pull Request by:

  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr1582-55a9ab9-018f5ac1-182c-4393-a10b-ad7fd147510d on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@charliescheer charliescheer added this to the 4.52 milestone May 9, 2024
Copy link
Contributor

@jleandroperez jleandroperez left a comment

Choose a reason for hiding this comment

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

Leaving a note, already discussed over Slack!.

I've found a glitch while testing this PR:

  1. Add a new Append note Shortcut
  2. Invoke the shortcut multiple times
  3. Launch Simplenote

As a result, only the last text you've appended will be visible in the note.

return AppendNoteIntentResponse(code: .failure, userActivity: nil)
}

note.content? += "\n\n\(content)"
Copy link
Contributor

Choose a reason for hiding this comment

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

You may wanna do something like:

let oldContent = note.content ?? ""
note.content = oldContent + "\n\n\(content)"

(Or so?) Otherwise whenever the content is currently nil, the new text would get lost

Copy link
Contributor

@jleandroperez jleandroperez left a comment

Choose a reason for hiding this comment

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

✅ Verified you can, as of now, append text to an Entry
✅ Verified that multiple Append OPs don't overwrite each other

Nice work Charlie!!

:shipit:

@@ -61,10 +61,46 @@ extension Uploader: URLSessionTaskDelegate {
}
}

class Downloader: NSObject {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maaaybe we should either extract this into its own file, OR just rename as SimperiumREST.swift ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved it to it's own file

return AppendNoteIntentResponse(code: .failure, userActivity: nil)
}

note.content = existingContent + "\n\n\(content)"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we'd rather using + \n (rather than a double newline. Dunno?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@charliescheer charliescheer merged commit ae17c60 into trunk May 13, 2024
3 of 6 checks passed
@charliescheer charliescheer deleted the charlie/1569/add-new-shortcuts branch May 13, 2024 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants