Skip to content

Config v6 #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 111 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
67cbe89
SDKKey validation updated to handle proxy and new key format
novalisdenahi Jul 25, 2023
305b5bf
Comparators rework
novalisdenahi Jul 27, 2023
383d067
Fix comparators names
novalisdenahi Jul 28, 2023
d9abd5e
Fix comparator names and add new comparator
novalisdenahi Aug 18, 2023
eb13328
v6 and models added
novalisdenahi Aug 31, 2023
e0a3f3e
Implement evaluatePrerequisiteFlagCondition and added v6 tests
novalisdenahi Sep 7, 2023
98b46b9
Fix comparator and other errors
novalisdenahi Sep 8, 2023
615ee9d
Added segments impl and test
novalisdenahi Sep 12, 2023
9fd9741
Rename ComparisonCondition to UserCondition
novalisdenahi Sep 12, 2023
446d122
Added logs to new code
novalisdenahi Sep 15, 2023
993a3cb
Evaluation logger
novalisdenahi Sep 26, 2023
8780acd
Evaluation logs and tests finished
novalisdenahi Sep 28, 2023
0452ab3
Logs NumberFormat updated and DateUTC fixed
novalisdenahi Sep 29, 2023
da89a2e
Remove TODOs
novalisdenahi Oct 5, 2023
3f4667a
EvaluateLogger depends on LogLevel
novalisdenahi Oct 5, 2023
dae9ddc
v5 and v6 sdkKey updates
novalisdenahi Oct 6, 2023
05284f5
EvaluationLoggerTurnOffTest updated with LogLevel checks
novalisdenahi Oct 6, 2023
e2f7754
Added attributeValueFrom user helper methods. (no date yet)
novalisdenahi Oct 6, 2023
9e16ba3
Format code
novalisdenahi Oct 6, 2023
374a61b
Fix matrix test v5vsV6. Add remoteJson to tests
novalisdenahi Oct 13, 2023
48b1fd0
Detekt fixes
novalisdenahi Oct 17, 2023
8606786
Ktlint fixes
novalisdenahi Oct 17, 2023
e95bc92
Add docs
novalisdenahi Oct 17, 2023
455723f
Fix list truncation
novalisdenahi Oct 17, 2023
e1c1604
Date double value format fix. Cannot convert to Long because it's not…
novalisdenahi Oct 18, 2023
a35898c
Fix JS test errors. Lint and detekt problems.
novalisdenahi Oct 24, 2023
f663144
Added text comparators. Updated segments evaluation. Updated tests.
novalisdenahi Nov 3, 2023
f1bc453
Unicode test and fixes added
novalisdenahi Nov 6, 2023
a00a87c
Small fix and reduce logged info in tests
novalisdenahi Nov 7, 2023
a4cbb5f
Evaluator warning fixes
z4kn4fein Nov 8, 2023
1563eb2
Format
z4kn4fein Nov 8, 2023
6b11fcd
Fix failing JS tests
z4kn4fein Nov 8, 2023
d28bff8
Remove println
novalisdenahi Nov 22, 2023
b5a1abf
Added tests and small fixes. CCUser handle Any values
novalisdenahi Dec 4, 2023
1893451
JS number settingtype added to handle JS number conversion.
novalisdenahi Dec 6, 2023
8763aaf
Fix JS Evaluation fails because of cache message
novalisdenahi Dec 6, 2023
ce9bee3
Update 1103 error message
novalisdenahi Jan 26, 2024
d42d1b2
Fix circular dependency missing remove.
novalisdenahi Jan 26, 2024
cbbf05f
Rename Comparator to USerComparator.
novalisdenahi Jan 29, 2024
e34bbc5
Fix getKeyAndValue targeting rule if.
novalisdenahi Feb 14, 2024
bed8675
Move configSalt validation from deserialization.
novalisdenahi Feb 14, 2024
b6d9c7f
update processHashedStartEndsWithCompare handle sliced String
novalisdenahi Feb 16, 2024
2824bd0
Update trim and refactor process methods.
novalisdenahi Feb 17, 2024
eb04526
Accept NaN
novalisdenahi Feb 17, 2024
abf4c21
Added extra segment and prerequisite tests
novalisdenahi Feb 17, 2024
0d7e0e4
Error message fixes
novalisdenahi Feb 17, 2024
baa486b
SDK key validation LOCAL_ONLY fix
novalisdenahi Feb 17, 2024
204d7fd
Code format
novalisdenahi Feb 17, 2024
d848681
Fix httpEngine in test
novalisdenahi Feb 18, 2024
5316716
klint fix
novalisdenahi Feb 19, 2024
5f07dc5
Added missing PrerequisiteFlag Override Test
novalisdenahi Feb 19, 2024
6de8afa
Add trim test
novalisdenahi Feb 19, 2024
90f73de
Add trim test
novalisdenahi Feb 19, 2024
bd98071
Fix user toString use simple json.
novalisdenahi Feb 19, 2024
65e9f03
Fix Array and List convert to String to use json.
novalisdenahi Feb 19, 2024
289c781
Add specialCharacter test
novalisdenahi Feb 20, 2024
cd20269
Refactor LogHelper
novalisdenahi Feb 21, 2024
869e06c
Platform based double format WIP
novalisdenahi Feb 22, 2024
56eb9d7
Set stringbuilder lineseparator as default
novalisdenahi Feb 22, 2024
3bffa6a
Merge branch 'main' into config-v6
novalisdenahi Feb 22, 2024
8f4442f
Lint fixes
novalisdenahi Feb 22, 2024
e163602
Fixes after merge.
novalisdenahi Feb 22, 2024
81e62f8
Change DataSource setting to config.
novalisdenahi Feb 22, 2024
af36eb4
JS platform send agent and etag info in the request query params.
novalisdenahi Feb 23, 2024
c9126df
Remove expected NumberFormatter class. Now just the doubleToString me…
novalisdenahi Feb 23, 2024
e90dc4f
Fix date conversions
novalisdenahi Feb 23, 2024
70235dc
Fix log double format. Now only the native platform is different from…
novalisdenahi Feb 23, 2024
5fdd4e9
NSNumberFormatter added (not tested)
novalisdenahi Feb 26, 2024
e209122
lint fix
novalisdenahi Feb 26, 2024
7ca9856
fix imports
novalisdenahi Feb 26, 2024
9f1f00b
Added darwinTest module
novalisdenahi Feb 26, 2024
115bce8
Try to fix darwin number formatter
z4kn4fein Feb 29, 2024
82fab7f
Type validation updated and some test added
novalisdenahi Mar 4, 2024
77093fb
lint fix
novalisdenahi Mar 4, 2024
22dbbfb
Try to fix formatter
z4kn4fein Mar 4, 2024
3f3abd6
Update NumberFormatter.kt
z4kn4fein Mar 4, 2024
2cc8a9e
darwin test fix
novalisdenahi Mar 4, 2024
492f19d
Merge branch 'config-v6' of https://github.com/configcat/kotlin-sdk i…
novalisdenahi Mar 4, 2024
ee4da08
darwin test fix
novalisdenahi Mar 4, 2024
89d1c16
darwin test fix
novalisdenahi Mar 4, 2024
add4131
Merge branch 'main' into config-v6
novalisdenahi Mar 5, 2024
b24f026
Fix test after merge.
novalisdenahi Mar 5, 2024
208d3b6
Value type and setting type validation fixed. getAnyValue and getAnyV…
novalisdenahi Mar 6, 2024
679ff1b
Merge branch 'main' into config-v6
novalisdenahi Mar 6, 2024
ad0e499
Fix tests
novalisdenahi Mar 6, 2024
2aa179e
Fix darwin test
novalisdenahi Mar 6, 2024
e9e1d4b
Update version to 3.0.0
novalisdenahi Mar 6, 2024
87a43ef
Fixes on model based on code review
novalisdenahi Mar 20, 2024
fa89129
Fixes based on code review
novalisdenahi Mar 20, 2024
5a840c1
Fixes based on code review
novalisdenahi Mar 21, 2024
f99a01a
Fix based on code review
novalisdenahi Mar 21, 2024
5a74a6b
Refactor getValue/getAnyValue and getValueDetails/getAnyValueDetails …
adams85 Mar 21, 2024
714224e
Hashed length trim added
novalisdenahi Mar 21, 2024
20be976
Fixes based on review
novalisdenahi Mar 22, 2024
808393b
Add analysis to PR checks
z4kn4fein Mar 25, 2024
97c771a
Detekt and lint fixes
novalisdenahi Mar 25, 2024
6def21f
SemVer fix. Lint fix
novalisdenahi Mar 25, 2024
0c6f627
Added when fix
novalisdenahi Mar 25, 2024
73d88d5
Add tests
novalisdenahi Mar 26, 2024
0a8806a
klint fix
novalisdenahi Mar 26, 2024
973dcc6
detekt fix
novalisdenahi Mar 26, 2024
be701df
Add more test
novalisdenahi Mar 27, 2024
3e6f59e
Fix testGetValueDetailsValidTypes
novalisdenahi Mar 27, 2024
412e97b
Fix test error
novalisdenahi Mar 27, 2024
1ce21e4
Moved Utils method to internal object
novalisdenahi Mar 27, 2024
ece222c
Detekt fix
novalisdenahi Mar 27, 2024
7b48e04
Lint fix
novalisdenahi Mar 27, 2024
43334f0
Rename Utils file to Constants and internal object Utils to Helpers
novalisdenahi Mar 27, 2024
1464943
Added FlagValueSerializer tests
novalisdenahi Mar 28, 2024
6bfc1cb
Update fetcher param test to check http/2 headers.
novalisdenahi Mar 28, 2024
35dc91f
Added getKeyAndValue tests
novalisdenahi Mar 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ kotlin {
nodejs {
testTask {
useMocha {
timeout = "10000"
timeout = "20000"
}
}
}
Expand Down Expand Up @@ -176,6 +176,13 @@ kotlin {
}
}

val darwinTest by creating {
dependsOn(commonTest)
dependencies {
implementation("io.ktor:ktor-client-darwin:$ktor_version")
}
}

val nativeMain by creating {
dependsOn(commonMain)
}
Expand All @@ -193,7 +200,11 @@ kotlin {
}

configure(nativeTestSets) {
dependsOn(nativeTest)
if (this.name.isDarwin()) {
dependsOn(darwinTest)
} else {
dependsOn(nativeTest)
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.configcat
version=2.1.0
version=3.0.0

ktor_version=2.0.3
kotlinx_serialization_version=1.4.1
Expand All @@ -17,4 +17,6 @@ kotlin.native.ignoreDisabledTargets=true
kotlin.mpp.stability.nowarn=true

kotlin.native.binary.memoryModel=experimental
org.gradle.jvmargs=-Xmx6g
org.gradle.jvmargs=-Xmx6g

kotlin.ignore.tcsm.overflow=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
3 changes: 2 additions & 1 deletion src/androidMain/kotlin/com/configcat/Cache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class SharedPreferencesCache(context: Context) : ConfigCache {
private val sharedPreferences: SharedPreferences

init {
sharedPreferences = context.applicationContext.getSharedPreferences("configcat_preferences", Context.MODE_PRIVATE)
sharedPreferences =
context.applicationContext.getSharedPreferences("configcat_preferences", Context.MODE_PRIVATE)
}

override suspend fun read(key: String): String? = sharedPreferences.getString(key, null)
Expand Down
35 changes: 35 additions & 0 deletions src/androidMain/kotlin/com/configcat/NumberFormatter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.configcat

import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.*
import kotlin.math.abs

internal actual fun doubleToString(doubleToString: Double): String {
// Handle Double.NaN, Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY
if (doubleToString.isNaN() || doubleToString.isInfinite()) {
return doubleToString.toString()
}

// To get similar result between different SDKs the Double value format is modified.
// Between 1e-6 and 1e21 we don't use scientific-notation. Over these limits scientific-notation used but the
// ExponentSeparator replaced with "e" and "e+".
// "." used as decimal separator in all cases.
val abs = abs(doubleToString)
val fmt =
if (1e-6 <= abs && abs < 1e21) DecimalFormat("#.#################") else DecimalFormat("#.#################E0")
val symbols = DecimalFormatSymbols.getInstance(Locale.UK)
if (abs > 1) {
symbols.exponentSeparator = "e+"
} else {
symbols.exponentSeparator = "e"
}
fmt.decimalFormatSymbols = symbols
return fmt.format(doubleToString)
}

internal actual fun formatDoubleForLog(doubleToFormat: Double): String {
val decimalFormat = DecimalFormat("0.#####")
decimalFormat.decimalFormatSymbols = DecimalFormatSymbols.getInstance(Locale.UK)
return decimalFormat.format(doubleToFormat)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.configcat.fetch

import io.ktor.client.request.*

internal actual fun httpRequestBuilder(
configCatUserAgent: String,
eTag: String
): HttpRequestBuilder {
return commonHttpRequestBuilder(configCatUserAgent, eTag)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.configcat.override

import com.configcat.model.Setting

internal actual fun convertToSetting(value: Any): Setting {
return commonConvertToSetting(value)
}
194 changes: 0 additions & 194 deletions src/commonMain/kotlin/com/configcat/Config.kt

This file was deleted.

3 changes: 2 additions & 1 deletion src/commonMain/kotlin/com/configcat/ConfigCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public interface ConfigCache {

internal class EmptyConfigCache : ConfigCache {
override suspend fun read(key: String): String? = null
override suspend fun write(key: String, value: String) { /* do nothing */ }
override suspend fun write(key: String, value: String) { /* do nothing */
}
}

internal expect fun defaultCache(): ConfigCache
Loading