Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4786607
using default argument instead of duplicated function
dorin-ga Feb 27, 2025
cec686e
Update Main.cpp
Gogoshika-ga Mar 13, 2025
bcde102
set ubuntu-24.04 and clang version to 16
Gogoshika-ga Mar 13, 2025
5c6d7e7
Update cmake.yml
Gogoshika-ga Mar 13, 2025
5586240
Update cmake.yml
Gogoshika-ga Mar 13, 2025
2f751e4
Update cmake.yml
Gogoshika-ga Mar 13, 2025
b79e828
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
2f2c2eb
Update cmake.yml
Gogoshika-ga Mar 13, 2025
ebbf72f
Update cmake.yml
Gogoshika-ga Mar 13, 2025
9a6867a
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
fc62e19
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
1225840
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
691a618
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
bd08d61
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
792a871
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
df964bd
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
876f32b
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
e1b552e
Update guid.cpp
Gogoshika-ga Mar 13, 2025
cf493e7
Update guid.cpp
Gogoshika-ga Mar 13, 2025
ebca0f4
Update CMakeLists.txt
Gogoshika-ga Mar 13, 2025
6d771f5
try and fix libc++ compatibility issues for linux
Gogoshika-ga Mar 14, 2025
0d8ecb4
Update cmake.yml
Gogoshika-ga Mar 14, 2025
409966e
Update cmake.yml
Gogoshika-ga Mar 14, 2025
4e00501
Update GALinux.cpp
Gogoshika-ga Mar 14, 2025
884ae5d
Update CMakeLists.txt
Gogoshika-ga Mar 14, 2025
2cd685c
Update CMakeLists.txt
Gogoshika-ga Mar 14, 2025
ed36c73
Merge branch 'development' of https://github.com/GameAnalytics/gamean…
Gogoshika-ga Mar 14, 2025
c1dbc7d
Update CMakeLists.txt
Gogoshika-ga Mar 14, 2025
2da61b0
Update cmake.yml
Gogoshika-ga Mar 14, 2025
02e2364
use with older ubuntu 20.04
Gogoshika-ga Mar 14, 2025
2cca217
Update cmake.yml
Gogoshika-ga Mar 14, 2025
733ef2a
Update cmake.yml
Gogoshika-ga Mar 14, 2025
2a4ad72
Update cmake.yml
Gogoshika-ga Mar 14, 2025
72a65ad
Update cmake.yml
Gogoshika-ga Mar 14, 2025
fd84651
Merge branch 'development' of https://github.com/GameAnalytics/gamean…
Gogoshika-ga Mar 14, 2025
43f2de4
Update CMakeLists.txt
Gogoshika-ga Mar 26, 2025
3a572cf
expose identifiers
dorin-ga Mar 26, 2025
4eb45a4
renamed getUserId
dorin-ga Mar 26, 2025
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
26 changes: 25 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,30 @@ jobs:
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Install Clang and Libraries
if: matrix.os == 'ubuntu-latest' && matrix.c_compiler == 'clang'
run: |
sudo apt-get update
sudo apt-get install -y clang libc++-dev libc++abi-dev

- name: Set Clang 16 as Default
if: matrix.os == 'ubuntu-24.04' && matrix.c_compiler == 'clang'
run: |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100
sudo update-alternatives --set clang /usr/bin/clang-16
sudo update-alternatives --set clang++ /usr/bin/clang++-16

- name: Check Clang Settings
if: matrix.os == 'ubuntu-latest' && matrix.c_compiler == 'clang'
run: |
clang --version
clang++ --version
echo "Checking clang headers..."
clang++ -v -E -x c++ /dev/null
echo "check lld..."
ldd --version

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
Expand All @@ -83,7 +107,7 @@ jobs:

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --verbose

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ elseif(APPLE)
elseif(LINUX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGUID_STDLIB -std=c++17")

if(CLANG)
if (CMAKE_CXX_COMPILER MATCHES "clang")
message(STATUS "Detected Clang compiler: ${CMAKE_CXX_COMPILER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()

Expand All @@ -209,7 +210,9 @@ endif()

add_library(GameAnalytics ${LIB_TYPE} ${CPP_SOURCES})
target_link_libraries(GameAnalytics PRIVATE ${LIBS} PUBLIC ${PUBLIC_LIBS})

message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}")
message(STATUS "CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
# --------------------------- Google Test Setup --------------------------- #

# Set Project Name
Expand Down
7 changes: 4 additions & 3 deletions include/GameAnalytics/GameAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,16 @@ namespace gameanalytics
static void startSession();
static void endSession();

static std::string getRemoteConfigsValueAsString(std::string const& key);
static std::string getRemoteConfigsValueAsString(std::string const& key, std::string const& defaultValue);
static std::string getRemoteConfigsValueAsString(std::string const& key, std::string const& defaultValue = "");

static bool isRemoteConfigsReady();
static void addRemoteConfigsListener(const std::shared_ptr<IRemoteConfigsListener> &listener);
static void removeRemoteConfigsListener(const std::shared_ptr<IRemoteConfigsListener> &listener);

static std::string getRemoteConfigsContentAsString();
static std::string getRemoteConfigsContentAsJson();

static std::string getUserId();
static std::string getExternalUserId();

static std::string getABTestingId();
static std::string getABTestingVariantId();
Expand Down
1 change: 1 addition & 0 deletions sample/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <string>
#include <iostream>
#include <thread>
#include <chrono>

#include "GameAnalytics/GameAnalytics.h"

Expand Down
9 changes: 7 additions & 2 deletions source/gameanalytics/GAState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,16 @@ namespace gameanalytics
getInstance().cacheIdentifier();
}

std::string GAState::getIdentifier()
std::string GAState::getUserId()
{
return getInstance()._identifier;
}

std::string GAState::getExternalUserId()
{
return getInstance()._externalUserId;
}

bool GAState::isInitialized()
{
return getInstance()._initialized;
Expand Down Expand Up @@ -402,7 +407,7 @@ namespace gameanalytics
out["event_uuid"] = utilities::GAUtilities::generateUUID();

// User identifier
out["user_id"] = getInstance().getIdentifier();
out["user_id"] = getUserId();

// remote configs configurations
if(getInstance()._configurations.is_object() && !getInstance()._configurations.empty())
Expand Down
3 changes: 2 additions & 1 deletion source/gameanalytics/GAState.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ namespace gameanalytics
static std::string getRemoteConfigsContentAsString();
static std::string getAbId();
static std::string getAbVariantId();
static std::string getUserId();
static std::string getExternalUserId();

static json getValidatedCustomFields();
static json getValidatedCustomFields(const json& withEventFields);
Expand All @@ -164,7 +166,6 @@ namespace gameanalytics
addErrorEvent(severity, msg);
}

std::string getIdentifier();
void setDefaultUserId(std::string const& id);
json& getSdkConfig();
void cacheIdentifier();
Expand Down
12 changes: 11 additions & 1 deletion source/gameanalytics/GameAnalytics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ namespace gameanalytics
{
// Send to events
json fieldsJson = utilities::parseFields(fields);
events::GAEvents::addProgressionEvent(progressionStatus, progression01, progression02, progression03, score, false, fieldsJson, mergeFields);
events::GAEvents::addProgressionEvent(progressionStatus, progression01, progression02, progression03, score, true, fieldsJson, mergeFields);
}
catch(const json::exception& e)
{
Expand Down Expand Up @@ -763,6 +763,16 @@ namespace gameanalytics
return state::GAState::getRemoteConfigsContentAsString();
}

std::string GameAnalytics::getUserId()
{
return state::GAState::getUserId();
}

std::string GameAnalytics::getExternalUserId()
{
return state::GAState::getExternalUserId();
}

std::string GameAnalytics::getABTestingId()
{
return state::GAState::getAbId();
Expand Down
1 change: 1 addition & 0 deletions source/gameanalytics/Platform/GALinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "GAState.h"

#include <sstream>
#include <errno.h>
#include <linux/unistd.h>
#include <linux/kernel.h>
Expand Down