yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.49k stars 1.57k forks source link

Feature request: Give the ability to 'copy GitHub' URL instead of 'Open Github page' #11129

Closed PathosEthosLogos closed 8 months ago

PathosEthosLogos commented 8 months ago

Before creating

Problem Description

Right now, it's opening the wrong browser. It would be nice if it copies the URL instead, or small text box that selects the entire text to copy.

Related Issue Links

No response

Desired Solution

Copy button

Alternative Approaches

Text box of URL that auto selects all text of the URL

Additional Context

No response

yairm210 commented 8 months ago

This is such a niche request that my instinct is "no, if you want to open in a non-default browser just copy/paste the URL" So I have to ask - is this opening in your default browser? That is, the one you selected as such in your OS?

SeventhM commented 8 months ago

Honestly, this 100% is kinda a feature I'd like too. Whenever I run studio through a flash drive, I also keep a copy of Vivaldi on that flash drive. And it's not particularly practical to set the default browser there. Actually, specifically avoiding setting a default browser is why on my phone I have it set to an app that opens the dialogue to choose a browser

SomeTroglodyte commented 8 months ago

... Longpress, no documentation: Cheap, nobody will find it. With documentation: ... where???

untested patch ```patch Index: core/src/com/unciv/ui/screens/civilopediascreen/MarkupRenderer.kt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/core/src/com/unciv/ui/screens/civilopediascreen/MarkupRenderer.kt b/core/src/com/unciv/ui/screens/civilopediascreen/MarkupRenderer.kt --- a/core/src/com/unciv/ui/screens/civilopediascreen/MarkupRenderer.kt (revision 63243fd7750142a9e177fb9b9121339e0dff998f) +++ b/core/src/com/unciv/ui/screens/civilopediascreen/MarkupRenderer.kt (date 1693918893996) @@ -3,9 +3,11 @@ import com.badlogic.gdx.Gdx import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.utils.Align -import com.unciv.ui.screens.basescreen.BaseScreen import com.unciv.ui.components.extensions.addSeparator import com.unciv.ui.components.input.onClick +import com.unciv.ui.components.input.onRightClick +import com.unciv.ui.screens.basescreen.BaseScreen /** Makes [renderer][render] available outside [ICivilopediaText] */ @@ -51,10 +53,14 @@ actor.onClick { linkAction(line.link) } - else if (line.linkType == FormattedLine.LinkType.External) + else if (line.linkType == FormattedLine.LinkType.External) { actor.onClick { Gdx.net.openURI(line.link) } + actor.onRightClick { + Gdx.app.clipboard.contents = line.link + } + } if (labelWidth == 0f) table.add(actor).align(line.align).row() else Index: android/assets/jsons/translations/template.properties IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties --- a/android/assets/jsons/translations/template.properties (revision 63243fd7750142a9e177fb9b9121339e0dff998f) +++ b/android/assets/jsons/translations/template.properties (date 1707902866898) @@ -1830,6 +1830,7 @@ Mod info and options = Next page = Open Github page = +Link copied to clipboard = Permanent audiovisual mod = Installed = Downloaded! = Index: core/src/com/unciv/ui/screens/modmanager/ModInfoAndActionPane.kt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/core/src/com/unciv/ui/screens/modmanager/ModInfoAndActionPane.kt b/core/src/com/unciv/ui/screens/modmanager/ModInfoAndActionPane.kt --- a/core/src/com/unciv/ui/screens/modmanager/ModInfoAndActionPane.kt (revision 63243fd7750142a9e177fb9b9121339e0dff998f) +++ b/core/src/com/unciv/ui/screens/modmanager/ModInfoAndActionPane.kt (date 1704790038484) @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Texture import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.scenes.scene2d.ui.Table +import com.unciv.logic.github.Github import com.unciv.logic.github.GithubAPI import com.unciv.models.metadata.BaseRuleset import com.unciv.models.ruleset.Ruleset @@ -15,7 +16,8 @@ import com.unciv.ui.components.extensions.toLabel import com.unciv.ui.components.extensions.toTextButton import com.unciv.ui.components.input.onClick -import com.unciv.logic.github.Github +import com.unciv.ui.components.input.onRightClick +import com.unciv.ui.popups.ToastPopup import com.unciv.utils.Concurrency import kotlin.math.max @@ -87,9 +89,15 @@ // offer link to open the repo itself in a browser if (repoUrl.isNotEmpty()) { - add("Open Github page".toTextButton().onClick { + val githubButton = "Open Github page".toTextButton() + githubButton.onClick { Gdx.net.openURI(repoUrl) - }).row() + } + githubButton.onRightClick { + Gdx.app.clipboard.contents = repoUrl + ToastPopup("Link copied to clipboard", stage) + } + add(githubButton).row() } // display "updated" date ```