<commit_before>## GodotFireBase
Godot_FireBase is a firebase integration for godot android;

# Depends on
> Godot game engine (2.1/2.2-legacy): `git clone https://github.com/godotengine/godot`

> GodotSQL: `git clone https://github.com/FrogLogics/GodotSQL`

# Available Features
> AdMob

> Analytics

> Authentication [W.I.P] Google, Facebook

> Firebase Notification

> RemoteConfig

> Storage

> Invites (Email & SMS)

# Build/Compile module
copy your `google-services.json` file to `[GODOT-ROOT]/platform/android/java/` and edit file modules/FireBase/config.py at line 17
```
env.android_add_default_config("applicationId 'com.your.appid'")
```
replay `com.your.appid` with you android application id.

# Initialize FireBase
Edit engine.cfg and add
```
[android]
modules="org/godotengine/godot/FireBase"
```

RemoteConfigs default parameters `.xml` file is at `[GODOT-ROOT]/modules/FireBase/res/xml/remote_config_defaults.xml`

# GDScript - getting module singleton and initializing;
```
var firebase = Globals.get_singleton("FireBase");
```
For Analytics only `firebase.init("", get_instance_id());` or to user RemoteConfig or Notifications (subscribing to topic)

# GodotFireBase: copy `godot-firebase-config.json` to your projects root directord.
GodotFireBase config file, By default every feature is disabled.
```
{

"AdMob"		 : false,
"Authentication" : false,
"Facebook"	 : false,
"Google"	 : false,
"Invites"	 : false,

"Auth"		 : {
			"Google" : false,			# enable google authentication

			"Facebook" : false,			# enable facebook authentication
			"FacebookAppID" : "1234566789875"	# facebook app id
		   },

"Ads"		 : {
			"BannerAd" : false,			# enable banner Ad (true / false)
			"BannerGravity" : "BOTTOM",		# banner Ad gravity (TOP / BOTTOM)
			"BannerAdID" : "banner_id",		# Banner ad unit id

			"InterstitialAd" : false,		# enable interstitial ad (true / false)
			"InterstitialAdID" : "interstitial_id"	# Interstitial ad unit id

			"RewardedVideoAd" : true,		# enable Rewarded video ad
			"RewardedVideoAdID" : ""		# Rewarded Vide ad unit id
		   }

}
```
And  initialize firebase with file path
```
func _ready():
	if OS.get_name() == "Android":
		firebase.initWithFile("res://godot-firebase-config.json", get_instance_id());

func _recive_message(from, key, data):
	from == "FireBase":
		print("Key: " + key, " Data: ", data)

```
# Using FireBase Analytics
```
firebase.sendCustom("TestKey", "SomeValue");

firebase.setScreenName("Screen_name")
firebase.sendAchievement("someAchievementId")		# unlock achievement
firebase.join_group("clan_name")			# join clan/group
firebase.level_up("character_name", level)		# send character level
firebase.post_score("charcter name", level, score)	# post your score
firebase.earn_currency("currency", amount);		# when play earn some virtual currency gold/Diamond/any
firebase.spend_currency("item_id", "currency", amount)	# when user spend virtual currency

firebase.tutorial_begin()				# tutorial begin
firebase.tutorial_complete()				# tutorial end

Reference: https://support.google.com/firebase/answer/6317494?hl=en
```

# AlertDialog aditional
```
firebase.alert("Message goes here..!");
```

# Authentication

For Facebook edit `res/values/ids.xml` and replace facebook_app_id with your Facebook App Id
```
firebase.authConfig("'Google':true,'Facebook':true") // Configure Auth service

firebase.google_sign_in() // Firebase connect to google.
firebase.facebook_sign_in() // Firebase connect to facebook.

firebase.google_sign_out() // Firebase disconnect from google.
firebase.facebook_sign_out() // Firebase disconnect from facebook.

var gUserDetails = firebase.get_google_user() // returns name, email_id, photo_uri
var fbUserDetails = firebase.get_facebook_user() // returns name, email_id, photo_uri

firebase.google_revoke_access();
firebase.facebook_revoke_access();
```

Recive message from java

```
func _recive_message(from, key, data):
	from == "FireBase":
		if key == "GoogleLogin" && data == "true": print("User Signed in.");
		if key == "FacebookLogin" && data == "true": print("User Signed in.");
```

# Firebase Notification API
```
firebase.subscribeToTopic("topic") // Subscribe to particular topic.
firebase.getToken() // Get current client TokenID

If recived notifiction has a payload, it will be saved inside SQL Database under key: "firebase_notification_data"<commit_msg>Updating README.md<commit_after>## GodotFireBase
Godot_FireBase is a firebase integration for godot android;

# Depends on
> Godot game engine (2.1/2.2-legacy): `git clone https://github.com/godotengine/godot`

> GodotSQL: `git clone https://github.com/FrogLogics/GodotSQL`

# Available Features
> AdMob

> Analytics

> Authentication [W.I.P] Google, Facebook

> Firebase Notification

> RemoteConfig

> Storage

> Invites (Email & SMS)

# Build/Compile module
copy your `google-services.json` file to `[GODOT-ROOT]/platform/android/java/` and edit file modules/FireBase/config.py at line 17
```
env.android_add_default_config("applicationId 'com.your.appid'")
```
replay `com.your.appid` with you android application id.

# Initialize FireBase
Edit engine.cfg and add
```
[android]
modules="org/godotengine/godot/FireBase"
```

RemoteConfigs default parameters `.xml` file is at `[GODOT-ROOT]/modules/FireBase/res/xml/remote_config_defaults.xml`

# GDScript - getting module singleton and initializing;
```
var firebase = Globals.get_singleton("FireBase");
```
For Analytics only `firebase.init("", get_instance_id());` or to user RemoteConfig or Notifications (subscribing to topic)

# GodotFireBase: copy `godot-firebase-config.json` to your projects root directord.
GodotFireBase config file, By default every feature is disabled.
```
{

"AdMob"		 : true,
"Authentication" : true,
"Invites"	 : true,
"RemoteConfig"	 : true,
"Notification"	 : true,
"Storage"	 : true,

"Auth"		 : {
			"Google" : true,

			"Facebook" : true,
			"FacebookAppID" : "1234566789875"
		   },

"Ads"		 : {
			"BannerAd" : true,
			"BannerGravity" : "BOTTOM",
			"BannerAdID" : "",

			"InterstitialAd" : true,
			"InterstitialAdID" : "",

			"RewardedVideoAd" : true,
			"RewardedVideoAdID" : ""
		   }

}
```
And  initialize firebase with file path
```
func _ready():
	if OS.get_name() == "Android":
		firebase.initWithFile("res://godot-firebase-config.json", get_instance_id());

func _recive_message(from, key, data):
	from == "FireBase":
		print("Key: " + key, " Data: ", data)

```
# Using FireBase Analytics
```
firebase.sendCustom("TestKey", "SomeValue");

firebase.setScreenName("Screen_name")
firebase.sendAchievement("someAchievementId")		# unlock achievement
firebase.join_group("clan_name")			# join clan/group
firebase.level_up("character_name", level)		# send character level
firebase.post_score("charcter name", level, score)	# post your score
firebase.earn_currency("currency", amount);		# when play earn some virtual currency gold/Diamond/any
firebase.spend_currency("item_id", "currency", amount)	# when user spend virtual currency

firebase.tutorial_begin()				# tutorial begin
firebase.tutorial_complete()				# tutorial end

Reference: https://support.google.com/firebase/answer/6317494?hl=en
```

# AlertDialog aditional
```
firebase.alert("Message goes here..!");
```

# Authentication

For Facebook edit `res/values/ids.xml` and replace facebook_app_id with your Facebook App Id
```
firebase.authConfig("'Google':true,'Facebook':true") // Configure Auth service

firebase.google_sign_in() // Firebase connect to google.
firebase.facebook_sign_in() // Firebase connect to facebook.

firebase.google_sign_out() // Firebase disconnect from google.
firebase.facebook_sign_out() // Firebase disconnect from facebook.

var gUserDetails = firebase.get_google_user() // returns name, email_id, photo_uri
var fbUserDetails = firebase.get_facebook_user() // returns name, email_id, photo_uri

firebase.google_revoke_access();
firebase.facebook_revoke_access();

firebase.is_google_connected() // bool check for google authentication
firebase.is_facebook_connected() // bool check for facebook authentication
```

Recive message from java

```
func _recive_message(from, key, data):
	from == "FireBase":
		if key == "GoogleLogin" && data == "true": print("User Signed in.");
		if key == "FacebookLogin" && data == "true": print("User Signed in.");
```

# Firebase Notification API
```
firebase.subscribeToTopic("topic") // Subscribe to particular topic.
firebase.getToken() // Get current client TokenID

If recived notifiction has a payload, it will be saved inside SQL Database under key: "firebase_notification_data"
{'fraction_non_alphanumeric': 0.13096209912536444, 'fraction_numerical': 0.006064139941690962, 'mean_word_length': 5.047954866008463, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4343536', 'n_tokens_mistral': 2959, 'n_tokens_neox': 2742, 'n_words': 721}