Skip to content

Commit eecb7e7

Browse files
committed
fix update
1 parent a968825 commit eecb7e7

File tree

8 files changed

+107
-59
lines changed

8 files changed

+107
-59
lines changed

main/scn/app/main.gd

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
extends Control
22

3+
const version : String = "0.1"
4+
35
onready var activities : Control = $Main/Activities
46
onready var topbar : HBoxContainer = $TopBar
57
onready var loading : Control = $Main/Loading
68
onready var error_lbl : Label = $Main/ERROR
79

10+
onready var user_id_lbl : Label = $Main/AppInfo/UserId
11+
onready var version_lbl : Label = $Main/AppInfo/Version
12+
13+
func _title():
14+
OS.set_window_title("socia.dot v%s"%version)
15+
$TopBar/Name.set_text("socia.dot")
16+
version_lbl.set_text("v%s"%version)
17+
818
func _ready():
9-
OS.set_window_title("socia.dot")
19+
_title()
1020
_connect_signals()
1121
get_tree().get_root().set_transparent_background(true)
1222
if OS.get_name() in ["Android", "iOS"]:
@@ -28,6 +38,7 @@ func _connect_signals():
2838
topbar.connect("moving_from_pos", self, "_on_TopBar_moving_from_pos")
2939

3040
func _on_signin_completed():
41+
user_id_lbl.set_text(UserData.user_id)
3142
Activities.signin.hide()
3243
loading.set_loading(false)
3344
Activities.home = Activities.home_scene.instance()

main/scn/app/main.tscn

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,5 +303,27 @@ __meta__ = {
303303

304304
[node name="Tween" type="Tween" parent="MainContainer/Main"]
305305

306+
[node name="AppInfo" type="HBoxContainer" parent="MainContainer/Main"]
307+
modulate = Color( 1, 1, 1, 0.235294 )
308+
anchor_top = 1.0
309+
anchor_right = 1.0
310+
anchor_bottom = 1.0
311+
margin_top = -27.0
312+
custom_constants/separation = 10
313+
__meta__ = {
314+
"_edit_use_anchors_": false
315+
}
316+
317+
[node name="Version" type="Label" parent="MainContainer/Main/AppInfo"]
318+
margin_right = 8.0
319+
margin_bottom = 27.0
320+
321+
[node name="UserId" type="Label" parent="MainContainer/Main/AppInfo"]
322+
margin_left = 18.0
323+
margin_right = 1024.0
324+
margin_bottom = 27.0
325+
size_flags_horizontal = 3
326+
align = 2
327+
306328
[connection signal="gui_input" from="MainContainer/TopBar/Name" to="MainContainer/TopBar" method="_on_Name_gui_input"]
307329
[connection signal="timeout" from="MainContainer/Main/Loading/Timer" to="MainContainer/Main/Loading" method="_on_Timer_timeout"]

main/scn/friend_button/friend_button.gd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ func set_received_messages(messages : int):
6363
$Header/Messages.set_text(messages as String)
6464

6565
func _on_FriendButton_pressed():
66-
if friend_document.doc_fields.chats.has(UserData.user_id):
67-
pass
68-
else:
69-
friend.update_document()
70-
yield(friend, "update_document")
66+
# if friend_document.doc_fields.chats.has(UserData.user_id):
67+
# pass
68+
# else:
69+
# friend.update_document()
70+
# yield(friend, "update_document")
7171
ChatsManager.open_chat(friend_document)
7272

7373

main/scn/profile/profile.gd

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,30 @@ func set_user_name(user_name : String):
5353
func load_user_posts(user_posts : Array):
5454
$ScrollPost.hide()
5555
for post in post_container_box.get_children():
56-
post.queue_free()
57-
for post in user_posts:
58-
if not post.has("document"):
59-
continue
60-
var post_info : FirestoreDocument = FirestoreDocument.new(post.document)
61-
if PostsManager.has_post(post_info.doc_name):
62-
if PostsManager.has_post_container(post_info.doc_name):
63-
post_container_box.add_child(PostsManager.get_post_container_by_id(post_info.doc_name).duplicate())
56+
if post is PostContainer: post.queue_free()
57+
if ( user_posts.size() == 1 and not user_posts[0].has("document") ) or user_posts.empty():
58+
print(user_posts)
59+
$ScrollPost/PostContainer/Empty.show()
60+
else:
61+
for post in user_posts:
62+
if not post.has("document"):
63+
continue
64+
var post_info : FirestoreDocument = FirestoreDocument.new(post.document)
65+
if PostsManager.has_post(post_info.doc_name):
66+
if PostsManager.has_post_container(post_info.doc_name):
67+
post_container_box.add_child(PostsManager.get_post_container_by_id(post_info.doc_name).duplicate())
68+
else:
69+
var post_container : PostContainer = Activities.post_container_scene.instance()
70+
post_container.load_post(PostsManager.add_post_from_doc(post_info.doc_name, post_info))
71+
post_container_box.add_child(post_container)
6472
else:
73+
var post_obj : PostsManager.Post = PostsManager.add_post_from_doc(
74+
post_info.doc_name,
75+
post_info,
76+
Utilities.get_post_image(post_info.doc_fields.user_id, post_info.doc_name, post_info.doc_fields.image))
6577
var post_container : PostContainer = Activities.post_container_scene.instance()
66-
post_container.load_post(PostsManager.add_post_from_doc(post_info.doc_name, post_info))
78+
post_container.load_post(post_obj)
6779
post_container_box.add_child(post_container)
68-
else:
69-
var post_obj : PostsManager.Post = PostsManager.add_post_from_doc(
70-
post_info.doc_name,
71-
post_info,
72-
Utilities.get_post_image(post_info.doc_fields.user_id, post_info.doc_name, post_info.doc_fields.image))
73-
var post_container : PostContainer = Activities.post_container_scene.instance()
74-
post_container.load_post(post_obj)
75-
post_container_box.add_child(post_container)
7680
$ScrollPost.show()
7781

7882
func _on_ConnecBtn_pressed():

main/scn/profile/profile.tscn

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ content_margin_top = 10.0
1919
content_margin_bottom = 10.0
2020

2121
[node name="Profile" type="VBoxContainer"]
22-
margin_top = 302.0
23-
margin_right = 570.0
24-
margin_bottom = 600.0
22+
anchor_right = 1.0
23+
anchor_bottom = 1.0
2524
rect_min_size = Vector2( 550, 0 )
2625
size_flags_vertical = 3
2726
script = ExtResource( 6 )
@@ -30,16 +29,16 @@ __meta__ = {
3029
}
3130

3231
[node name="Profile" type="Label" parent="."]
33-
margin_right = 570.0
32+
margin_right = 1024.0
3433
margin_bottom = 31.0
3534
custom_fonts/font = SubResource( 1 )
3635
text = "Profile"
3736
align = 1
3837

3938
[node name="Header" type="HBoxContainer" parent="."]
40-
margin_top = 35.0
41-
margin_right = 570.0
42-
margin_bottom = 113.0
39+
margin_top = 39.0
40+
margin_right = 1024.0
41+
margin_bottom = 117.0
4342
rect_min_size = Vector2( 0, 78 )
4443
size_flags_vertical = 4
4544
__meta__ = {
@@ -58,17 +57,17 @@ expand = true
5857
stretch_mode = 1
5958

6059
[node name="Name" type="Label" parent="Header"]
61-
margin_left = 64.0
62-
margin_top = 32.0
63-
margin_right = 92.0
64-
margin_bottom = 46.0
60+
margin_left = 68.0
61+
margin_top = 26.0
62+
margin_right = 116.0
63+
margin_bottom = 51.0
6564
text = "user"
6665

6766
[node name="ConnecBtn" parent="Header" instance=ExtResource( 5 )]
68-
margin_left = 450.0
69-
margin_top = 24.0
70-
margin_right = 570.0
71-
margin_bottom = 54.0
67+
margin_left = 904.0
68+
margin_top = 20.0
69+
margin_right = 1024.0
70+
margin_bottom = 57.0
7271
rect_min_size = Vector2( 120, 30 )
7372
size_flags_horizontal = 14
7473
size_flags_vertical = 4
@@ -90,9 +89,9 @@ align = 1
9089
valign = 1
9190

9291
[node name="ScrollPost" type="ScrollContainer" parent="."]
93-
margin_top = 117.0
94-
margin_right = 570.0
95-
margin_bottom = 298.0
92+
margin_top = 125.0
93+
margin_right = 1024.0
94+
margin_bottom = 600.0
9695
size_flags_horizontal = 3
9796
size_flags_vertical = 3
9897
custom_styles/bg = SubResource( 2 )
@@ -101,10 +100,21 @@ scroll_horizontal_enabled = false
101100
[node name="PostContainer" type="VBoxContainer" parent="ScrollPost"]
102101
margin_left = 10.0
103102
margin_top = 10.0
104-
margin_right = 560.0
105-
margin_bottom = 171.0
103+
margin_right = 1014.0
104+
margin_bottom = 465.0
106105
size_flags_horizontal = 3
107106
size_flags_vertical = 3
108107
custom_constants/separation = 30
108+
109+
[node name="Empty" type="Label" parent="ScrollPost/PostContainer"]
110+
visible = false
111+
margin_right = 1004.0
112+
margin_bottom = 455.0
113+
size_flags_vertical = 7
114+
text = "This user has not shared anything yet.
115+
Try connecting to them and chat together!"
116+
align = 1
117+
valign = 1
118+
109119
[connection signal="visibility_changed" from="." to="." method="_on_Profile_visibility_changed"]
110120
[connection signal="pressed" from="Header/ConnecBtn" to="." method="_on_ConnecBtn_pressed"]

main/scn/signin/signin.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ func _ready():
1818
$UpdateProfile.hide()
1919
animate_SignContainer(true)
2020
yield(get_tree(), "idle_frame")
21-
# return
2221
Firebase.Auth.load_auth()
2322
if not Firebase.Auth.auth.empty():
2423
Activities.loading( true)
@@ -36,8 +35,9 @@ func animate_SignContainer(show : bool):
3635

3736
func animate_UpdateProfile(show : bool):
3837
if show:
38+
$UpdateProfile.show()
3939
$Tween.interpolate_property($UpdateProfile, "rect_position",
40-
rect_size/2 - $UpdateProfile.rect_size/2 - Vector2(0, 40), rect_size/2 - $UpdateProfile.rect_size, 0.8, Tween.TRANS_QUAD, Tween.EASE_OUT)
40+
rect_size/2 - $UpdateProfile.rect_size/2 - Vector2(0, 40), rect_size/2 - $UpdateProfile.rect_size/2, 0.8, Tween.TRANS_QUAD, Tween.EASE_OUT)
4141
$Tween.interpolate_property($UpdateProfile, "modulate", Color(1,1,1,0), Color(1,1,1,1), 0.8, Tween.TRANS_QUAD, Tween.EASE_OUT)
4242
else:
4343
$Tween.interpolate_property($UpdateProfile, "rect_position",

main/scn/signin/signin.tscn

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ size_flags_vertical = 3
114114
custom_styles/panel = SubResource( 3 )
115115

116116
[node name="UpdateProfile" type="PanelContainer" parent="."]
117-
margin_left = 392.0
118-
margin_top = 133.0
119-
margin_right = 632.0
120-
margin_bottom = 466.0
117+
visible = false
118+
margin_left = 377.0
119+
margin_top = 286.0
120+
margin_right = 647.0
121+
margin_bottom = 314.0
122+
rect_min_size = Vector2( 270, 0 )
121123
size_flags_horizontal = 4
122124
size_flags_vertical = 4
123125
__meta__ = {
@@ -127,22 +129,22 @@ __meta__ = {
127129
[node name="VBox" type="VBoxContainer" parent="UpdateProfile"]
128130
margin_left = 14.0
129131
margin_top = 14.0
130-
margin_right = 226.0
132+
margin_right = 256.0
131133
margin_bottom = 319.0
132134
custom_constants/separation = 20
133135
alignment = 1
134136

135137
[node name="Label" type="Label" parent="UpdateProfile/VBox"]
136-
margin_right = 212.0
138+
margin_right = 242.0
137139
margin_bottom = 25.0
138140
text = "Update your profile"
139141
align = 1
140142

141143
[node name="UpdatePicture" type="TextureRect" parent="UpdateProfile/VBox"]
142144
material = ExtResource( 5 )
143-
margin_left = 41.0
145+
margin_left = 56.0
144146
margin_top = 45.0
145-
margin_right = 171.0
147+
margin_right = 186.0
146148
margin_bottom = 175.0
147149
rect_min_size = Vector2( 130, 130 )
148150
size_flags_horizontal = 4
@@ -169,24 +171,23 @@ __meta__ = {
169171

170172
[node name="UpdateUsername" type="LineEdit" parent="UpdateProfile/VBox"]
171173
margin_top = 195.0
172-
margin_right = 212.0
174+
margin_right = 242.0
173175
margin_bottom = 240.0
174176
align = 1
175177
placeholder_text = "username"
176178
caret_blink = true
177179
caret_blink_speed = 0.5
178180

179181
[node name="ConfirmBtn" parent="UpdateProfile/VBox" instance=ExtResource( 9 )]
180-
margin_left = 54.0
182+
margin_left = 69.0
181183
margin_top = 260.0
182-
margin_right = 158.0
184+
margin_right = 173.0
183185
margin_bottom = 305.0
184186
size_flags_horizontal = 4
185187
size_flags_vertical = 10
186188
text = "Confirm"
187189

188190
[node name="ChosePicture" type="FileDialog" parent="."]
189-
visible = true
190191
margin_left = 212.0
191192
margin_top = 150.0
192193
margin_right = 812.0

main/scripts/utilities.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func _ready():
1111
pass
1212

1313
func get_all_users() -> FirestoreTask:
14-
return Firebase.Firestore.list("users")
14+
return Firebase.Firestore.list("sociadot/340b3IJqqSEK1kMijHCC/users")
1515

1616
# Get the user Document by id
1717
func get_user(user_id : String) -> FirestoreTask:
@@ -27,7 +27,7 @@ func get_user_posts(user_id : String) -> FirestoreTask:
2727
return Firebase.Firestore.query(posts_query)
2828

2929
func get_all_posts() -> FirestoreTask:
30-
return Firebase.Firestore.list("posts")
30+
return Firebase.Firestore.list("sociadot/340b3IJqqSEK1kMijHCC/posts")
3131

3232
# Get user image from Storage by id ( image == id )
3333
func get_profile_picture(user_id : String) -> StorageTask:

0 commit comments

Comments
 (0)