According to most early decisors, the evening *shema* should be said after *tseit hakokhavim* (see [mishna Berakhot 1:1](https://www.sefaria.org/Mishnah_Berakhot.1.1) and [its gemara](https://www.sefaria.org/Berakhot.2a.12?lang=bi)), and the *rishonim* debate how to deal with a *tsibbur* that is praying *maariv* before that time. One oft-quoted suggestion in the name of Rav Hai Gaon (see [Otzar HaGeonim](https://www.hebrewbooks.org/pdfpager.aspx?req=38274&st=&pgnum=11)) is to pray the *maariv amida* with the *tsibbur* and then say *shema* with its *brakhot* after *tseit hakokhavim* (without repeating the *amida*). Rav Hai Gaon then adds:

> ‮ואי חזי איניש לצלוי ראשונה בדהדי צבורא רשות ושניה חובה, שפיר דמי.
> 
> If it's possible for one to pray the first as an optional prayer and the second as a required prayer, even better.

That is, pray *amida* twice, first as an *nedava* prayer (I assume that this is what "optional" means, but if there are better suggestions, please profer them), and the second prayer-time (after dark) is a "normal" *maariv* (*brakhot shema* + *shema* + *amida*).

I am wondering how this last idea might work on Friday. On the one hand, it is forbidden to pray a *nedava* prayer on Shabbat or Yom Tov (see [here](https://judaism.stackexchange.com/q/15623/4940)), and saying a Shabbat/Y"T *maariv amida* seems to include accepting Shabbat on oneself at that time. On the other hand, perhaps the fact that it is not yet night means that this prohibition on *nedava* prayers on Shabbat/Y"T doesn't kick in. Additionally, none of the commentaries that I've seen that quote Rav Hai Gaon mention any difference on Shabbat — while one might expect some to omit mention of Shabbat/Y"T (since it may be "obvious" that it's not possible to do on erev Shabbat/Y"T), I'd expect at least a few commentaries to bring it up. Compounding the issue, there are versions of what Rav Hai Gaon said that switch around the order of the *amidot*: first the required *amida* and later the *nedava* prayer, when it's certainly fully Shabbat (see [Talmidei Rabbeinu Yonah s.v. ומי](https://hebrewbooks.org/pdfpager.aspx?req=37952&st=&pgnum=325), with *girsaot*) — how is this practice permitted?

Are there any sources that discuss this directly?