Skip to content

Commit a7ef00f

Browse files
authored
Update (#14)
* update friend buttons * update 1.5 * update readme * update readme * fix 1.5 * fix 1.5 2
1 parent dcee53a commit a7ef00f

File tree

35 files changed

+655
-161
lines changed

35 files changed

+655
-161
lines changed

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
1-
![home](./env/screenshots/home.png)
1+
![home](./env/screenshots/home.png)
2+
3+
# Sociadot
4+
5+
**socia.dot** is an open-source frontend for a minimalistic "social netowrk app" proof-of-concept.
6+
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!
7+
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.
8+
9+
### socia.dot is:
10+
• 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;
11+
• 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;
12+
• 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;
13+
• 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;
14+
• 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)).
15+
16+
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.
17+
Thus, these are the features completely available thanks to GodotFirebase, using Firebase as a backend, and implemented in socia.dot to test:
18+
- Personal profile creation with an avatar and a email(fake)/password combination
19+
- Images and text sharing through posts
20+
- Social networking, "connecting" to other users that use the platform and visiting their profile
21+
- Realtime chat with other users only if "connected"
22+
- Realtime comments and likes on any post on the platform by other users
23+
24+
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.
25+
26+
### Resources used:
27+
- [Godot Engine](https://godotengine.org/), to build the frontend and implement the backend interactions
28+
- [GodotFirebase](https://github.com/GodotNuts/GodotFirebase), our addon developed for Godot Engine in order to interact with Firebase
29+
- [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.)
30+
31+
## Special Thanks
32+
**The whole GodotNuts team**, that helped me a lot during this journey discussing with me on our Discord and testing the app
33+
**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
34+
**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
35+
**Godot Engine**, that made everything of this possible
36+
37+
38+
© 2021 fenix-hub
39+

firebase-ui/buttons/base_button/base_button.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ func _ready():
9797
_set_size(size)
9898
set_texture_modulate(modulate_color)
9999
$Container/Hover.scale = Vector2()
100+
editor_description = "AAAAAAAAAH"
100101

101102
func set_texture(_texture : Texture) -> void:
102103
texture = _texture

firebase-ui/buttons/base_button/base_button.tscn

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ margin_bottom = -9.8
3333
custom_styles/panel = SubResource( 1 )
3434
script = ExtResource( 1 )
3535
__meta__ = {
36-
"_edit_use_anchors_": true
36+
"_edit_use_anchors_": true,
37+
"_editor_description_": "This is a basebutton
38+
"
3739
}
3840
texture = null
3941
modulate_color = Color( 1, 1, 1, 1 )
@@ -63,10 +65,10 @@ size_flags_vertical = 4
6365
expand = true
6466

6567
[node name="Text" type="Label" parent="Container/ButtonContainer"]
66-
margin_left = 36.0
67-
margin_top = 9.0
68+
margin_left = 40.0
69+
margin_top = 3.0
6870
margin_right = 290.0
69-
margin_bottom = 23.0
71+
margin_bottom = 28.0
7072
size_flags_horizontal = 3
7173
custom_colors/font_color = Color( 0, 0, 0, 1 )
7274
align = 1

firebase-ui/database_box_containers/base_boxcontainer/FirebaseContainer.gd

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,43 @@ export (String) var SpecifiedKey
1515
var db_ref
1616

1717
func _ready():
18-
Firebase.Auth.connect("login_succeeded", self, "on_login_succeeded")
19-
18+
Firebase.Auth.connect("login_succeeded", self, "on_login_succeeded")
19+
2020
func on_login_succeeded(auth_token):
21-
connect_to_database()
22-
21+
connect_to_database()
22+
2323
func connect_to_database():
24-
if !SpecifiedKey:
25-
db_ref = Firebase.Database.get_database_reference(CurrentPath, { })
26-
else:
27-
db_ref = Firebase.Database.get_database_reference(CurrentPath + "/" + SpecifiedKey)
28-
29-
db_ref.connect("new_data_update", self, "on_new_update", [], CONNECT_ONESHOT if OneShot else CONNECT_PERSIST)
30-
if !OneShot:
31-
db_ref.connect("patch_data_update", self, "on_patch_update")
32-
24+
if !SpecifiedKey:
25+
db_ref = Firebase.Database.get_database_reference(CurrentPath, { })
26+
else:
27+
db_ref = Firebase.Database.get_database_reference(CurrentPath + "/" + SpecifiedKey)
28+
29+
db_ref.connect("new_data_update", self, "on_new_update", [], CONNECT_ONESHOT if OneShot else CONNECT_PERSIST)
30+
if !OneShot:
31+
db_ref.connect("patch_data_update", self, "on_patch_update")
32+
3333
func on_new_update(data):
34-
if data.data:
35-
var item = data.data
36-
var template = ItemTemplate.instance()
37-
add_child(template)
38-
template.set_item(item)
39-
34+
if data.data:
35+
var item = data.data
36+
var template = ItemTemplate.instance()
37+
add_child(template)
38+
template.set_item(item)
39+
4040
func on_item_added(item, key, template):
41-
pass
41+
pass
4242

4343
func on_patch_update(data):
44-
if data.data and data.path:
45-
if tracked_values.has(data.path):
46-
tracked_values[data.path].template.set_item(data.data)
47-
44+
if data.data and data.path:
45+
if tracked_values.has(data.path):
46+
tracked_values[data.path].template.set_item(data.data)
47+
4848
func delete_child(key):
49-
var item = tracked_values[key]
50-
remove_child(item.template)
51-
tracked_values.erase(key)
52-
49+
var item = tracked_values[key]
50+
remove_child(item.template)
51+
tracked_values.erase(key)
52+
5353
func on_data_delete(data):
54-
if data:
55-
for key in data.keys():
56-
if tracked_values.has(key):
57-
delete_child(key)
54+
if data:
55+
for key in data.keys():
56+
if tracked_values.has(key):
57+
delete_child(key)
Lines changed: 59 additions & 0 deletions
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="StreamTexture"
5+
path="res://.import/arrow_backward_white_36dp.svg-3af3530459277bec1ea2cc78a7ec55c2.stex"
6+
metadata={
7+
"vram_texture": false
8+
}
9+
10+
[deps]
11+
12+
source_file="res://main/res/icons/arrow_backward_white_36dp.svg"
13+
dest_files=[ "res://.import/arrow_backward_white_36dp.svg-3af3530459277bec1ea2cc78a7ec55c2.stex" ]
14+
15+
[params]
16+
17+
compress/mode=0
18+
compress/lossy_quality=0.7
19+
compress/hdr_mode=0
20+
compress/bptc_ldr=0
21+
compress/normal_map=0
22+
flags/repeat=0
23+
flags/filter=true
24+
flags/mipmaps=false
25+
flags/anisotropic=false
26+
flags/srgb=2
27+
process/fix_alpha_border=true
28+
process/premult_alpha=false
29+
process/HDR_as_SRGB=false
30+
process/invert_color=false
31+
stream=false
32+
size_limit=0
33+
detect_3d=true
34+
svg/scale=1.0

main/res/shaders/round_avatar.tres

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void light() {
4545

4646
}
4747
"
48-
graph_offset = Vector2( -428, 247 )
48+
graph_offset = Vector2( -391.365, 0 )
4949
mode = 1
5050
flags/light_only = false
5151
nodes/fragment/2/node = SubResource( 1 )

main/scn/about_page/about_page.gd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
extends PanelContainer
2+
3+
4+
# Declare member variables here. Examples:
5+
# var a: int = 2
6+
# var b: String = "text"
7+
8+
9+
# Called when the node enters the scene tree for the first time.
10+
func _ready() -> void:
11+
$VBoxContainer/RichTextLabel.connect("meta_clicked", self, "_on_meta_clicked")
12+
$VBoxContainer/HBoxContainer/BackBtn.connect("pressed", self, "hide")
13+
14+
func _on_meta_clicked(meta : String):
15+
OS.shell_open(meta)

main/scn/app/main.gd

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
extends Control
22

3-
const version : String = "1.4"
3+
const version : String = "1.5"
44

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

1415
onready var animator : Tween = $Main/Tween
1516

17+
onready var about : PanelContainer = $Main/AboutPage
18+
1619
func _title():
1720
OS.set_window_title("socia.dot v%s"%version)
1821
$TopBar/Name.set_text("socia.dot")
1922
version_lbl.set_text("v%s"%version)
23+
about.hide()
2024

2125
func _ready():
2226
_title()
2327
_connect_signals()
24-
get_tree().get_root().set_transparent_background(true)
25-
if OS.get_name() in ["Android", "iOS"]:
26-
for child in topbar.get_children():
27-
if child is Control: child.hide()
28-
if OS.get_name() in ["HTML5"]:
29-
topbar.hide()
30-
get_parent().rect_position = Vector2(0,0)
31-
get_parent().rect_size = OS.window_size
32-
get_parent().rect_clip_content = true
28+
match OS.get_name():
29+
"Android", "iOS":
30+
for child in topbar.get_children():
31+
if child is Control: child.hide()
32+
"HTML5":
33+
topbar.hide()
34+
get_parent().rect_position = Vector2(0,0)
35+
get_parent().rect_size = OS.window_size
36+
get_parent().rect_clip_content = true
37+
_:
38+
get_tree().get_root().set_transparent_background(true)
3339
loading.set_loading(false)
3440
Activities.signin = Activities.signin_scene.instance()
3541
activities.add_child(Activities.signin)
@@ -65,30 +71,37 @@ func _on_show_error(error : String):
6571
0.3, Tween.TRANS_QUAD, Tween.EASE_OUT)
6672
animator.start()
6773

74+
75+
func show_about():
76+
about.show()
77+
6878
# ..... top bar signals
6979
func _on_TopBar_close():
70-
UserData.is_logged = false
71-
UserData.last_logged = OS.get_datetime()
72-
loading.set_loading(true)
73-
yield(RequestsManager.update_user(), "task_finished")
80+
if UserData.is_logged:
81+
UserData.is_logged = false
82+
UserData.last_logged = OS.get_datetime()
83+
loading.set_loading(true)
84+
yield(RequestsManager.update_user(), "task_finished")
7485
get_tree().quit()
7586

7687
func _on_TopBar_minimize():
7788
OS.set_window_minimized(not OS.is_window_minimized())
7889

7990
func _on_TopBar_resize():
8091
if OS.get_window_size().x <= 1024:
92+
get_tree().get_root().set_transparent_background(false)
8193
get_parent().rect_position = Vector2(0,0)
8294
OS.set_window_position(Vector2.ZERO)
8395
get_parent().rect_size+=Vector2(8,8)*2
8496
OS.set_window_size(OS.get_screen_size(0) - Vector2(0, 50))
8597
else:
98+
get_tree().get_root().set_transparent_background(true)
8699
get_parent().rect_position = Vector2(8,8)
87100
OS.set_window_position(OS.get_screen_size(0)/2 - OS.get_window_size()/2)
88101
get_parent().rect_size-=Vector2(8,8)*2
89102
OS.set_window_size(Vector2(1024, 600))
90103

91104
func _on_TopBar_moving_from_pos(event_pos : Vector2, offset : Vector2):
92105
if OS.get_window_size().x > 1024:
93-
OS.set_window_size(Vector2(1024, 600))
106+
_on_TopBar_resize()
94107
OS.set_window_position(OS.get_window_position() + event_pos - offset)

0 commit comments

Comments
 (0)