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

feat(thread): implement sendReadReceipt api method #17

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

dadish
Copy link
Contributor

@dadish dadish commented Mar 5, 2024

Description

Implements the sendReadReceipt api method. Along with a "Stealth Mode" support for the Tumblr.

Testing Instructions

  • Apply changes from this PR to your local platfomr-tumblr and build it yarn tsc
  • Launch the Texts app and sideload the platform-tumblr.
  • Open a thread with tumblrbot and message it. Like show me cat gif. Wait until it responds.
  • Open tumblr.com in your browser and confirm you have unread messages from tumblrbot. (Do not open tumblrbot conversation panel in tumblr.com or else it will mark the conversation as read.)
  • Now go back Texts app and click "Mark as Read" at the bottom of the tumblrbot thread.
  • Go back to tumblr.com and confirm the conversatoin with tumblrbot becomes read within 10 seconds.

Copy link

linear bot commented Mar 5, 2024

@dadish dadish requested review from batuhan and ridafkih March 5, 2024 18:07
}),
})

return {
Copy link
Member

Choose a reason for hiding this comment

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

why do we clone object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All responses from tumblr api is wrapped in a response object. Something like this

{
	"meta": {
		"status": 200,
		"msg": "OK"
	},
	"response": {
		"user": {
			"name": "nurguly",
			"likes": 32,
			"following": 79,
      ...
		}
	}
}

So for each api request I "unwrap" it. Makes it much easier to deal with static typing and dealing with responses in general.

Copy link
Member

@ridafkih ridafkih Mar 6, 2024

Choose a reason for hiding this comment

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

Should be slightly more memory-efficient to just return response.json.response rather than spreading it, since this creates and returns a shallow copy of the object. Think that's what Kishan was getting at. You'd still be "unwrapping" it, but without the need for the extra mem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhhh! I misunderstood. Updated now! 01d5aa1

@batuhan batuhan force-pushed the nurguly/plt-1153-tumblr-implement-sendreadreceipt-api branch from 01d5aa1 to ddb7dae Compare March 6, 2024 15:17
Copy link

github-actions bot commented Mar 6, 2024

Install this branch's platform manifest to test its implementation.

Manifest Installation (Texts Desktop)

  1. Press ⌘ CMD + J
  2. Type and select `Install platform integrations`
  3. Paste the manifest URL from below in the Manifest URL field and click Download
  4. Relaunch Texts when prompted on the bottom left

https://uploads.texts.com/platform-builds/artifacts/tumblr/6edddd50f58961a22de275ca036943da/manifest.json

@dadish dadish force-pushed the nurguly/plt-1153-tumblr-implement-sendreadreceipt-api branch from ddb7dae to 01d5aa1 Compare March 6, 2024 15:19
@dadish dadish merged commit 3e8418a into main Mar 6, 2024
3 checks passed
@dadish dadish deleted the nurguly/plt-1153-tumblr-implement-sendreadreceipt-api branch March 6, 2024 15:27
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.

4 participants