Skip to content

Commit

Permalink
Remove FIR cpp SDK (#12)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
AGulev and Sippul authored Jan 18, 2024
1 parent 96d4313 commit 4980442
Show file tree
Hide file tree
Showing 105 changed files with 886 additions and 21,665 deletions.
37 changes: 2 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,16 @@
[![Actions Status Alpha](https://github.com/defold/extension-firebase/actions/workflows/bob.yml/badge.svg)](https://github.com/defold/extension-firebase/actions)

![](https://img.shields.io/badge/Firebase%20CPP%20SDK-8.10.0-green)
![](https://img.shields.io/badge/Firebase%20iOS%20SDK-8.13.0-green)


# Firebase
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.

---

## Development notes
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).

* Firebase C++ SDK download link: https://firebase.google.com/download/cpp
* Firebase C++ SDK direct download link: https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_8.8.0.zip

### Copy includes
Copy header files from `firebase_cpp_sdk/include`.


### Configure Android Gradle dependencies
The Gradle dependencies used by this extension need to match the ones specified in the Firebase C++ SDK.

The Gradle dependencies used by this extension need to match the ones specified in the [Release Notes](https://firebase.google.com/support/releases)
* Add Gradle dependencies to `extension/manifests/android/build.gradle`
* 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)
* Or in [`firebase_cpp_sdk/readme.md`](https://raw.githubusercontent.com/firebase/firebase-cpp-sdk/v7.3.0/release_build_files/readme.md)


#### Copy Android C++ library dependencies
Android C++ libraries should be copied from the Firebase C++ SDK to your extension.

* Copy libs from Firebase C++ SDK
* `firebase_cpp_sdk/libs/android/armeabi-v7a/c++/*`
* `firebase_cpp_sdk/libs/android/arm64-v8a/c++/*`


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

* Add Cocoapod dependencies to `extension/manifest/ios/Podfile`

#### Copy iOS C++ library dependencies
iOS C++ libraries should be copied from the Firebase C++ SDK to your extension.

* Copy libs from the Firebase C++ SDK
* `firebase_cpp_sdk/libs/ios/device-arm64/` -> `extension/lib/arm64-ios/`
* `firebase_cpp_sdk/libs/ios/device-armv7/` -> `extension/lib/armv7-ios/`
* `firebase_cpp_sdk/libs/ios/simulator-x86_64/` -> `extension/lib/x86_64-ios/`
28 changes: 17 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,23 @@ $ ./generate_xml_from_google_services_json.py -i google-services.json -o google-
function init(self)
-- use firebase only if it is supported on the current platform
if firebase then
local ok, err = firebase.init()
if not ok then
print(err)
return
end

-- firebase is ready to use!

-- installation auth token can be used for configuring test devices for A/B tests
firebase.get_installation_auth_token(function(self, token)
print("installation auth token is " .. token)
firebase.set_callback(function(self, message_id, message)
if message_id == firebase.MSG_INITIALIZED then
-- firebase is ready to use!

-- installation auth token can be used for configuring test devices for A/B tests
firebase.get_installation_auth_token()
-- retrieve Firebase installation ID for example, to create segments of app installs for BiqQuery import,
-- or toperform testing during Firebase In-App Messaging development,
-- you can identify and target the correct devices using the corresponding Firebase installation IDs.
firebase.get_installation_id()
elseif message_id == firebase.MSG_INSTALLATION_ID then
print("id:", message.id)
elseif message_id == firebase.MSG_INSTALLATION_AUTH_TOKEN then
print("token:", message.token)
elseif message_id == firebase.MSG_ERROR then
print("ERROR:", message.error)
end
end)
end
end
Expand Down
19 changes: 18 additions & 1 deletion example/example.collection
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@ name: "default"
scale_along_z: 0
embedded_instances {
id: "go"
data: ""
data: "components {\n"
" id: \"example\"\n"
" component: \"/example/example.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
" property_decls {\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
Expand Down
18 changes: 15 additions & 3 deletions example/example.script
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
function init(self)
if firebase then
firebase.init()
end
if firebase then
firebase.set_callback(function(self, message_id, message)
if message_id == firebase.MSG_INITIALIZED then
firebase.get_installation_auth_token()
firebase.get_installation_id()
elseif message_id == firebase.MSG_INSTALLATION_ID then
print("id:", message.id)
elseif message_id == firebase.MSG_INSTALLATION_AUTH_TOKEN then
print("token:", message.token)
elseif message_id == firebase.MSG_ERROR then
print("ERROR:", message.error)
end
end)
firebase.initialize()
end
end
128 changes: 95 additions & 33 deletions firebase/api/firebase.script_api
Original file line number Diff line number Diff line change
@@ -1,33 +1,95 @@
- name: firebase
type: table
desc: Functions and constants for interacting with Firebase

members:
- name: init
type: function
desc: Initialise Firebase

parameters:
- name: options
optional: true
type: table
desc: Optional table with initialisation parameters to use instead of those specified in google-services.xml/plist
When passing this, disable creation of the default Firebase App by specifying firebase.no_auto_init in game.project
Valid keys in the table are api_key, app_id, database_url, messaging_sender_id, project_id, storage_bucket. All values are strings.

return:
- name: success
type: boolean
desc: Indicates if initialisation was successful
- name: error
type: string
desc: Error message if initialisation failed

- name: get_installation_auth_token
type: function
desc: Get the Firebase Installation auth token

parameters:
- name: callback
type: function
desc: Function to invoke with the auth token (self, token)
- name: firebase
type: table
desc: Functions and constants for interacting with Firebase

#*****************************************************************************************************

members:
- name: initialize
type: function
desc: Initialise Firebase

parameters:
- name: options
optional: true
type: table
desc: Optional table with initialisation parameters to use instead of those specified in google-services.xml/plist
When passing this, disable creation of the default Firebase App by specifying firebase.no_auto_init in game.project
Valid keys in the table are api_key, app_id, database_url, messaging_sender_id, project_id, storage_bucket. All values are strings.

return:
- name: success
type: boolean
desc: Indicates if initialisation was successful
- name: error
type: string
desc: Error message if initialisation failed

#*****************************************************************************************************

- name: get_installation_auth_token
type: function
desc: Get the Firebase Installation auth token

#*****************************************************************************************************

- name: set_callback
type: function
desc: Sets a callback function for receiving events from the SDK. Call `firebase.set_callback(nil)`
to remove callback
parameters:
- name: callback
type: function
desc: Callback function that is executed on any event in the SDK.

parameters:
- name: self
type: object
desc: The calling script instance

- name: message_id
type: number
desc: "One of message types:
`firebase.MSG_INITIALIZED`
`firebase.MSG_INSTALLATION_AUTH_TOKEN`
`firebase.MSG_INSTALLATION_ID`
`firebase.MSG_ERROR`"

- name: message
type: table
desc: A table holding the data
fields:
- name: token
type: number
desc: for MSG_INSTALLATION_AUTH_TOKEN

- name: id
type: number
desc: for MSG_INSTALLATION_ID

- name: error
type: string
optional: true
desc: The error message (if an error occurred or `nil` otherwise)

#*****************************************************************************************************

- name: get_installation_id
type: function
desc: Get the Firebase Installation id

#*****************************************************************************************************

- name: MSG_ERROR
type: number

- name: MSG_INITIALIZED
type: number

- name: MSG_INSTALLATION_AUTH_TOKEN
type: number

- name: MSG_INSTALLATION_ID
type: number

#*****************************************************************************************************
22 changes: 1 addition & 21 deletions firebase/ext.manifest
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
name: "Firebase"
name: "FirebaseExt"

platforms:
android:
context:
aaptExtraPackages: ['com.google.android.gms.common']

arm64-android:
context:
flags: ["-std=c++11"]

armv7-android:
context:
flags: ["-std=c++11"]

armv7-ios:
context:
flags: ["-std=c++11"]

arm64-ios:
context:
flags: ["-std=c++11"]

x86_64-ios:
context:
flags: ["-std=c++11"]
6 changes: 0 additions & 6 deletions firebase/include/firebase.h

This file was deleted.

Loading

0 comments on commit 4980442

Please sign in to comment.