emo / me.eater.emo.emo / Settings

Settings

data class Settings

Class which holds all current settings

Constructors

<init>

Settings(clientToken: String, selectedAccount: String? = null, accounts: HashMap<String, Map<String, Any>> = hashMapOf(), profiles: MutableList<Profile> = mutableListOf(), repositories: MutableList<RepositoryDefinition> = mutableListOf())

Class which holds all current settings

Properties

accounts

val accounts: HashMap<String, Map<String, Any>>

clientToken

val clientToken: String

profiles

val profiles: MutableList<Profile>

repositories

val repositories: MutableList<RepositoryDefinition>

selectedAccount

var selectedAccount: String?

Functions

addAccount

fun addAccount(account: MutableMap<String, Any>): Unit

Add account data retrieved from Yggdrasil to settings

addProfile

fun addProfile(profile: Profile): Boolean

Add profile to settings

addRepository

fun addRepository(repositoryDefinition: RepositoryDefinition): Boolean

Add repository definition to settings

getAccount

fun getAccount(uuid: String): Map<String, Any>

Get account by uuid, will throw when no account is found

getAccounts

fun getAccounts(): List<Map<String, Any>>

Get all account maps in a list

getConfiguredRepositories

fun getConfiguredRepositories(): List<RepositoryDefinition>

Get currently configured repository definitons

getProfiles

fun getProfiles(): List<Profile>

Get profiles from settings

getSelectedAccount

fun getSelectedAccount(): Map<String, Any>?

Get currently selected account, will throw when no accounts are configured

getSelectedAccountUuid

fun getSelectedAccountUuid(): String

Get currently selected account uuid, will throw when no accounts are configured

removeAccount

fun removeAccount(uuid: String): Unit

Remove account by uuid

removeRepository

fun removeRepository(repositoryDefinition: RepositoryDefinition): Boolean

Remove repository definition from settings

save

fun save(): Unit

Save settings to file

selectAccount

fun selectAccount(uuid: String): Unit

Set selected account by uuid

Companion Object Functions

load

fun load(): Settings

Load settings from file, if settings is corrupt or not found a new settings file is created.