Skip to content

Commit

Permalink
v4.14
Browse files Browse the repository at this point in the history
  • Loading branch information
AndraxDev committed Jun 15, 2024
1 parent 497fda0 commit db4220b
Show file tree
Hide file tree
Showing 31 changed files with 350 additions and 415 deletions.
2 changes: 1 addition & 1 deletion .idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

configurations {
cleanedAnnotations
implementation.exclude group: 'org.jetbrains' , module:'annotations'
implementation.exclude group: 'org.jetbrains', module: 'annotations'
}

android {
Expand All @@ -22,8 +22,8 @@ android {
applicationId "org.teslasoft.assistant"
minSdk 28
targetSdk 34
versionCode 413
versionName "4.13"
versionCode 414
versionName "4.14"
}

buildTypes {
Expand All @@ -43,10 +43,12 @@ android {
multiDexEnabled true
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}
Expand All @@ -65,9 +67,6 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'org.apache.commons:commons-lang3:3.14.0'
implementation 'commons-io:commons-io:2.16.1'
implementation ('com.github.chrisbanes.photoview:library:1.2.4') {
exclude group: 'com.android.support', module: 'support-v4'
}
implementation 'io.noties.markwon:core:4.6.2'
implementation 'io.noties.markwon:html:4.6.2'
implementation 'io.noties.markwon:syntax-highlight:4.6.2'
Expand All @@ -85,6 +84,9 @@ dependencies {
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'com.aallam.ktoken:ktoken:0.4.0'
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation ('com.github.chrisbanes.photoview:library:1.2.4') {
exclude group: 'com.android.support', module: 'support-v4'
}
implementation ('io.noties:prism4j:2.0.0') {
exclude group: 'org.jetbrains', module: 'annotations'
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
<package android:name="org.teslasoft.assistant" />
<package android:name="org.teslasoft.libraries.support" />
</queries>

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,198 +120,4 @@ class GlobalPreferences private constructor(private var gp: SharedPreferences) {
fun getAmoledPitchBlack() : Boolean {
return getGlobalBoolean("amoled_pitch_black", false)
}

/**
* Set lock assistant window
* */
fun setLockAssistantWindow(value: Boolean) {
putGlobalBoolean("lock_assistant_window", value)
}

/**
* Get lock assistant window
* */
fun getLockAssistantWindow() : Boolean {
return getGlobalBoolean("lock_assistant_window", false)
}

/**
* Desktop mode - automatically focus message input once chat is opened, press enter to send message, shift+enter to add new line
*
* This param is global and applies across all chats and activities in the app
*
* @return desktop mode status
* */
fun getDesktopMode() : Boolean {
return getGlobalBoolean("desktopMode", false)
}

/**
* Set desktop mode
*
* This param is global and applies across all chats and activities in the app
*
* @param mode desktop mode status
* */
fun setDesktopMode(mode: Boolean) {
putGlobalBoolean("desktopMode", mode)
}

/**
* Get experimental UI
*
* @return experimental UI mode
*/
fun getExperimentalUI() : Boolean {
return getGlobalBoolean("experimentalUI", true)
}

/**
* Set experimental UI
*
* @param mode experimental UI mode
*/
fun setExperimentalUI(mode: Boolean) {
putGlobalBoolean("experimentalUI", mode)
}

/**
* Retrieves the custom host URL for API requests.
*
* @return The custom host URL as a string. If no custom host URL is set, it returns the default value "https://api.openai.com".
*/
fun getCustomHost() : String {
return getGlobalString("custom_host", "https://api.openai.com/v1/")
}

/**
* Sets the custom host URL for API requests.
*
* @param host The custom host URL to be set.
*/
fun setCustomHost(host: String) {
putGlobalString("custom_host", host)
}

/**
* Get debug mode
* */
fun getDebugMode() : Boolean {
return getGlobalBoolean("debug_mode", false)
}

/**
* Set debug mode
* */
fun setDebugMode(state: Boolean) {
putGlobalBoolean("debug_mode", state)
}

/**
* Get ads enabled
* */
fun getAdsEnabled() : Boolean {
return getGlobalBoolean("ads_enabled", true)
}

/**
* Set ads enabled
* */
fun setAdsEnabled(state: Boolean) {
putGlobalBoolean("ads_enabled", state, true)
}

/**
* Retrieves the language from the shared preferences.
*
* @return The language value or an english if not found.
*/
fun getLanguage() : String {
return getGlobalString("lang", "en")
}

/**
* Sets the language in the shared preferences.
*
* @param lang The language value to be stored.
*/
fun setLanguage(lang: String) {
putGlobalString("lang", lang)
}

/**
* Get Chats autosave
* */
fun getChatsAutosave() : Boolean {
return getGlobalBoolean("chats_autosave", false)
}

/**
* Set Chats autosave
* */
fun setChatsAutosave(state: Boolean) {
putGlobalBoolean("chats_autosave", state)
}

/**
* Get Skip chat name dialog
* */
fun getSkipChatNameDialog() : Boolean {
return getGlobalBoolean("skip_chat_name_dialog", false)
}

/**
* Set skip chat name dialog
* */
fun setSkipChatNameDialog(state: Boolean) {
putGlobalBoolean("skip_chat_name_dialog", state)
}

/**
* Set debug test ads
* */
fun setDebugTestAds(state: Boolean) {
putGlobalBoolean("debug_test_ads", state)
}

/**
* Get debug test ads
* */
fun getDebugTestAds() : Boolean {
return getGlobalBoolean("debug_test_ads", false)
}

/**
* Get Premium license key
* */
fun getPremiumKey(context: Context) : String {
return EncryptedPreferences.getEncryptedPreference(context, "premium", "license_key")
}

/**
* Set Premium license key
* */
fun setPremiumKey(key: String, context: Context) {
EncryptedPreferences.setEncryptedPreference(context, "premium", "license_key", key)
}

/**
* Retrieves the encrypted API key from the shared preferences.
*
* @param context The context to access the encrypted shared preferences.
* @return The decrypted API key or an empty String if not found.
*/
fun getApiKey(context: Context) : String {
return EncryptedPreferences.getEncryptedPreference(context, "api", "api_key")
}

/**
* Sets the encrypted API key in the shared preferences.
*
* @param key The API key to be stored in an encrypted form.
* @param context The context to access the encrypted shared preferences.
*/
fun setApiKey(key: String, context: Context) {
EncryptedPreferences.setEncryptedPreference(context, "api", "api_key", key)
}
}
20 changes: 0 additions & 20 deletions app/src/main/java/org/teslasoft/assistant/preferences/Logger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,6 @@ class Logger {
return EncryptedPreferences.getEncryptedPreference(context, "logs", "ads")
}

/**
* Set ads log
* */
private fun setAdsLog(context: Context, log: String) {
EncryptedPreferences.setEncryptedPreference(context, "logs", "ads", log)
}

/**
* Clear ads log
* */
fun clearAdsLog(context: Context) {
setAdsLog(context, "")
}

/**
* @param type - type of log (crash/event/ads)
* @param tag - any tag to identify log message and source
Expand Down Expand Up @@ -112,11 +98,6 @@ class Logger {
setEventLog(context, log)
}

"ads" -> {
val log = "${getAdsLog(context)}$logString"
setAdsLog(context, log)
}

else -> {
error("Invalid log type")
}
Expand All @@ -133,7 +114,6 @@ class Logger {
fun deleteAllLogs(context: Context) {
clearCrashLog(context)
clearEventLog(context)
clearAdsLog(context)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,23 +409,39 @@ class Preferences private constructor(private var preferences: SharedPreferences
}

/**
* Get experimental UI
* Retrieves the hide model names status from the shared preferences.
*
* @return experimental UI mode
* @return The hide model names status, true if enabled or false otherwise.
*/
@Deprecated("This feature is no longer supported")
fun getExperimentalUI() : Boolean {
return getGlobalBoolean("experimentalUI", true)
fun getHideModelNames() : Boolean {
return getGlobalBoolean("hide_model_names", false)
}

/**
* Set experimental UI
* Enable/disable hide model names.
*
* @param mode experimental UI mode
* @param state mode.
*/
@Deprecated("This feature is no longer supported")
fun setExperimentalUI(mode: Boolean) {
putGlobalBoolean("experimentalUI", mode)
fun setHideModelNames(state: Boolean) {
putGlobalBoolean("hide_model_names", state)
}

/**
* Retrieves the monochrome background for chat list status from the shared preferences.
*
* @return The monochrome background for chat list status, true if enabled or false otherwise.
*/
fun getMonochromeBackgroundForChatList() : Boolean {
return getGlobalBoolean("monochrome_background_for_chat_list", false)
}

/**
* Enable/disable monochrome background for chat list.
*
* @param state mode.
*/
fun setMonochromeBackgroundForChatList(state: Boolean) {
putGlobalBoolean("monochrome_background_for_chat_list", state)
}

/**
Expand Down
Loading

0 comments on commit db4220b

Please sign in to comment.