Social Algorithm

if( message.length <= 140 && message.isPublic ) {
    Twitter.tweet( message.text );
} else if( message.isPublic ) {
    if( !intersection( message.recipients, Contacts.facebookOnlyUsers ).isEmpty ) {
        FaceBook.setStatus( message.text );
    } else {
        GooglePlus.share( message.text, GooglePlus.PUBLIC );
    }
} else {
    circles = GooglePlusUtilities.computeRelevantCircles( message.recipients );
    GooglePlus.share( message.text, circles );
}

2 Responses to Social Algorithm

  1. Alexi says:

    Your code will be better after some optimization:

    if (message.isPublic) {
    GooglePlus.share(message.text, GooglePlus.PUBLIC);
    } else {
    circles = GooglePlusUtilities.computeRelevantCircles(message.recipients);
    GooglePlus.share(message.text, circles);
    }

  2. Tinkoff says:

    Can add vkontakte.ru? special for Russian users. Thanks!