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

[Feature Request]: Add an update checker #11

Open
2 tasks done
Cubik65536 opened this issue Nov 12, 2022 · 3 comments
Open
2 tasks done

[Feature Request]: Add an update checker #11

Cubik65536 opened this issue Nov 12, 2022 · 3 comments
Assignees
Labels
prio:medium This issue / pull request should be addressed when possible proj:code This is more about works on codes status:in-progress We are working on this type:feature This issue is requesting new features / This pull request adds new features
Milestone

Comments

@Cubik65536
Copy link
Member

Please choose if applies:

  • I'm currently working on a adding this feature.

Describe the solution you'd like

Add an update checker (based on the GitHub tag) and notify the user when the application is starting and on the home and about pages.

Describe alternatives you've considered

No response

Anything else?

Please accept these terms

@Cubik65536 Cubik65536 self-assigned this Nov 12, 2022
@Cubik65536 Cubik65536 added this to the v0.3.1 milestone Nov 12, 2022
@Cubik65536 Cubik65536 moved this to 📂 New in To-Do List Nov 12, 2022
@Cubik65536 Cubik65536 added prio:medium This issue / pull request should be addressed when possible type:feature This issue is requesting new features / This pull request adds new features proj:code This is more about works on codes status:todo We are going to work on this and removed enhancement labels Nov 13, 2022
@Cubik65536 Cubik65536 changed the title [Feature Request]: Update checker [Feature Request]: Add an update checker Nov 13, 2022
@Cubik65536
Copy link
Member Author

Check logic:

fun compareVersion (
  currentVersion: String = "0.0.0",
  currentStage: String = "stable",
  comparedVersion: String = "0.0.0",
  comparedStage: String = "stable"
) -> Int {
  /**
   * return -1 if the current version is newer (not released dev)
   * return 0 if the current version is same as newest
   * return 1 if the current version is older
   */
   /*...*/
}

val currentReleaseVersion = VersionUtil.getVersion()
val currentReleaseStage = VersionUtil.getProperty("stage")

if (stage == "stable") {
  val client = HttpClient(CIO)
  val response = try {
    client.get("https://api.github.com/repos/iXORTech/RemoteMC-Core/releases/latest") {
      method = HttpMethod.Get
    }.body<String>().toString() 
  } catch (e: ConnectException) {
    /*...*/
  }
  /*...*/
  val latestReleaseVersion = /*...*/
  compareVersion(
    currentVersion = currentReleaseVersion,
    comparedVersion = latestReleaseVersion
  )
} else if (stage.contains("dev") || stage.contains("alpha") || stage.contains("beta") || stage.contains("rc")) {
  val client = HttpClient(CIO)
  val response = try {
    client.get("https://api.github.com/repos/iXORTech/RemoteMC-Core/tags") {
      method = HttpMethod.Get
    }.body<String>().toString() 
  } catch (e: ConnectException) {
    /*...*/
  }
  /*...*/
  val latestReleaseVersion = /*...*/
  val latestReleaseStage = /*...*/
  compareVersion(
    currentVersion = currentReleaseVersion,
    currentStage = currentReleaseStage,
    comparedVersion = latestReleaseVersion,
    comparedStage = latestReleaseStage
  )
} else { /*...*/ }

@Cubik65536 Cubik65536 added status:in-progress We are working on this and removed status:todo We are going to work on this labels May 23, 2023
@Cubik65536 Cubik65536 moved this from 📂 New to 🏗 In progress in To-Do List May 23, 2023
@Cubik65536
Copy link
Member Author

Let's try to take advantage of https://github.com/G00fY2/version-compare

@Cubik65536 Cubik65536 moved this from 🏗 In progress to 📂 New in To-Do List Oct 3, 2023
@Cubik65536 Cubik65536 moved this from 📂 New to 🏗 In progress in To-Do List Oct 3, 2023
@Cubik65536
Copy link
Member Author

Update 2023-10-03: This is in pending because of a big refactor on the code base.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
prio:medium This issue / pull request should be addressed when possible proj:code This is more about works on codes status:in-progress We are working on this type:feature This issue is requesting new features / This pull request adds new features
Projects
Archived in project
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant