app version code

This commit is contained in:
Nordup 2025-08-16 11:28:56 +07:00
parent eecf9b31b7
commit 74c3c4e65e
2 changed files with 14 additions and 6 deletions

View file

@ -21,10 +21,6 @@ func send_event(body: Dictionary = {}) -> void:
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request send_event", Color.RED)
func get_app_version() -> void:
AnalyticsEvents.app_version = ProjectSettings.get_setting("application/config/version")
func get_user_id() -> void:
AnalyticsEvents.user_id = DataSaver.get_string("analytics", "user_id")
if not AnalyticsEvents.user_id.is_empty(): return
@ -41,5 +37,15 @@ func get_user_id() -> void:
if err != HTTPRequest.RESULT_SUCCESS: Debug.logclr("Cannot send request create_user_id", Color.RED)
func get_app_version() -> void:
AnalyticsEvents.app_version = ProjectSettings.get_setting("application/config/version")
AnalyticsEvents.app_version_code = version_to_int(AnalyticsEvents.app_version)
func version_to_int(version: String) -> int:
var parts = version.split(".")
return int(parts[0]) * 10000 + int(parts[1]) * 100 + int(parts[2])
static func get_delta_sec_from_tick(from_tick: int) -> float:
return float(Time.get_ticks_msec() - from_tick) / 1000