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
ba81fd20
Commit
ba81fd20
authored
2 years ago
by
Bruno Muniz
Browse files
Options
Downloads
Patches
Plain Diff
improved destination code on launch
parent
16f11a72
No related branches found
No related tags found
1 merge request
!85
Fixes biometric authentication
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/LaunchFeature/LaunchController.swift
+2
-2
2 additions, 2 deletions
Sources/LaunchFeature/LaunchController.swift
Sources/LaunchFeature/LaunchViewModel.swift
+24
-21
24 additions, 21 deletions
Sources/LaunchFeature/LaunchViewModel.swift
with
26 additions
and
23 deletions
Sources/LaunchFeature/LaunchController.swift
+
2
−
2
View file @
ba81fd20
...
...
@@ -27,7 +27,7 @@ public final class LaunchController: UIViewController {
.
statePublisher
.
receive
(
on
:
DispatchQueue
.
main
)
.
sink
{
[
unowned
self
]
in
guard
$0
.
shouldPush
Chats
==
false
else
{
guard
$0
.
shouldPush
EndDestination
!=
.
some
(
.
chats
)
else
{
guard
$0
.
shouldShowTerms
==
false
else
{
navigator
.
perform
(
PresentTermsAndConditions
(
replacing
:
true
,
on
:
navigationController
!
))
return
...
...
@@ -39,7 +39,7 @@ public final class LaunchController: UIViewController {
navigator
.
perform
(
PresentChatList
(
on
:
navigationController
!
))
return
}
guard
$0
.
shouldPush
Onboarding
==
false
else
{
guard
$0
.
shouldPush
EndDestination
!=
.
some
(
.
onboarding
)
else
{
navigator
.
perform
(
PresentOnboardingStart
(
on
:
navigationController
!
))
return
}
...
...
This diff is collapsed.
Click to expand it.
Sources/LaunchFeature/LaunchViewModel.swift
+
24
−
21
View file @
ba81fd20
...
...
@@ -29,6 +29,10 @@ import class XXClient.Cancellable
import
PulseLogHandler
final
class
LaunchViewModel
{
enum
Destination
{
case
chats
,
onboarding
}
struct
UpdateModel
{
let
content
:
String
let
urlString
:
String
...
...
@@ -39,9 +43,8 @@ final class LaunchViewModel {
struct
ViewState
{
var
shouldShowTerms
=
false
var
shouldPushChats
=
false
var
shouldOfferUpdate
:
UpdateModel
?
var
shouldPush
Onboarding
=
false
var
shouldPush
EndDestination
:
Destination
?
}
@Dependency
(\
.
app
.
log
)
var
log
...
...
@@ -202,41 +205,41 @@ extension LaunchViewModel {
try
dummyTrafficManager
.
setStatus
(
dummyTrafficOn
)
var
shouldPushChats
=
false
var
shouldPushOnboarding
=
false
let
endDestination
:
Destination
if
messenger
.
isLoggedIn
()
==
false
{
if
try
messenger
.
isRegistered
()
{
try
messenger
.
logIn
()
endDestination
=
.
chats
}
else
{
try
?
sftpManager
.
unlink
()
try
?
dropboxManager
.
unlink
()
endDestination
=
.
onboarding
}
}
else
{
endDestination
=
.
chats
}
defer
{
hudManager
.
hide
()
if
shouldPushC
hats
{
if
endDestination
==
.
c
hats
{
if
isBiometricsOn
,
permissions
.
biometrics
.
status
()
{
permissions
.
biometrics
.
request
{
[
weak
self
]
granted
in
guard
let
self
else
{
return
}
if
granted
{
self
.
stateSubject
.
value
.
shouldPush
Chats
=
true
self
.
stateSubject
.
value
.
shouldPush
EndDestination
=
.
chats
}
else
{
//
DO WHAT?
//
TODO: A fallback state for failing biometrics
}
}
}
else
{
stateSubject
.
value
.
shouldPush
Chats
=
true
stateSubject
.
value
.
shouldPush
EndDestination
=
.
chats
}
}
else
{
stateSubject
.
value
.
shouldPush
Onboarding
=
shouldPushO
nboarding
stateSubject
.
value
.
shouldPush
EndDestination
=
.
o
nboarding
}
}
if
messenger
.
isLoggedIn
()
==
false
{
if
try
messenger
.
isRegistered
()
{
try
messenger
.
logIn
()
shouldPushChats
=
true
}
else
{
try
?
sftpManager
.
unlink
()
try
?
dropboxManager
.
unlink
()
shouldPushOnboarding
=
true
}
}
else
{
shouldPushChats
=
true
}
if
!
messenger
.
isBackupRunning
()
{
try
?
messenger
.
resumeBackup
()
}
...
...
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