Skip to content

Commit

Permalink
Added debug log for iOS
Browse files Browse the repository at this point in the history
Added Apple App ID in plugin settings
  • Loading branch information
DrMoriarty committed Jan 6, 2021
1 parent c83ed72 commit deae0ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions ios-framework/gdnative_ios/src/AppsFlyer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@
{
}

void AppsFlyer::init(const String key, const String appId)
void AppsFlyer::init(const String key, const String appId, bool production)
{
NSString *strKey = [NSString stringWithUTF8String:key.utf8().get_data()];
NSString *strAppId = [NSString stringWithUTF8String:appId.utf8().get_data()];

[AppsFlyerLib shared].appsFlyerDevKey = strKey;
[AppsFlyerLib shared].appleAppID = strAppId;
[AppsFlyerLib shared].delegate = nil;
#ifdef DEBUG_ENABLED
[AppsFlyerLib shared].isDebug = YES;
#endif
if(!production) {
[AppsFlyerLib shared].isDebug = YES;
}
}

void AppsFlyer::trackEvent(const String event, const Dictionary params)
Expand Down
5 changes: 4 additions & 1 deletion nativelib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "appsflyer",
"description": "AppsFlyer plugin for Godot engine",
"version": "0.2.0",
"version": "0.2.1",
"license": "MIT",
"url": "https://github.com/DrMoriarty/godot-appsflyer.git",
"dependencies": [
Expand All @@ -14,6 +14,9 @@
"variables": {
"AppsFlyer/DevKey": {
"info": "Set your DevKey here"
},
"AppsFlyer/APP_ID": {
"info": "Set your Apple App ID here"
}
},
"autoload": {
Expand Down
5 changes: 3 additions & 2 deletions scripts/appsflyer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func _ready():
app_id = ProjectSettings.get_setting('AppsFlyer/APP_ID')
if app_key == null:
push_warning('You need to init AppsFlyer with app_key before using')
elif app_key != null and app_id != null and app_id != '':
elif app_key != null and app_id != null and app_id != '' and OS.get_name() == 'iOS':
init_with_id(app_key, app_id)
else:
init(app_key)
Expand All @@ -36,8 +36,9 @@ func init(app_key: String) -> void:

func init_with_id(app_key: String, app_id: String) -> void:
if _i != null:
var production = !OS.is_debug_build()
print('AppsFlyer plugin inited with key and app id')
_i.init(app_key, app_id)
_i.init(app_key, app_id, production)

func screen(name: String, screen_type: String) -> void:
_track_event('af_content_view', {'af_content': name, 'af_content_type': screen_type})
Expand Down

0 comments on commit deae0ce

Please sign in to comment.