Skip to content

Kotlin Desktop Updater based on GitHub releases. From the Github's repository of the application get the release marked as the last-release to warn the user of that application about a new version available

License

Notifications You must be signed in to change notification settings

N7ghtm4r3/OctocatKDU

Repository files navigation

OctocatKDU

v1.0.4

Kotlin Desktop Updater based on GitHub releases. From the GitHub's repository of the application get the release marked as the last-release to warn the user of that application about a new version available

Implementation

Add the JitPack repository to your build file

Gradle

  • Add it in your root build.gradle at the end of repositories

    Gradle (Short)

    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }

    Gradle (Kotlin)

    repositories {
        ...
        maven("https://jitpack.io")
    }
  • Add the dependency

    Gradle (Short)

    dependencies {
        implementation 'com.github.N7ghtm4r3:OctocatKDU:1.0.4'
    }

    Gradle (Kotlin)

    dependencies {
        implementation("com.github.N7ghtm4r3:OctocatKDU:1.0.4")
    }

Maven

  • Add it in your root build.gradle at the end of repositories
<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>
  • Add the dependency
<dependency>
  <groupId>com.github.N7ghtm4r3</groupId>
  <artifactId>OctocatKDU</artifactId>
  <version>1.0.4</version>
</dependency>

Latest supported properties configuration

kotlin.version=2.0.0
compose.version=1.6.11

Usage/Examples

Resources file

You must place the resource file, named octocat_kdu.config, in the resources folder of your application:

Caution

Note: you must keep this file safe and not share in public repositories, but keep in local to be included only in the executable file, because it contains sensitive data like the GitHub's personal access token

src
|-- main
    |-- resources
    |   |-- octocat_kdu.config

Content example:

{
  "personal_access_token": "your_personal_access_token_for_github",
  "owner": "owner_of_the_repository_of_the_application",
  "repo": "the_repository_of_the_application"
}

Testing purposes

Use the fake updater dialog to testing the workflow of your application with the OctocatKDU

  FakeUpdaterDialog(
    config = OctocatKDUFakeConfig(
      appName = "MyApplication",
      onUpdateAvailable = {
        // the application flow when there is an update available and the dialog is displayed
      },
      releaseNotes = releaseNotes, // if there are
      dismissAction = {
        // the rest of the application flow
      },
      confirmAction = { isInstalling ->
        // the action to execute if the user chosen to update the current version
      }
    )
  )

Real workflow

Use the real updater dialog in the release

  UpdaterDialog(
    config = OctocatKDUConfig(
      appName = "MyApplication",
      currentVersion = "current_version_of_the_application",
      onUpdateAvailable = {
        // the application flow when there is an update available and the dialog is displayed
      },
      dismissAction = {
        // the rest of the application flow
      },
      confirmAction = { isInstalling ->
        // the action to execute if the user chosen to update the current version
      }
    )
  )

Customization

The customization can be both with the faker and with the real dialog

  • Application theme

    Customize the dialog for your application theme

    MyApplicationTheme {
      FakeUpdaterDialog(
        config = OctocatKDUFakeConfig(
          appName = "MyApplication",
          onUpdateAvailable = {
            // the application flow when there is an update available and the dialog is displayed
          },
          releaseNotes = releaseNotes, // if there are
          dismissAction = {
            // the rest of the application flow
          },
          confirmAction = { isInstalling ->
            // the action to execute if the user chosen to update the current version
          }
        )
      )
    }
  • Specific for the dialog

    Customize only the dialog theme

    FakeUpdaterDialog(
        config = OctocatKDUFakeConfig(
            appName = "MyApplication",
            onUpdateAvailable = {
                // the application flow when there is an update available and the dialog is displayed
            },
            releaseNotes = releaseNotes, // if there are
            dismissAction = {
                // the rest of the application flow
            },
            confirmAction = { isInstalling ->
                // the action to execute if the user chosen to update the current version
            }
        ),
        style = OctocatKDUStyle(
            locale = // the locale language to use",
            shape = // the shape for the dialog,
            titleModifier = // the modifier for the title of the dialog, 
            titleColor = // the color for the title of the dialog,
            titleFontSize = // the size for the title of the dialog,
            titleFontStyle = // the style for the title of the dialog,
            titleFontWeight = // the weight for the title of the dialog,
            titleFontFamily = // the font family for the title of the dialog,
            textModifier = // the modifier for the text of the dialog,
            textColor = // the color for the text of the dialog,
            textFontSize = // the size for the text of the dialog,
            textFontStyle = // the style for the text of the dialog,
            textFontWeight = // the weight for the text of the dialog,
            textFontFamily = // the font family for the text of the dialog
        )
    )

Custom options that can be activated

  • not_show_at_next_launch

    FakeUpdaterDialog(
    
      config = OctocatKDUFakeConfig(
        ...
        // allow the user to avoid to be warned about new updates available hiding the dialog
        notShowAtNextLaunchOptionEnabled = false / true
        ...
      )
    )
  • not_show_at_next_launch

    UpdaterDialog(
    
      config = OctocatKDUConfig(
        ...
        // allow the user to be warned about new updates available only in a specific intervals
        frequencyVisibility = ENUM[ALWAYS, ONCE_PER_DAY, ONCE_PER_WEEK, ONCE_PER_MONTH]
        ...
      )
    )

Release distribution

Important

When you need to create the release distribution you must insert in the compose-desktop.pro file this proguard setting to correctly run the distribution:

-keepclassmembers enum * { 
   public static **[] values();
   public static ** valueOf(java.lang.String);
}

Appearance (default application theme)

UI appearance

Authors

Support

If you need help using the library or encounter any problems or bugs, please contact us via the following links:

Thank you for your help!

Badges

Twitter

Donations

If you want support project and developer

Crypto Address Network
3H3jyCzcRmnxroHthuXh22GXXSmizin2yp Bitcoin
0x1b45bc41efeb3ed655b078f95086f25fc83345c4 Ethereum

If you want support project and developer with PayPal

Copyright © 2024 Tecknobit

About

Kotlin Desktop Updater based on GitHub releases. From the Github's repository of the application get the release marked as the last-release to warn the user of that application about a new version available

Topics

Resources

License

Stars

Watchers

Forks