Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xx messenger iOS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
iOS
xx messenger iOS
Commits
443d6f4b
Commit
443d6f4b
authored
2 years ago
by
Bruno Muniz
Browse files
Options
Downloads
Patches
Plain Diff
Fixes comments on MR #52
parent
976bea20
No related branches found
No related tags found
2 merge requests
!54
Releasing 1.1.4
,
!52
Fixes db issue where my contact wasn't created
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/Integration/Session/Session+UD.swift
+3
-4
3 additions, 4 deletions
Sources/Integration/Session/Session+UD.swift
Sources/Integration/Session/Session.swift
+17
-20
17 additions, 20 deletions
Sources/Integration/Session/Session.swift
with
20 additions
and
24 deletions
Sources/Integration/Session/Session+UD.swift
+
3
−
4
View file @
443d6f4b
...
...
@@ -42,11 +42,10 @@ extension Session {
switch
$0
{
case
.
success
(
_
):
self
.
username
=
value
let
query
=
Contact
.
Query
(
id
:
[
self
.
client
.
bindings
.
myId
])
if
var
m
yself
=
try
?
self
.
dbManager
.
fetchContacts
(
query
)
.
first
{
m
yself
.
username
=
value
_
=
try
?
self
.
dbManager
.
saveContact
(
m
yself
)
if
var
m
e
=
try
?
self
.
myContact
()
{
m
e
.
username
=
value
_
=
try
?
self
.
dbManager
.
saveContact
(
m
e
)
}
completion
(
.
success
(
nil
))
...
...
This diff is collapsed.
Click to expand it.
Sources/Integration/Session/Session.swift
+
17
−
20
View file @
443d6f4b
...
...
@@ -183,6 +183,15 @@ public final class Session: SessionType {
}
private
func
continueInitialization
()
throws
{
var
myContact
=
try
self
.
myContact
()
myContact
.
marshaled
=
client
.
bindings
.
meMarshalled
myContact
.
username
=
username
myContact
.
email
=
email
myContact
.
phone
=
phone
myContact
.
authStatus
=
.
friend
myContact
.
isRecent
=
false
_
=
try
dbManager
.
saveContact
(
myContact
)
setupBindings
()
networkMonitor
.
start
()
...
...
@@ -194,26 +203,6 @@ public final class Session: SessionType {
}
.
store
(
in
:
&
cancellables
)
/// Create a contact for myself, for foreign key purposes
///
if
var
myself
=
try
?
dbManager
.
fetchContacts
(
.
init
(
id
:
[
client
.
bindings
.
myId
]))
.
first
{
myself
.
username
=
username
_
=
try
?
dbManager
.
saveContact
(
myself
)
}
else
{
_
=
try
?
dbManager
.
saveContact
(
.
init
(
id
:
client
.
bindings
.
myId
,
marshaled
:
client
.
bindings
.
meMarshalled
,
username
:
username
,
email
:
email
,
phone
:
phone
,
nickname
:
nil
,
photo
:
nil
,
authStatus
:
.
friend
,
isRecent
:
false
,
createdAt
:
Date
()
))
}
registerUnfinishedUploadTransfers
()
registerUnfinishedDownloadTransfers
()
...
...
@@ -487,4 +476,12 @@ public final class Session: SessionType {
}
.
store
(
in
:
&
cancellables
)
}
func
myContact
()
throws
->
Contact
{
if
let
contact
=
try
dbManager
.
fetchContacts
(
.
init
(
id
:
[
client
.
bindings
.
myId
]))
.
first
{
return
contact
}
else
{
return
try
dbManager
.
saveContact
(
.
init
(
id
:
client
.
bindings
.
myId
))
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment