nusmods icon indicating copy to clipboard operation
nusmods copied to clipboard

Support sharing to WeChat and QQ

Open davidsqf opened this issue 3 years ago • 1 comments

image Is it possible to support sharing timetable via WeChat and QQ?

davidsqf avatar Jun 23 '21 03:06 davidsqf

Currently, sharing on WhatsApp / Telegram is done by stuffing the timetable into a stringified URL, then calling the sharing/message-sending features provided by WhatsApp / Telegram.

            <h3 className={styles.shareHeading}>Via messaging apps</h3>

            <a
              className="btn btn-outline-primary btn-block"
              href={`https://api.whatsapp.com/send?${qs.stringify({
                text: `My timetable: ${url}`,
              })}`}
              target="_blank"
              rel="noreferrer noopener"
            >
              WhatsApp
            </a>

            <a
              className="btn btn-outline-primary btn-block"
              href={`https://t.me/share/url?${qs.stringify({ url })}`}
              target="_blank"
              rel="noreferrer noopener"
            >
              Telegram
            </a>

I did a quick cursory search on whether something similar is available for WeChat / QQ, but it doesn't seem to be easily available. If anyone has any ideas on how this is typically done or can be easily done, feel free to comment below.

On a separate note: if we eventually do decide to implement support for more messaging platforms. We might want to convert these buttons into icons of the respective messaging apps instead. (Separate issue to be created to track this, if we do decide to go down this route.)

chrisgzf avatar Jun 26 '21 10:06 chrisgzf