Skip to content

Commit

Permalink
Update (#14)
Browse files Browse the repository at this point in the history
* update friend buttons

* update 1.5

* update readme

* update readme

* fix 1.5

* fix 1.5 2
fenix-hub authored May 15, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent dcee53a commit a7ef00f
Showing 35 changed files with 655 additions and 161 deletions.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
![home](./env/screenshots/home.png)
![home](./env/screenshots/home.png)

# Sociadot

**socia.dot** is an open-source frontend for a minimalistic "social netowrk app" proof-of-concept.
It was developed as complete showcase for our [GodotFirebase](https://github.com/GodotNuts/GodotFirebase) addon for Godot Engine, demonstrating various applications of our APIs to interact with Firebase, such as: User Authentication; User management; Firestore, Realtime Database and Storage management and interaction; Offline and Cache management. All these features are currently available and testable just installing our plugin in your own Godot Engine's project and following our tutorials. You can also see how I implemented them just looking at the source code!
Every single feature of this app is working thanks to the perfect blend of Godot Engine's elasticity in being able to easily create fully customizable and programmable user interface components, and all Firebase backend features exposed by our library and supporting multiple protocols and logics.

### socia.dot is:
• open-source: you can just download the source code from Github and modify it in your own Godot Engine proget just to customize your own frontend;
• multiplatform: since it is powered with the FOSS game engine [Godot Engine](https://godotengine.org/), which allows to officialy export binaries for multiple platforms (Windows, Linux, Mac, Android, iOS, HTML), and considering eventual custom export templates for single boarded devices and private platforms, it could work nearly everywhere;
• elastic: together with the ability to export with multiple platforms, interfaces are completely adaptable to any device based on its OS or resolution, just using custom logic in GDScript scripting language;
• serverless: there is no server handling data other than Firebase itself, and being open-sourced socia.dot exposes any information saved on Firebase's databases, from images to chats;
• modular: as said, Firebase interaction is based on our GodotFirebase library, which is being developed and maintained modular by default. Eventually, this service could be replaced by any other market or custom service/dbms, just replacing the script containing all the REST calls ([RequestManager.gd](https://github.com/GodotNuts/FirebaseDemo-SociaDot/blob/main/main/scripts/requests_manager.gd)).

The only purpose of socia.dot was to showcase most of the features implemented by our library, re-creating a real use-case inspired by one of the environments most known to handle sync/async human interactions, data and media content transfers, data storage and events management: social networks.
Thus, these are the features completely available thanks to GodotFirebase, using Firebase as a backend, and implemented in socia.dot to test:
- Personal profile creation with an avatar and a email(fake)/password combination
- Images and text sharing through posts
- Social networking, "connecting" to other users that use the platform and visiting their profile
- Realtime chat with other users only if "connected"
- Realtime comments and likes on any post on the platform by other users

socia.dot will never claim to be a social network alternative, exposing any kind of perfect social network structure as an app. This is just a proof-of-concept, that was really fun to develop with GodotNuts team, in order to have a little product to expose our work on GodotFirebase addon other than game; and an actual challenge to take, developing this in a couple of weeks in total and having fun polishing it between UIs and logics.

### Resources used:
- [Godot Engine](https://godotengine.org/), to build the frontend and implement the backend interactions
- [GodotFirebase](https://github.com/GodotNuts/GodotFirebase), our addon developed for Godot Engine in order to interact with Firebase
- [GodotFirebase-UI](https://github.com/GodotNuts/GodotFirebase-UI), a plug'n'play UI components library we developed for Godot which implements GodotFirebase APIs out of the box (Authentication Components, Buttons, etc.)

## Special Thanks
**The whole GodotNuts team**, that helped me a lot during this journey discussing with me on our Discord and testing the app
**Fabio (faless) Alessandrelli**, current Godot's HTML5 maintainer, for the amount of work he has done on HTML5 support, and the help he specifically gave us to make this project work also on browser as on any other platform
**socia.dot autochthonous community**, which surprisingly showed up in the app itself, sharing a lot of suggestions after the first tweet ever made about this project
**Godot Engine**, that made everything of this possible


© 2021 fenix-hub

1 change: 1 addition & 0 deletions firebase-ui/buttons/base_button/base_button.gd
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ func _ready():
_set_size(size)
set_texture_modulate(modulate_color)
$Container/Hover.scale = Vector2()
editor_description = "AAAAAAAAAH"

func set_texture(_texture : Texture) -> void:
texture = _texture
10 changes: 6 additions & 4 deletions firebase-ui/buttons/base_button/base_button.tscn
Original file line number Diff line number Diff line change
@@ -33,7 +33,9 @@ margin_bottom = -9.8
custom_styles/panel = SubResource( 1 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": true
"_edit_use_anchors_": true,
"_editor_description_": "This is a basebutton
"
}
texture = null
modulate_color = Color( 1, 1, 1, 1 )
@@ -63,10 +65,10 @@ size_flags_vertical = 4
expand = true

[node name="Text" type="Label" parent="Container/ButtonContainer"]
margin_left = 36.0
margin_top = 9.0
margin_left = 40.0
margin_top = 3.0
margin_right = 290.0
margin_bottom = 23.0
margin_bottom = 28.0
size_flags_horizontal = 3
custom_colors/font_color = Color( 0, 0, 0, 1 )
align = 1
Original file line number Diff line number Diff line change
@@ -15,43 +15,43 @@ export (String) var SpecifiedKey
var db_ref

func _ready():
Firebase.Auth.connect("login_succeeded", self, "on_login_succeeded")
Firebase.Auth.connect("login_succeeded", self, "on_login_succeeded")
func on_login_succeeded(auth_token):
connect_to_database()
connect_to_database()
func connect_to_database():
if !SpecifiedKey:
db_ref = Firebase.Database.get_database_reference(CurrentPath, { })
else:
db_ref = Firebase.Database.get_database_reference(CurrentPath + "/" + SpecifiedKey)
db_ref.connect("new_data_update", self, "on_new_update", [], CONNECT_ONESHOT if OneShot else CONNECT_PERSIST)
if !OneShot:
db_ref.connect("patch_data_update", self, "on_patch_update")
if !SpecifiedKey:
db_ref = Firebase.Database.get_database_reference(CurrentPath, { })
else:
db_ref = Firebase.Database.get_database_reference(CurrentPath + "/" + SpecifiedKey)
db_ref.connect("new_data_update", self, "on_new_update", [], CONNECT_ONESHOT if OneShot else CONNECT_PERSIST)
if !OneShot:
db_ref.connect("patch_data_update", self, "on_patch_update")
func on_new_update(data):
if data.data:
var item = data.data
var template = ItemTemplate.instance()
add_child(template)
template.set_item(item)
if data.data:
var item = data.data
var template = ItemTemplate.instance()
add_child(template)
template.set_item(item)
func on_item_added(item, key, template):
pass
pass

func on_patch_update(data):
if data.data and data.path:
if tracked_values.has(data.path):
tracked_values[data.path].template.set_item(data.data)
if data.data and data.path:
if tracked_values.has(data.path):
tracked_values[data.path].template.set_item(data.data)
func delete_child(key):
var item = tracked_values[key]
remove_child(item.template)
tracked_values.erase(key)
var item = tracked_values[key]
remove_child(item.template)
tracked_values.erase(key)
func on_data_delete(data):
if data:
for key in data.keys():
if tracked_values.has(key):
delete_child(key)
if data:
for key in data.keys():
if tracked_values.has(key):
delete_child(key)
59 changes: 59 additions & 0 deletions main/res/icons/arrow_backward_white_36dp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions main/res/icons/arrow_backward_white_36dp.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/arrow_backward_white_36dp.svg-3af3530459277bec1ea2cc78a7ec55c2.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://main/res/icons/arrow_backward_white_36dp.svg"
dest_files=[ "res://.import/arrow_backward_white_36dp.svg-3af3530459277bec1ea2cc78a7ec55c2.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
2 changes: 1 addition & 1 deletion main/res/shaders/round_avatar.tres
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ void light() {

}
"
graph_offset = Vector2( -428, 247 )
graph_offset = Vector2( -391.365, 0 )
mode = 1
flags/light_only = false
nodes/fragment/2/node = SubResource( 1 )
15 changes: 15 additions & 0 deletions main/scn/about_page/about_page.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
extends PanelContainer


# Declare member variables here. Examples:
# var a: int = 2
# var b: String = "text"


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$VBoxContainer/RichTextLabel.connect("meta_clicked", self, "_on_meta_clicked")
$VBoxContainer/HBoxContainer/BackBtn.connect("pressed", self, "hide")

func _on_meta_clicked(meta : String):
OS.shell_open(meta)
43 changes: 28 additions & 15 deletions main/scn/app/main.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
extends Control

const version : String = "1.4"
const version : String = "1.5"

onready var activities : Control = $Main/Activities
onready var topbar : HBoxContainer = $TopBar
onready var footbar : HBoxContainer = $FootBar
onready var loading : Control = $Main/Loading
onready var error_container : AspectRatioContainer = $Main/ErrorContainer
onready var error_lbl : Label = error_container.get_node("ERROR")
@@ -13,23 +14,28 @@ onready var version_lbl : Label = $Main/AppInfo/Version

onready var animator : Tween = $Main/Tween

onready var about : PanelContainer = $Main/AboutPage

func _title():
OS.set_window_title("socia.dot v%s"%version)
$TopBar/Name.set_text("socia.dot")
version_lbl.set_text("v%s"%version)
about.hide()

func _ready():
_title()
_connect_signals()
get_tree().get_root().set_transparent_background(true)
if OS.get_name() in ["Android", "iOS"]:
for child in topbar.get_children():
if child is Control: child.hide()
if OS.get_name() in ["HTML5"]:
topbar.hide()
get_parent().rect_position = Vector2(0,0)
get_parent().rect_size = OS.window_size
get_parent().rect_clip_content = true
match OS.get_name():
"Android", "iOS":
for child in topbar.get_children():
if child is Control: child.hide()
"HTML5":
topbar.hide()
get_parent().rect_position = Vector2(0,0)
get_parent().rect_size = OS.window_size
get_parent().rect_clip_content = true
_:
get_tree().get_root().set_transparent_background(true)
loading.set_loading(false)
Activities.signin = Activities.signin_scene.instance()
activities.add_child(Activities.signin)
@@ -65,30 +71,37 @@ func _on_show_error(error : String):
0.3, Tween.TRANS_QUAD, Tween.EASE_OUT)
animator.start()


func show_about():
about.show()

# ..... top bar signals
func _on_TopBar_close():
UserData.is_logged = false
UserData.last_logged = OS.get_datetime()
loading.set_loading(true)
yield(RequestsManager.update_user(), "task_finished")
if UserData.is_logged:
UserData.is_logged = false
UserData.last_logged = OS.get_datetime()
loading.set_loading(true)
yield(RequestsManager.update_user(), "task_finished")
get_tree().quit()

func _on_TopBar_minimize():
OS.set_window_minimized(not OS.is_window_minimized())

func _on_TopBar_resize():
if OS.get_window_size().x <= 1024:
get_tree().get_root().set_transparent_background(false)
get_parent().rect_position = Vector2(0,0)
OS.set_window_position(Vector2.ZERO)
get_parent().rect_size+=Vector2(8,8)*2
OS.set_window_size(OS.get_screen_size(0) - Vector2(0, 50))
else:
get_tree().get_root().set_transparent_background(true)
get_parent().rect_position = Vector2(8,8)
OS.set_window_position(OS.get_screen_size(0)/2 - OS.get_window_size()/2)
get_parent().rect_size-=Vector2(8,8)*2
OS.set_window_size(Vector2(1024, 600))

func _on_TopBar_moving_from_pos(event_pos : Vector2, offset : Vector2):
if OS.get_window_size().x > 1024:
OS.set_window_size(Vector2(1024, 600))
_on_TopBar_resize()
OS.set_window_position(OS.get_window_position() + event_pos - offset)
Loading

0 comments on commit a7ef00f

Please sign in to comment.