Skip to content

Commit

Permalink
fix gd wrapper & new godot api
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMoriarty committed Feb 19, 2021
1 parent 4d50c29 commit 62ce099
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ public class FirebaseAnalytics extends GodotPlugin {

private final String TAG = FirebaseAnalytics.class.getName();
//final private SignalInfo loadedSignal = new SignalInfo("loaded");
private Godot activity = null;
private boolean _loaded = false;
private com.google.firebase.analytics.FirebaseAnalytics fa;

public FirebaseAnalytics(Godot godot) {
super(godot);
activity = godot;
init();
}

Expand All @@ -55,7 +53,7 @@ public View onMainCreate(Activity activity) {
}

private void init() {
fa = com.google.firebase.analytics.FirebaseAnalytics.getInstance(activity);
fa = com.google.firebase.analytics.FirebaseAnalytics.getInstance(getActivity());
}

public void logEvent(final String event, final Dictionary params) {
Expand Down
2 changes: 1 addition & 1 deletion nativelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "firebase-analytics",
"display_name": "Firebase Analytics",
"description": "Firebase Analytics plugin (also supports Google Analytics with Firebase account)",
"version": "0.1.1",
"version": "0.1.2",
"godot_version": "3.2.3",
"license": "MIT",
"url": "https://github.com/DrMoriarty/godot-firebase-analytics",
Expand Down
7 changes: 5 additions & 2 deletions scripts/fba.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ var _fba = null
# User property names: sign_up_method (str)

func _ready():
if type_exists('FirebaseAnalytics'):
if(Engine.has_singleton("FirebaseAnalytics")):
_fba = Engine.get_singleton("FirebaseAnalytics")
print('FirebaseAnalytics plugin inited!')
elif type_exists('FirebaseAnalytics'):
_fba = ClassDB.instance('FirebaseAnalytics')

print('FirebaseAnalytics plugin inited!')

func screen(name, screen_class='Godot'):
# log game screen
Expand Down

0 comments on commit 62ce099

Please sign in to comment.