Skip to content

Commit 4980442

Browse files
AGulevSippul
andauthored
Remove FIR cpp SDK (#12)
* Remove FIR cpp SDK (#11) * fix spaces and doc * Revert "Auxiliary commit to revert individual files from cf8140f" This reverts commit a1f140fa1e45aa2ff1bf34e147eb2ed9b56b7928. * restire options and change documentation * finish android implementation * fix ios * remove cpp flags * fix initialization on android * fix missed context * fix readme * resotre luautils * comment out unused luautils * comment out unused luautils --------- Co-authored-by: Sippul <[email protected]>
1 parent 96d4313 commit 4980442

File tree

105 files changed

+886
-21665
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+886
-21665
lines changed

README.md

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,16 @@
11
[![Actions Status Alpha](https://github.com/defold/extension-firebase/actions/workflows/bob.yml/badge.svg)](https://github.com/defold/extension-firebase/actions)
22

3-
![](https://img.shields.io/badge/Firebase%20CPP%20SDK-8.10.0-green)
4-
![](https://img.shields.io/badge/Firebase%20iOS%20SDK-8.13.0-green)
5-
6-
73
# Firebase
84
Firebase is Google's mobile platform that helps you quickly develop high-quality apps and grow your business. This repository contains the core components required by the various products included in Firebase. It is not intended for use on its own.
95

106
---
117

12-
## Development notes
13-
Use this guide when setting up or upgrading this core extension and the extensions for each of the Firebase products (such as analytics and remote config). The extensions are using the [Firebase C++ SDK](https://firebase.google.com/docs/cpp/setup) and the [Firebase iOS SDK](https://github.com/firebase/firebase-ios-sdk).
14-
15-
* Firebase C++ SDK download link: https://firebase.google.com/download/cpp
16-
* Firebase C++ SDK direct download link: https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_8.8.0.zip
17-
18-
### Copy includes
19-
Copy header files from `firebase_cpp_sdk/include`.
20-
21-
228
### Configure Android Gradle dependencies
23-
The Gradle dependencies used by this extension need to match the ones specified in the Firebase C++ SDK.
24-
9+
The Gradle dependencies used by this extension need to match the ones specified in the [Release Notes](https://firebase.google.com/support/releases)
2510
* Add Gradle dependencies to `extension/manifests/android/build.gradle`
26-
* Specified in `firebase_cpp_sdk/Android/firebase_dependencies.gradle` -> [`firebaseDependenciesMap`](https://github.com/firebase/firebase-cpp-sdk/blob/v7.3.0/release_build_files/Android/firebase_dependencies.gradle)
27-
* Or in [`firebase_cpp_sdk/readme.md`](https://raw.githubusercontent.com/firebase/firebase-cpp-sdk/v7.3.0/release_build_files/readme.md)
28-
29-
30-
#### Copy Android C++ library dependencies
31-
Android C++ libraries should be copied from the Firebase C++ SDK to your extension.
32-
33-
* Copy libs from Firebase C++ SDK
34-
* `firebase_cpp_sdk/libs/android/armeabi-v7a/c++/*`
35-
* `firebase_cpp_sdk/libs/android/arm64-v8a/c++/*`
3611

3712

3813
### Configure Cocoapod dependencies
39-
The Cocoapod dependencies used by this extension need to match the ones specified in the Firebase C++ SDK.
14+
The Cocoapod dependencies used by this extension need to match the ones specified in the [Release Notes](https://firebase.google.com/support/releases)
4015

4116
* Add Cocoapod dependencies to `extension/manifest/ios/Podfile`
42-
43-
#### Copy iOS C++ library dependencies
44-
iOS C++ libraries should be copied from the Firebase C++ SDK to your extension.
45-
46-
* Copy libs from the Firebase C++ SDK
47-
* `firebase_cpp_sdk/libs/ios/device-arm64/` -> `extension/lib/arm64-ios/`
48-
* `firebase_cpp_sdk/libs/ios/device-armv7/` -> `extension/lib/armv7-ios/`
49-
* `firebase_cpp_sdk/libs/ios/simulator-x86_64/` -> `extension/lib/x86_64-ios/`

docs/index.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,23 @@ $ ./generate_xml_from_google_services_json.py -i google-services.json -o google-
8787
function init(self)
8888
-- use firebase only if it is supported on the current platform
8989
if firebase then
90-
local ok, err = firebase.init()
91-
if not ok then
92-
print(err)
93-
return
94-
end
95-
96-
-- firebase is ready to use!
97-
98-
-- installation auth token can be used for configuring test devices for A/B tests
99-
firebase.get_installation_auth_token(function(self, token)
100-
print("installation auth token is " .. token)
90+
firebase.set_callback(function(self, message_id, message)
91+
if message_id == firebase.MSG_INITIALIZED then
92+
-- firebase is ready to use!
93+
94+
-- installation auth token can be used for configuring test devices for A/B tests
95+
firebase.get_installation_auth_token()
96+
-- retrieve Firebase installation ID for example, to create segments of app installs for BiqQuery import,
97+
-- or toperform testing during Firebase In-App Messaging development,
98+
-- you can identify and target the correct devices using the corresponding Firebase installation IDs.
99+
firebase.get_installation_id()
100+
elseif message_id == firebase.MSG_INSTALLATION_ID then
101+
print("id:", message.id)
102+
elseif message_id == firebase.MSG_INSTALLATION_AUTH_TOKEN then
103+
print("token:", message.token)
104+
elseif message_id == firebase.MSG_ERROR then
105+
print("ERROR:", message.error)
106+
end
101107
end)
102108
end
103109
end

example/example.collection

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@ name: "default"
22
scale_along_z: 0
33
embedded_instances {
44
id: "go"
5-
data: ""
5+
data: "components {\n"
6+
" id: \"example\"\n"
7+
" component: \"/example/example.script\"\n"
8+
" position {\n"
9+
" x: 0.0\n"
10+
" y: 0.0\n"
11+
" z: 0.0\n"
12+
" }\n"
13+
" rotation {\n"
14+
" x: 0.0\n"
15+
" y: 0.0\n"
16+
" z: 0.0\n"
17+
" w: 1.0\n"
18+
" }\n"
19+
" property_decls {\n"
20+
" }\n"
21+
"}\n"
22+
""
623
position {
724
x: 0.0
825
y: 0.0

example/example.script

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
function init(self)
2-
if firebase then
3-
firebase.init()
4-
end
2+
if firebase then
3+
firebase.set_callback(function(self, message_id, message)
4+
if message_id == firebase.MSG_INITIALIZED then
5+
firebase.get_installation_auth_token()
6+
firebase.get_installation_id()
7+
elseif message_id == firebase.MSG_INSTALLATION_ID then
8+
print("id:", message.id)
9+
elseif message_id == firebase.MSG_INSTALLATION_AUTH_TOKEN then
10+
print("token:", message.token)
11+
elseif message_id == firebase.MSG_ERROR then
12+
print("ERROR:", message.error)
13+
end
14+
end)
15+
firebase.initialize()
16+
end
517
end

firebase/api/firebase.script_api

Lines changed: 95 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,95 @@
1-
- name: firebase
2-
type: table
3-
desc: Functions and constants for interacting with Firebase
4-
5-
members:
6-
- name: init
7-
type: function
8-
desc: Initialise Firebase
9-
10-
parameters:
11-
- name: options
12-
optional: true
13-
type: table
14-
desc: Optional table with initialisation parameters to use instead of those specified in google-services.xml/plist
15-
When passing this, disable creation of the default Firebase App by specifying firebase.no_auto_init in game.project
16-
Valid keys in the table are api_key, app_id, database_url, messaging_sender_id, project_id, storage_bucket. All values are strings.
17-
18-
return:
19-
- name: success
20-
type: boolean
21-
desc: Indicates if initialisation was successful
22-
- name: error
23-
type: string
24-
desc: Error message if initialisation failed
25-
26-
- name: get_installation_auth_token
27-
type: function
28-
desc: Get the Firebase Installation auth token
29-
30-
parameters:
31-
- name: callback
32-
type: function
33-
desc: Function to invoke with the auth token (self, token)
1+
- name: firebase
2+
type: table
3+
desc: Functions and constants for interacting with Firebase
4+
5+
#*****************************************************************************************************
6+
7+
members:
8+
- name: initialize
9+
type: function
10+
desc: Initialise Firebase
11+
12+
parameters:
13+
- name: options
14+
optional: true
15+
type: table
16+
desc: Optional table with initialisation parameters to use instead of those specified in google-services.xml/plist
17+
When passing this, disable creation of the default Firebase App by specifying firebase.no_auto_init in game.project
18+
Valid keys in the table are api_key, app_id, database_url, messaging_sender_id, project_id, storage_bucket. All values are strings.
19+
20+
return:
21+
- name: success
22+
type: boolean
23+
desc: Indicates if initialisation was successful
24+
- name: error
25+
type: string
26+
desc: Error message if initialisation failed
27+
28+
#*****************************************************************************************************
29+
30+
- name: get_installation_auth_token
31+
type: function
32+
desc: Get the Firebase Installation auth token
33+
34+
#*****************************************************************************************************
35+
36+
- name: set_callback
37+
type: function
38+
desc: Sets a callback function for receiving events from the SDK. Call `firebase.set_callback(nil)`
39+
to remove callback
40+
parameters:
41+
- name: callback
42+
type: function
43+
desc: Callback function that is executed on any event in the SDK.
44+
45+
parameters:
46+
- name: self
47+
type: object
48+
desc: The calling script instance
49+
50+
- name: message_id
51+
type: number
52+
desc: "One of message types:
53+
`firebase.MSG_INITIALIZED`
54+
`firebase.MSG_INSTALLATION_AUTH_TOKEN`
55+
`firebase.MSG_INSTALLATION_ID`
56+
`firebase.MSG_ERROR`"
57+
58+
- name: message
59+
type: table
60+
desc: A table holding the data
61+
fields:
62+
- name: token
63+
type: number
64+
desc: for MSG_INSTALLATION_AUTH_TOKEN
65+
66+
- name: id
67+
type: number
68+
desc: for MSG_INSTALLATION_ID
69+
70+
- name: error
71+
type: string
72+
optional: true
73+
desc: The error message (if an error occurred or `nil` otherwise)
74+
75+
#*****************************************************************************************************
76+
77+
- name: get_installation_id
78+
type: function
79+
desc: Get the Firebase Installation id
80+
81+
#*****************************************************************************************************
82+
83+
- name: MSG_ERROR
84+
type: number
85+
86+
- name: MSG_INITIALIZED
87+
type: number
88+
89+
- name: MSG_INSTALLATION_AUTH_TOKEN
90+
type: number
91+
92+
- name: MSG_INSTALLATION_ID
93+
type: number
94+
95+
#*****************************************************************************************************

firebase/ext.manifest

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
1-
name: "Firebase"
1+
name: "FirebaseExt"
22

33
platforms:
44
android:
55
context:
66
aaptExtraPackages: ['com.google.android.gms.common']
7-
8-
arm64-android:
9-
context:
10-
flags: ["-std=c++11"]
11-
12-
armv7-android:
13-
context:
14-
flags: ["-std=c++11"]
15-
16-
armv7-ios:
17-
context:
18-
flags: ["-std=c++11"]
19-
20-
arm64-ios:
21-
context:
22-
flags: ["-std=c++11"]
23-
24-
x86_64-ios:
25-
context:
26-
flags: ["-std=c++11"]

firebase/include/firebase.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)