Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

WIP: enhancement/670-TweetPostAuthor #674

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

WIP: enhancement/670-TweetPostAuthor #674

wants to merge 1 commit into from

Conversation

saamerm
Copy link
Contributor

@saamerm saamerm commented Jul 20, 2020

THIS PR IS A WORK IN PROGRESS, DO NOT MERGE

  • PR for Tag post author in tweet #670
  • Updated the preview item's Title so that it includes the twitter handle
  • Since IFTTT is connected directly, it takes the Title value and automatically posts it on Twitter
  • I added a check that only adds the twitter handle if it is populated and contains a value

* Updated the preview item's Title so that it includes the twitter handle
* Since IFTTT is connected directly, it takes the Title value and automatically posts it on Twitter
* I added a check that only adds the twitter handle if it is populated and contains a value
@lothrop
Copy link
Contributor

lothrop commented Jul 20, 2020

I like it! Is there a chance to see how it will look in Twitter without pushing to prod?

@saamerm
Copy link
Contributor Author

saamerm commented Jul 20, 2020

If you look at this tweet: https://twitter.com/PlanetXamarin/status/1284977181563781122

Instead of this:

Generating beautiful frames for your iOS & Android screenshots instantly https://ift.tt/3jmh0hK #Xamarin

In theory, if IFTTT is setup the way I think it is, it will start looking like this:

Generating beautiful frames for your iOS & Android screenshots instantly, by @saamerm https://ift.tt/3jmh0hK #Xamarin

@Cheesebaron
Copy link
Member

No it won't. This only changes how it looks on https://www.planetxamarin.com/preview and not the RSS feed itself.

@saamerm
Copy link
Contributor Author

saamerm commented Jul 20, 2020

@Cheesebaron how would i be able to change what is sent to the RSS feed?

@Cheesebaron
Copy link
Member

Copy link
Member

@jamesmontemagno jamesmontemagno left a comment

Choose a reason for hiding this comment

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

What it they don't have a twitter account?

@saamerm
Copy link
Contributor Author

saamerm commented Mar 23, 2021

@jamesmontemagno If they don't have an author name or a twitter account, we'll just ignore it for now.
@Cheesebaron After the var feed = new SyndicationFeed(...){...}; line, I was able to add a foreach(var item in feed.Items){} and in there I can get the Title & Name string using item.Title.Text & item.Authors[0].Name. But the problem is that these properties are read-only.
The only way to update the Title to include the twitter handle is using item.Title.WriteTo()
I can figure out a way to get the twitter handle by comparing the Name to our list of names, but do you know how we can use the WriteTo to update the value without creating a new RSS feed?
I have added a question to StackOverflow as well.

@saamerm saamerm changed the title enhancement/670-TweetPostAuthor WIP: enhancement/670-TweetPostAuthor Mar 23, 2021
@saamerm
Copy link
Contributor Author

saamerm commented Mar 23, 2021

image

We might be in business thanks to the Highest DotNet contributor on StackOverflow! I added this code after line 184 of NewCombinedFeedSource & I was able to update the RSS feed that is used by IFTTT:
foreach (var item in feed.Items)
{
    string newTitleText = item.Title.Text + "SAAMER";

    if (!string.IsNullOrWhiteSpace(item.Title.Type))
    {
        string type = item.Title.Type == "text" ? "Plaintext" : item.Title.Type;
        TextSyndicationContentKind textKind = (TextSyndicationContentKind)
            Enum.Parse(typeof(TextSyndicationContentKind), type, ignoreCase: true);
        item.Title = new TextSyndicationContent(newTitleText, textKind);
    }
    else
    {
        item.Title = new TextSyndicationContent(newTitleText);
    }
}

I just need to update "SAAMER" to conditionally add the twitter handles instead if the names match our authors.

@saamerm
Copy link
Contributor Author

saamerm commented Mar 23, 2021

Alright, maybe we should close this since the final approach was different from what I took in #721, and it's also quite messy

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

Successfully merging this pull request may close these issues.

None yet

4 participants