Skip to content
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

Dev/delivery 70570/update to 6.15.2 #48

Merged
merged 10 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions AppIcon.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
15 changes: 15 additions & 0 deletions AppIcon.xcassets/Icon-180.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "Icon-180.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Binary file added AppIcon.xcassets/Icon-180.imageset/Icon-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 20 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ project(${APP_NAME})
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d)
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)

# Print the values
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "COCOS2DX_ROOT_PATH: ${COCOS2DX_ROOT_PATH}")
message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
message(STATUS "COCOS2DX_ROOT_PATH: ${COCOS2DX_ROOT_PATH}")
message(STATUS "Is ANDROID?: ${ANDROID}")

include(CocosBuildSet)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)

Expand All @@ -49,22 +56,28 @@ endif()
# add cross-platforms source files and header files
list(APPEND GAME_SOURCE
Classes/AppsFlyer/AppsFlyerX.cpp
Classes/AppsFlyer/AppsFlyerXAndroid.cpp
Classes/AppsFlyer/AppsFlyerProxyX.cpp
Classes/AppDelegate.cpp
Classes/HelloWorldScene.cpp
Classes/AppsFlyer/AppsFlyerXDeepLinkResult.cpp
)
list(APPEND GAME_HEADER
Classes/AppsFlyer/AppsFlyerX.h
Classes/AppsFlyer/AppsFlyerXAndroid.h
Classes/AppsFlyer/AppsFlyerProxyX.h
Classes/AppDelegate.h
Classes/HelloWorldScene.h
Classes/AppsFlyer/AppsFlyerXDeepLinkResult.h
)

if(ANDROID)
list(APPEND GAME_SOURCE
Classes/AppsFlyer/AppsFlyerXAndroid.cpp
Classes/AppsFlyer/AppsFlyerProxyX.cpp
)

list(APPEND GAME_HEADER
Classes/AppsFlyer/AppsFlyerXAndroid.h
Classes/AppsFlyer/AppsFlyerProxyX.h
)

# change APP_NAME to the share library name for Android, it's value depend on AndroidManifest.xml
set(APP_NAME MyGame)
list(APPEND GAME_SOURCE
Expand All @@ -90,11 +103,13 @@ elseif(APPLE)
proj.ios_mac/ios/AppController.h
proj.ios_mac/ios/RootViewController.h
)

set(APP_UI_RES
proj.ios_mac/ios/LaunchScreen.storyboard
proj.ios_mac/ios/LaunchScreenBackground.png
proj.ios_mac/ios/Images.xcassets
)

list(APPEND GAME_SOURCE
proj.ios_mac/ios/main.m
proj.ios_mac/ios/AppController.mm
Expand Down Expand Up @@ -145,7 +160,7 @@ if(APPLE)
)
elseif(IOS)
cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in")
set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
# set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "")
set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer")
endif()
Expand Down
86 changes: 86 additions & 0 deletions Classes/AppsFlyer/AFSDKXPurchaseDetails.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
//
// AFSDKXPurchaseDetails.cpp
// MyGame
//
// Created by ivan.obodovskyi on 02.10.2024.
//

#include <stdio.h>
#include "AFSDKXPurchaseDetails.h"

AFSDKXPurchaseDetails::AFSDKXPurchaseDetails(const AFXPurchaseType &purchaseType,
const std::string &purchaseToken,
const std::string &productId,
const std::string &price,
const std::string &currency,
const std::string &transactionId)
:purchaseType_(purchaseType),
purchaseToken_(purchaseToken),
productId_(productId),
price_(price),
currency_(currency),
transactionId_(transactionId) {
}

std::string AFSDKXPurchaseDetails::getProductId() const {
return productId_;
}

void AFSDKXPurchaseDetails::setProductId(const std::string &productId) {
productId_ = productId;
}

std::string AFSDKXPurchaseDetails::getPrice() const {
return price_;
}

void AFSDKXPurchaseDetails::setPrice(const std::string &price) {
price_ = price;
}

std::string AFSDKXPurchaseDetails::getCurrency() const {
return currency_;
}

void AFSDKXPurchaseDetails::setCurrency(const std::string &currency) {
currency_ = currency;
}

std::string AFSDKXPurchaseDetails::getTransactionId() const {
return transactionId_;
}

void AFSDKXPurchaseDetails::setTransactionId(const std::string &transactionId) {
transactionId_ = transactionId;
}

std::string AFSDKXPurchaseDetails::getPurchaseToken() const {
return purchaseToken_;
}

void AFSDKXPurchaseDetails::setPurchaseToken(const std::string &purchaseToken) {
purchaseToken_ = purchaseToken;
}

std::string AFSDKXPurchaseDetails::getPurchaseType() const {
std::string purchaseTypeStr = purchaseTypeToString();
return purchaseTypeStr;
}

void AFSDKXPurchaseDetails::setPurchaseType(AFXPurchaseType &purchaseType) {
purchaseType_ = purchaseType;
}

// Function to get the string value of the enum
std::string AFSDKXPurchaseDetails::purchaseTypeToString() const{
switch (purchaseType_) {
case AFXPurchaseType::SUBSCRIPTION:
return "subscription";
case AFXPurchaseType::ONE_TIME_PURCHASE:
return "one_time_purchase";
case AFXPurchaseType::APPLE:
return "";
default:
return "";
}
}
74 changes: 74 additions & 0 deletions Classes/AppsFlyer/AFSDKXPurchaseDetails.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//
// AFSDKXPurchaseDetails.h
// MyGame
//
// Created by ivan.obodovskyi on 02.10.2024.
//

#ifndef AFSDKXPurchaseDetails_h
#define AFSDKXPurchaseDetails_h

#include <string>
#include "cocos2d.h"
#include "AFSDKXValidateAndLogResult.h"

enum class AFXPurchaseType {
SUBSCRIPTION,
ONE_TIME_PURCHASE,
APPLE
};


class AFSDKXPurchaseDetails {
public:
// Deleted default constructor to prevent usage.
AFSDKXPurchaseDetails() = delete;

// Constructor with parameters to initialize the properties.
AFSDKXPurchaseDetails(const AFXPurchaseType &purchaseType,
const std::string &purchaseToken,
const std::string &productId,
const std::string &price,
const std::string &currency,
const std::string &transactionId);

// Default destructor.
virtual ~AFSDKXPurchaseDetails() = default;

// Public assignment and copy constructors
AFSDKXPurchaseDetails(const AFSDKXPurchaseDetails &) = default;
AFSDKXPurchaseDetails &operator=(const AFSDKXPurchaseDetails &) = default;

// Getters and setters for private member variables.
std::string getProductId() const;
void setProductId(const std::string &productId);

std::string getPrice() const;
void setPrice(const std::string &price);

std::string getCurrency() const;
void setCurrency(const std::string &currency);

std::string getTransactionId() const;
void setTransactionId(const std::string &transactionId);

// Propperties related to Android impl
// For Apple implementation, please pass APPLE, it will be interpreted as an empty string
std::string purchaseTypeToString() const;
std::string getPurchaseType() const;
void setPurchaseType(AFXPurchaseType &purchaseType);

// Android purchase token, for iOS impl, please use empty string
std::string getPurchaseToken() const;
void setPurchaseToken(const std::string &purchaseToken);

private:
// Private member variables.
std::string productId_;
std::string price_;
std::string currency_;
std::string transactionId_;
std::string purchaseToken_;
AFXPurchaseType purchaseType_;
};
#endif /* AFSDKXPurchaseDetails_h */
50 changes: 50 additions & 0 deletions Classes/AppsFlyer/AFSDKXValidateAndLogResult.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// AFSDKXValidateAndLogResult.cpp
// MyGame
//
// Created by ivan.obodovskyi on 03.10.2024.
//

#include <stdio.h>
#include "AFSDKXValidateAndLogResult.h"

// Constructor implementation.
AFSDKXValidateAndLogResult::AFSDKXValidateAndLogResult(
AFSDKXValidateAndLogStatus status,
const cocos2d::ValueMap& result,
const cocos2d::ValueMap& errorData,
const cocos2d::ValueMap& error)
: status_(status), result_(result), errorData_(errorData), error_(error) {
}

// Getter methods implementation.
AFSDKXValidateAndLogStatus AFSDKXValidateAndLogResult::getStatus() const {
return status_;
}

cocos2d::ValueMap AFSDKXValidateAndLogResult::getResult() const {
return result_;
}

cocos2d::ValueMap AFSDKXValidateAndLogResult::getErrorData() const {
return errorData_;
}

cocos2d::ValueMap AFSDKXValidateAndLogResult::getError() const {
return error_;
}

// Function to map Objective-C enum to C++ enum
AFSDKXValidateAndLogStatus AFSDKXValidateAndLogResult::objcEnumToCppEnum(int objcStatus) {
switch (objcStatus) {
case 0:
return AFSDKXValidateAndLogStatus::Success;
case 1:
return AFSDKXValidateAndLogStatus::Failure;
case 2:
return AFSDKXValidateAndLogStatus::Error;
default:
// Handle unknown cases, or return a default value
return AFSDKXValidateAndLogStatus::Error;
}
}
54 changes: 54 additions & 0 deletions Classes/AppsFlyer/AFSDKXValidateAndLogResult.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// AFSDKXValidateAndLogResult.h
// MyGame
//
// Created by ivan.obodovskyi on 03.10.2024.
//

#ifndef AFSDKXValidateAndLogResult_h
#define AFSDKXValidateAndLogResult_h

#include <cocos2d.h>
#include <unordered_map>
#include <string>
#include <memory>
#include <optional>

// Assuming an error class similar to NSError exists in your C++ code.
class Error;

// Enum to represent validation status
enum class AFSDKXValidateAndLogStatus {
Success,
Failure,
Error
};

class AFSDKXValidateAndLogResult {
public:
// Deleting default constructor to prevent usage.
AFSDKXValidateAndLogResult() = delete;

// Constructor with initialization list.
AFSDKXValidateAndLogResult(AFSDKXValidateAndLogStatus status,
const cocos2d::ValueMap& result,
const cocos2d::ValueMap& errorData,
const cocos2d::ValueMap& error);

// Getter methods
AFSDKXValidateAndLogStatus getStatus() const;
static AFSDKXValidateAndLogStatus objcEnumToCppEnum(int objcStatus);
cocos2d::ValueMap getResult() const;
cocos2d::ValueMap getErrorData() const;
cocos2d::ValueMap getError() const;


private:
// Member variables.
AFSDKXValidateAndLogStatus status_;
cocos2d::ValueMap result_;
cocos2d::ValueMap errorData_;
cocos2d::ValueMap error_;
};

#endif /* AFSDKXValidateAndLogResult_h */
Loading
Loading