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)
230 changes: 225 additions & 5 deletions main/scn/app/main.tscn

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main/scn/app/top_bar.gd
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ func _on_Name_gui_input(event : InputEvent):
offset = Vector2()
if event is InputEventMouseMotion and offset != Vector2():
if OS.get_window_size().x > 1024:
OS.set_window_size(Vector2(1024, 600))
emit_signal("resize")
OS.set_window_position(OS.get_window_position() + event.get_global_position() - offset)


35 changes: 35 additions & 0 deletions main/scn/footbar/footbar.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
extends HBoxContainer

onready var animator : Tween = $Tween

var tp_color : Color = Color(1,1,1,0.2)

func _connect_signals():
connect("mouse_entered", self, "_on_FootBar_mouse_entered")
connect("mouse_exited", self, "_on_FootBar_mouse_exited")
$GodotNuts.connect("pressed", self, "_on_GodotNuts_pressed")
$developer.connect("pressed", self, "_on_developer_pressed")
$About.connect("pressed", self, "_on_About_pressed")


func _ready():
_connect_signals()
modulate = tp_color


func _on_FootBar_mouse_entered():
animator.interpolate_property(self, "modulate", modulate, Color.white, 0.3, Tween.TRANS_QUAD)
animator.start()

func _on_FootBar_mouse_exited():
animator.interpolate_property(self, "modulate", modulate, tp_color, 0.3, Tween.TRANS_QUAD)
animator.start()

func _on_GodotNuts_pressed():
OS.shell_open("https://github.com/GodotNuts")

func _on_developer_pressed():
OS.shell_open("https://twitter.com/fenixhub")

func _on_About_pressed():
get_parent().show_about()
22 changes: 11 additions & 11 deletions main/scn/friend_button/friend_button.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class_name FriendButton
extends PanelContainer

onready var online_lbl : Label = $Header/Picture/Online

var friend : UsersManager.User

var friend_id : String setget set_friend_id
@@ -27,22 +29,23 @@ func load_friend(id : String, _name : String, picture : ImageTexture):

func load_friend_from_obj(user : UsersManager.User):
friend = user
friend.connect("update_picture", self, "set_friend_picture")
friend.connect("update_document", self, "load_friend_from_document")
set_friend_id(user.id)
set_friend_name(user.username)
set_friend_picture(user.picture)
set_friend_document(user.document)
set_online(user.is_logged)
friend.connect("update_picture", self, "set_friend_picture")
friend.connect("update_document", self, "load_friend_from_document")
show()


func load_friend_from_document(document : FirestoreDocument):
set_friend_name(document.doc_fields.username)
set_friend_document(document)
set_friend_name(document.doc_fields.username)
set_online(document.doc_fields.is_logged)
show()



func set_friend_id(id : String):
friend_id = id

@@ -57,8 +60,6 @@ func set_friend_picture(picture : ImageTexture):

func set_friend_document(f_doc : FirestoreDocument):
friend_document = f_doc
if friend_document!=null:
_on_FriendButton_pressed()

func set_received_messages(messages : int):
if messages == 0:
@@ -68,13 +69,12 @@ func set_received_messages(messages : int):
$Header/Messages.set_text(messages as String)

func _on_FriendButton_pressed():
# if friend_document.doc_fields.chats.has(UserData.user_id):
# pass
# else:
# friend.update_document()
# yield(friend, "update_document")
ChatsManager.open_chat(friend_document)
# UsersManager.get_new_user_doc(friend_id)


func set_online(online : bool) -> void:
online_lbl.visible = online

func _on_FriendButton_gui_input(event):
if event is InputEventMouseButton:
17 changes: 15 additions & 2 deletions main/scn/friend_button/friend_button.tscn
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]

[ext_resource path="res://main/res/shaders/round_avatar.tres" type="Material" id=1]
[ext_resource path="res://main/res/imgs/avatar.svg" type="Texture" id=2]
[ext_resource path="res://main/scn/friend_button/friend_button.gd" type="Script" id=3]
[ext_resource path="res://main/scn/labels_icons/online.tscn" type="PackedScene" id=4]

[sub_resource type="StyleBoxFlat" id=1]
resource_local_to_scene = true
bg_color = Color( 0.278431, 0.843137, 0.305882, 1 )
corner_radius_top_left = 40
corner_radius_top_right = 40
corner_radius_bottom_right = 40
corner_radius_bottom_left = 40
corner_detail = 20

[sub_resource type="StyleBoxFlat" id=2]
content_margin_left = 7.0
content_margin_right = 7.0
content_margin_top = 4.0
@@ -49,6 +59,9 @@ texture = ExtResource( 2 )
expand = true
stretch_mode = 1

[node name="Online" parent="Header/Picture" instance=ExtResource( 4 )]
custom_styles/normal = SubResource( 1 )

[node name="Name" type="Label" parent="Header"]
margin_left = 66.0
margin_top = 17.0
@@ -67,5 +80,5 @@ margin_top = 13.0
margin_right = 157.0
margin_bottom = 46.0
size_flags_horizontal = 4
custom_styles/normal = SubResource( 1 )
custom_styles/normal = SubResource( 2 )
text = "0"
4 changes: 2 additions & 2 deletions main/scn/friend_list/friend_list.tscn
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

[ext_resource path="res://main/scn/friend_list/friend_list.gd" type="Script" id=1]

[sub_resource type="StyleBoxEmpty" id=7]
[sub_resource type="StyleBoxEmpty" id=1]
content_margin_left = 7.0
content_margin_right = 7.0

@@ -28,7 +28,7 @@ margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/bg = SubResource( 7 )
custom_styles/bg = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
6 changes: 6 additions & 0 deletions main/scn/header/header.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
extends HBoxContainer

onready var online_lbl : Label = $Picture/Online

signal pressed(user_id, user_name)

var user_id : String
@@ -15,6 +17,7 @@ func load_main_user():
UserData.connect("update_user_picture", self, "set_picture")
set_user_name(UserData.user_name)
set_picture(UserData.user_picture)
online_lbl.show()

func load_from_user(user_obj : UsersManager.User):
if not user_obj.is_connected("update_document", self, "load_from_document"):
@@ -23,6 +26,7 @@ func load_from_user(user_obj : UsersManager.User):
user_obj.connect("update_picture", self, "set_picture")
set_picture(user_obj.picture)
set_user_name(user_obj.username)
set_online(user_obj.is_logged)
user_id = user_obj.id

func load_from_document(document : FirestoreDocument):
@@ -39,6 +43,8 @@ func set_user_name(_name : String):
user_name = _name
$Name.set_text(_name)

func set_online(online : bool) -> void:
online_lbl.visible = online

func _on_Name_pressed() -> void:
emit_signal("pressed", user_id, user_name)
15 changes: 14 additions & 1 deletion main/scn/header/header.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=6 format=2]

[ext_resource path="res://main/res/imgs/avatar.svg" type="Texture" id=1]
[ext_resource path="res://main/res/shaders/round_avatar.tres" type="Material" id=2]
[ext_resource path="res://main/scn/header/header.gd" type="Script" id=3]
[ext_resource path="res://main/scn/labels_icons/online.tscn" type="PackedScene" id=4]

[sub_resource type="StyleBoxFlat" id=1]
resource_local_to_scene = true
bg_color = Color( 0.278431, 0.843137, 0.305882, 1 )
corner_radius_top_left = 40
corner_radius_top_right = 40
corner_radius_bottom_right = 40
corner_radius_bottom_left = 40
corner_detail = 20

[node name="Header" type="HBoxContainer"]
margin_right = 168.0
@@ -24,6 +34,9 @@ texture = ExtResource( 1 )
expand = true
stretch_mode = 1

[node name="Online" parent="Picture" instance=ExtResource( 4 )]
custom_styles/normal = SubResource( 1 )

[node name="Name" type="LinkButton" parent="."]
margin_left = 75.0
margin_top = 17.0
2 changes: 1 addition & 1 deletion main/scn/header/interactive/interactive_header.gd
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ func set_user_id(_id : String):
func check_friend() -> bool:
$ConnecBtn.visible = not (user_id == UserData.user_id)
$ConnecBtn.activated = (user_id in UserData.friend_list)
$ConnecBtn.set_text("Connected" if (user_id in UserData.friend_list) else "Conect")
$ConnecBtn.set_text("Connected" if (user_id in UserData.friend_list) else "Connect")
return (user_id in UserData.friend_list)

func _on_ConnecBtn_pressed():
11 changes: 6 additions & 5 deletions main/scn/home/home.gd
Original file line number Diff line number Diff line change
@@ -60,8 +60,9 @@ func _ready():
$HomeContainer/Menu/Header.load_main_user()
animate_Home(true)
load_posts()
friend_list.load_friend_list()
connect_posts()
connect_notifications()
friend_list.load_friend_list()

func animate_Home(display : bool):
if display:
@@ -99,9 +100,9 @@ func load_posts():
if post is PostContainer: post.queue_free()
posts_section.get_node("NoFriends").show()

if posts_db_reference == null:
posts_db_reference = Firebase.Database.get_database_reference("sociadot/posts")
posts_db_reference.connect("new_data_update", self, "_on_new_post")
func connect_posts() -> void:
posts_db_reference = Firebase.Database.get_database_reference("sociadot/posts")
posts_db_reference.connect("new_data_update", self, "_on_new_post")

func connect_notifications() -> void:
notifications_db_reference = Firebase.Database.get_database_reference("sociadot/notifications/"+UserData.user_id)
@@ -208,7 +209,7 @@ func _on_show_chat(chat_node : ChatNode):
chat_node.set_visible(true)
else:
chat_container.add_child(chat_node)
chat_node.set_visible(false)
chat_node.set_visible(true)


func show_section(section : Control) -> void:
37 changes: 24 additions & 13 deletions main/scn/home/home.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=2]
[gd_scene load_steps=25 format=2]

[ext_resource path="res://main/scn/home/home.gd" type="Script" id=1]
[ext_resource path="res://main/res/fonts/roboto/Roboto-Black.ttf" type="DynamicFontData" id=2]
@@ -23,17 +23,26 @@

[sub_resource type="StyleBoxEmpty" id=2]

[sub_resource type="DynamicFont" id=5]
[sub_resource type="StyleBoxFlat" id=3]
resource_local_to_scene = true
bg_color = Color( 1, 0.352941, 0.247059, 1 )
corner_radius_top_left = 40
corner_radius_top_right = 40
corner_radius_bottom_right = 40
corner_radius_bottom_left = 40
corner_detail = 20

[sub_resource type="DynamicFont" id=4]
size = 25
font_data = ExtResource( 2 )

[sub_resource type="StyleBoxEmpty" id=6]
[sub_resource type="StyleBoxEmpty" id=5]
content_margin_left = 10.0
content_margin_right = 10.0
content_margin_top = 10.0
content_margin_bottom = 10.0

[sub_resource type="StyleBoxEmpty" id=7]
[sub_resource type="StyleBoxEmpty" id=6]
content_margin_left = 7.0
content_margin_right = 7.0

@@ -63,7 +72,7 @@ margin_right = 210.0
margin_bottom = 600.0
rect_min_size = Vector2( 210, 0 )
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.3
size_flags_stretch_ratio = 0.2
custom_constants/separation = 15

[node name="HSeparator3" type="HSeparator" parent="HomeContainer/Menu"]
@@ -129,6 +138,7 @@ texture_inactive = ExtResource( 12 )
color = Color( 1, 0.627451, 0.294118, 1 )

[node name="Notification" parent="HomeContainer/Menu/NotificationsBtn" instance=ExtResource( 18 )]
custom_styles/normal = SubResource( 3 )

[node name="SettingsBtn" parent="HomeContainer/Menu" instance=ExtResource( 10 )]
margin_left = 15.0
@@ -157,6 +167,7 @@ margin_bottom = 600.0
rect_min_size = Vector2( 550, 0 )
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 0.6

[node name="Posts" type="VBoxContainer" parent="HomeContainer/Sections"]
margin_right = 564.0
@@ -169,7 +180,7 @@ __meta__ = {
[node name="Home" type="Label" parent="HomeContainer/Sections/Posts"]
margin_right = 564.0
margin_bottom = 39.0
custom_fonts/font = SubResource( 5 )
custom_fonts/font = SubResource( 4 )
text = "Home"
align = 1

@@ -191,7 +202,7 @@ margin_right = 564.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/bg = SubResource( 6 )
custom_styles/bg = SubResource( 5 )
scroll_horizontal_enabled = false

[node name="PostContainer" type="VBoxContainer" parent="HomeContainer/Sections/Posts/ScrollPost"]
@@ -217,7 +228,7 @@ __meta__ = {
[node name="Label" type="Label" parent="HomeContainer/Sections/Notifications"]
margin_right = 564.0
margin_bottom = 39.0
custom_fonts/font = SubResource( 5 )
custom_fonts/font = SubResource( 4 )
text = "Notifications"
align = 1

@@ -227,7 +238,7 @@ margin_right = 564.0
margin_bottom = 298.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/bg = SubResource( 6 )
custom_styles/bg = SubResource( 5 )
scroll_horizontal_enabled = false

[node name="NotificationsContainer" type="VBoxContainer" parent="HomeContainer/Sections/Notifications/ScrollNotifications"]
@@ -262,7 +273,7 @@ __meta__ = {
[node name="Home" type="Label" parent="HomeContainer/Sections/UsersList"]
margin_right = 500.0
margin_bottom = 39.0
custom_fonts/font = SubResource( 5 )
custom_fonts/font = SubResource( 4 )
text = "Users List"
align = 1

@@ -272,7 +283,7 @@ margin_right = 500.0
margin_bottom = 198.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/bg = SubResource( 6 )
custom_styles/bg = SubResource( 5 )
scroll_horizontal_enabled = false

[node name="UsersList" type="VBoxContainer" parent="HomeContainer/Sections/UsersList/ScrollUsers"]
@@ -299,7 +310,7 @@ margin_bottom = 600.0
rect_min_size = Vector2( 210, 0 )
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 0.3
size_flags_stretch_ratio = 0.2

[node name="FriendList" type="VBoxContainer" parent="HomeContainer/SideBar"]
margin_right = 210.0
@@ -323,7 +334,7 @@ margin_right = 210.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/bg = SubResource( 7 )
custom_styles/bg = SubResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
25 changes: 25 additions & 0 deletions main/scn/labels_icons/color_round_m.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[gd_scene load_steps=3 format=2]

[sub_resource type="StyleBoxFlat" id=1]
resource_local_to_scene = true
bg_color = Color( 1, 0.352941, 0.247059, 1 )
corner_radius_top_left = 40
corner_radius_top_right = 40
corner_radius_bottom_right = 40
corner_radius_bottom_left = 40
corner_detail = 20

[sub_resource type="DynamicFont" id=2]

[node name="ColorIcon" type="Label"]
margin_right = 15.0
margin_bottom = 15.0
rect_min_size = Vector2( 10, 10 )
size_flags_horizontal = 0
size_flags_vertical = 0
custom_styles/normal = SubResource( 1 )
custom_fonts/font = SubResource( 2 )
autowrap = true
__meta__ = {
"_edit_use_anchors_": false
}
1 change: 1 addition & 0 deletions main/scn/labels_icons/color_round_s.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=2]

[sub_resource type="StyleBoxFlat" id=1]
resource_local_to_scene = true
bg_color = Color( 1, 0.352941, 0.247059, 1 )
corner_radius_top_left = 40
corner_radius_top_right = 40
32 changes: 32 additions & 0 deletions main/scn/labels_icons/online.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[gd_scene load_steps=3 format=2]

[sub_resource type="StyleBoxFlat" id=1]
resource_local_to_scene = true
bg_color = Color( 0.278431, 0.843137, 0.305882, 1 )
corner_radius_top_left = 40
corner_radius_top_right = 40
corner_radius_bottom_right = 40
corner_radius_bottom_left = 40
corner_detail = 20

[sub_resource type="DynamicFont" id=2]

[node name="Online" type="Label"]
visible = false
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -15.0
margin_top = -15.0
margin_right = -2.0
margin_bottom = -2.0
rect_min_size = Vector2( 10, 10 )
size_flags_horizontal = 0
size_flags_vertical = 0
custom_styles/normal = SubResource( 1 )
custom_fonts/font = SubResource( 2 )
autowrap = true
__meta__ = {
"_edit_use_anchors_": false
}
1 change: 1 addition & 0 deletions main/scn/notifications/notification/notification.tscn
Original file line number Diff line number Diff line change
@@ -104,6 +104,7 @@ margin_bottom = 93.0
margin_left = 948.0
margin_right = 1008.0
margin_bottom = 93.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 10
icon = ExtResource( 6 )

4 changes: 3 additions & 1 deletion main/scn/post/post.gd
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ func load_post(post : PostsManager.Post) -> void:
else:
if post.image != null:
set_image(post.image)

set_db()
if not PostsManager.has_post_container(post.id):
PostsManager.add_post_scene(self)

@@ -69,6 +69,8 @@ func set_menu(user : String) -> void:
func set_post_id(p : String):
id = p
name = p

func set_db():
post_db_reference = Firebase.Database.get_database_reference("sociadot/posts/"+id)
post_db_reference.connect("new_data_update", self, "_on_db_data")
post_db_reference.connect("patch_data_update", self, "_on_db_data")
10 changes: 5 additions & 5 deletions main/scn/post/post.tscn
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ thickness = 3

[node name="Post" type="PanelContainer"]
anchor_right = 1.0
margin_bottom = 384.0
anchor_bottom = 1.0
size_flags_horizontal = 3
theme = ExtResource( 4 )
custom_styles/panel = SubResource( 1 )
@@ -55,7 +55,7 @@ __meta__ = {

[node name="PostContainer" type="VBoxContainer" parent="."]
margin_right = 1024.0
margin_bottom = 384.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 5
@@ -153,7 +153,7 @@ custom_constants/separation = 5
material = ExtResource( 6 )
margin_top = 100.0
margin_right = 1024.0
margin_bottom = 344.0
margin_bottom = 560.0
rect_min_size = Vector2( 64, 64 )
mouse_default_cursor_shape = 2
size_flags_horizontal = 7
@@ -163,8 +163,8 @@ expand = true
stretch_mode = 7

[node name="ActionButtons" parent="PostContainer" instance=ExtResource( 1 )]
margin_top = 349.0
margin_bottom = 384.0
margin_top = 565.0
margin_bottom = 600.0

[node name="Container" type="PanelContainer" parent="PostContainer"]
visible = false
2 changes: 1 addition & 1 deletion main/scn/profile/profile.gd
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ func load_profile(_id : String, user_name : String):
func check_friend(user_id : String) -> bool:
get_node("Header/ConnecBtn").visible = not (user_id == UserData.user_id)
get_node("Header/ConnecBtn").activated = (user_id in UserData.friend_list)
get_node("Header/ConnecBtn").set_text("Connected" if (user_id in UserData.friend_list) else "Conect")
get_node("Header/ConnecBtn").set_text("Connected" if (user_id in UserData.friend_list) else "Connect")
self.user_id = user_id
return (user_id in UserData.friend_list)

5 changes: 5 additions & 0 deletions main/scn/show_post/show_post.gd
Original file line number Diff line number Diff line change
@@ -149,8 +149,13 @@ func _on_ShowPost_gui_input(event):
db_reference.disconnect("new_data_update", self, "_on_db_data")
db_reference.disconnect("patch_data_update", self, "_on_db_data")
clear_comments()
clear_likes()

func clear_likes():
like_btn.set_text(str(0))

func clear_comments():
comments_btn.set_text(str(0))
for comment in comments_list.get_children():
comment.queue_free()

11 changes: 5 additions & 6 deletions main/scn/show_post/show_post.tscn
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ __meta__ = {
[node name="ColorRect" type="ColorRect" parent="Post"]
margin_right = 898.0
margin_bottom = 476.0
color = Color( 0, 0, 0, 1 )
color = Color( 0, 0, 0, 0.705882 )

[node name="PostContainer" type="HBoxContainer" parent="Post"]
margin_right = 898.0
@@ -209,23 +209,22 @@ custom_constants/separation = 0
[node name="CommentsContainer" type="ScrollContainer" parent="Post/PostContainer/Content/Container"]
margin_top = 148.0
margin_right = 280.0
margin_bottom = 446.0
margin_bottom = 414.0
size_flags_horizontal = 3
size_flags_vertical = 3
scroll_horizontal_enabled = false

[node name="CommentsList" type="VBoxContainer" parent="Post/PostContainer/Content/Container/CommentsContainer"]
margin_right = 280.0
margin_bottom = 298.0
margin_bottom = 266.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 10

[node name="NewCommentContainer" type="HBoxContainer" parent="Post/PostContainer/Content/Container"]
visible = false
margin_top = 447.0
margin_top = 419.0
margin_right = 280.0
margin_bottom = 474.0
margin_bottom = 446.0

[node name="Comment" type="LineEdit" parent="Post/PostContainer/Content/Container/NewCommentContainer"]
margin_right = 280.0
5 changes: 3 additions & 2 deletions main/scn/signin/signin.gd
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ func _ready():
$UpdateProfile.hide()
animate_SignContainer(true)
yield(get_tree(), "idle_frame")
# return
return
Firebase.Auth.load_auth()
if not Firebase.Auth.auth.empty():
Activities.loading(true)
@@ -93,7 +93,8 @@ func _on_SignContainer_logged(login):
RequestsManager.update_user()
emit_signal("sign_in")

func _on_SignContainer_signed(signup):
func _on_SignContainer_signed(signup : Dictionary):
if UserData.user_id == "": return
print("signed")
Firebase.Auth.save_auth(signup)
UserData.user_id = signup.localid
2 changes: 1 addition & 1 deletion main/scn/suggest_users/suggest_users.gd
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ func suggest_user(user : String):
func check_friend(user_id : String):
get_node("UsersBox/UserHeader/ConnecBtn").visible = not (user_id == UserData.user_id)
get_node("UsersBox/UserHeader/ConnecBtn").activated = (user_id in UserData.friend_list)
get_node("UsersBox/UserHeader/ConnecBtn").set_text("Connected" if (user_id in UserData.friend_list) else "Conect")
get_node("UsersBox/UserHeader/ConnecBtn").set_text("Connected" if (user_id in UserData.friend_list) else "Connect")
self.user_id = user_id

func _on_Name_pressed():
3 changes: 3 additions & 0 deletions main/scripts/activities.gd
Original file line number Diff line number Diff line change
@@ -28,3 +28,6 @@ func loading(l : bool):

func show_error(error : String):
emit_signal("show_error", error)

func on_about() -> void:
home.show_about()
8 changes: 8 additions & 0 deletions main/scripts/requests_manager.gd
Original file line number Diff line number Diff line change
@@ -154,6 +154,14 @@ func send_notification(author : String, recipient : String, action : String, sou
viewed = false
})

func is_user_online(id : String) -> FirestoreTask:
return Firebase.Firestore.query(
FirestoreQuery.new() \
.from("users") \
.where("user_id", FirestoreQuery.OPERATOR.EQUAL, id, FirestoreQuery.OPERATOR.AND) \
.where("is_logged", FirestoreQuery.OPERATOR.EQUAL, true)
)

func view_notification(notification_id : String) -> void:
Firebase.Database.get_database_reference("sociadot/notifications/"+UserData.user_id) \
.update(notification_id, {viewed = true})
5 changes: 4 additions & 1 deletion main/scripts/users_manager.gd
Original file line number Diff line number Diff line change
@@ -72,7 +72,10 @@ func update_user(id : String, document : FirestoreDocument = null, picture : Ima
user._on_get_document(document)
if picture != null:
user.update_picture(picture)


func get_new_user_doc(id : String) -> void:
var user : User = get_user_by_id(id)
user._on_get_document(yield(RequestsManager.get_user(id), "get_document"))

func has_user(id : String) -> bool:
for user in users:
53 changes: 3 additions & 50 deletions project.godot
Original file line number Diff line number Diff line change
@@ -9,11 +9,6 @@
config_version=4

_global_script_classes=[ {
"base": "DocItem",
"class": "ArgumentDocItem",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_item/argument_doc_item.gd"
}, {
"base": "PanelContainer",
"class": "ChatNode",
"language": "GDScript",
@@ -24,36 +19,16 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://firebase-ui/database_box_containers/base_boxcontainer/CircularContainer.gd"
}, {
"base": "DocItem",
"class": "ClassDocItem",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_item/class_doc_item.gd"
}, {
"base": "HBoxContainer",
"class": "CommentContainer",
"language": "GDScript",
"path": "res://main/scn/show_post/comment/comment.gd"
}, {
"base": "DocItem",
"class": "ConstantDocItem",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_item/constant_doc_item.gd"
}, {
"base": "PanelContainer",
"class": "CustomBaseButton",
"language": "GDScript",
"path": "res://firebase-ui/buttons/base_button/base_button.gd"
}, {
"base": "Reference",
"class": "DocExporter",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_exporter/doc_exporter.gd"
}, {
"base": "Reference",
"class": "DocItem",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_item/doc_item.gd"
}, {
"base": "PanelContainer",
"class": "FieldContainer",
"language": "GDScript",
@@ -144,11 +119,6 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://main/scn/header/interactive/interactive_header.gd"
}, {
"base": "DocItem",
"class": "MethodDocItem",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_item/method_doc_item.gd"
}, {
"base": "PanelContainer",
"class": "Notification",
"language": "GDScript",
@@ -159,21 +129,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://main/scn/post/post.gd"
}, {
"base": "DocItem",
"class": "PropertyDocItem",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_item/property_doc_item.gd"
}, {
"base": "VBoxContainer",
"class": "Settings",
"language": "GDScript",
"path": "res://main/scn/settings/settings.gd"
}, {
"base": "DocItem",
"class": "SignalDocItem",
"language": "GDScript",
"path": "res://addons/silicon.util.custom_docs/doc_item/signal_doc_item.gd"
}, {
"base": "Reference",
"class": "StorageReference",
"language": "GDScript",
@@ -190,15 +150,10 @@ _global_script_classes=[ {
"path": "res://main/scn/app/top_bar.gd"
} ]
_global_script_class_icons={
"ArgumentDocItem": "",
"ChatNode": "",
"CircularContainer": "",
"ClassDocItem": "",
"CommentContainer": "",
"ConstantDocItem": "",
"CustomBaseButton": "",
"DocExporter": "",
"DocItem": "",
"FieldContainer": "",
"FirebaseAuth": "",
"FirebaseContainer": "",
@@ -217,12 +172,9 @@ _global_script_class_icons={
"FirestoreTileMap": "",
"FriendButton": "",
"InteractiveHeader": "",
"MethodDocItem": "",
"Notification": "",
"PostContainer": "",
"PropertyDocItem": "",
"Settings": "",
"SignalDocItem": "",
"StorageReference": "",
"StorageTask": "",
"TopBar": ""
@@ -235,7 +187,7 @@ run/main_scene="res://main/scn/app/main.tscn"
boot_splash/image="res://main/res/imgs/Splashscreen.png"
boot_splash/fullsize=false
boot_splash/bg_color=Color( 0.141176, 0.141176, 0.141176, 1 )
config/icon="res://main/res/imgs/Godot_icon.svg"
config/icon="res://main/res/imgs/Splashscreen.png"

[autoload]

@@ -262,10 +214,11 @@ window/per_pixel_transparency/allowed=true
window/per_pixel_transparency/enabled=true
window/handheld/orientation="sensor"
window/stretch/aspect="keep_width"
window/size/width.mia_feature=1000

[editor_plugins]

enabled=PoolStringArray( "godot-firebase" )
enabled=PoolStringArray( "res://addons/godot-firebase/plugin.cfg", "res://addons/http-sse-client/plugin.cfg" )

[firebase]

0 comments on commit a7ef00f

Please sign in to comment.