Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Mobile App
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
Mobile App
Commits
675f7da0
Commit
675f7da0
authored
5 years ago
by
Markin Igor
Browse files
Options
Downloads
Patches
Plain Diff
Hide buttons more.
parent
08a8d51f
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Resolve "Rework auth flow."
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/src/app.dart
+30
-3
30 additions, 3 deletions
lib/src/app.dart
lib/src/screens/home.dart
+3
-12
3 additions, 12 deletions
lib/src/screens/home.dart
with
33 additions
and
15 deletions
lib/src/app.dart
+
30
−
3
View file @
675f7da0
...
...
@@ -85,6 +85,8 @@ class _MainAppState extends State<MainApp> {
Screen
_currentScreen
=
Screen
.
App
;
bool
_buttonsHidden
=
true
;
@override
initState
()
{
super
.
initState
();
...
...
@@ -101,13 +103,13 @@ class _MainAppState extends State<MainApp> {
var
token
=
json
.
decode
(
data
.
toString
())[
"access_token"
];
setScreen
(
Screen
.
App
);
log
(
"Open
$_invokerURL
"
);
try
{
await
launch
(
"
$_invokerURL
?token=
$token
&host=
$_host
"
);
}
catch
(
e
)
{
log
(
"Error launching url
$_invokerURL
"
);
showErrorAlert
(
context
,
'Unable to open URL
$_invokerURL
'
,
openVereign
);
}
revealButtons
(
1
);
},
onError:
(
error
)
{
log
(
"Err
$error
"
);
...
...
@@ -121,20 +123,28 @@ class _MainAppState extends State<MainApp> {
errorMessage
.
toLowerCase
()
.
contains
(
"the operation couldn"
)
)
{
if
(
Platform
.
isAndroid
)
{
// Show only for android, because iOS will show the same alert as
// Reveal after three seconds
revealButtons
(
3
);
// Open only for android, because iOS will show the same alert as
// was for Auth request
openVereign
();
}
else
{
setScreen
(
Screen
.
App
);
revealButtons
(
0
);
}
}
else
{
showErrorAlert
(
context
,
Platform
.
isAndroid
?
errorDetails
:
errorMessage
,
openVereign
);
setScreen
(
Screen
.
App
);
revealButtons
(
0
);
}
});
initUniLinks
();
// Show buttons after timeout
revealButtons
(
3
);
}
@override
...
...
@@ -153,6 +163,17 @@ class _MainAppState extends State<MainApp> {
});
}
revealButtons
(
delay
)
{
Timer
(
Duration
(
seconds:
delay
),
()
{
setState
(()
{
_buttonsHidden
=
false
;
});
}
);
}
handleLinkChange
(
Uri
uri
)
{
if
(
uri
?.
path
==
"/authorize"
)
{
setState
(()
{
...
...
@@ -187,6 +208,11 @@ class _MainAppState extends State<MainApp> {
return
;
}
// Hide buttons so they wont blink after we close or finish oauth
setState
(()
{
_buttonsHidden
=
true
;
});
setScreen
(
Screen
.
OAuth
);
var
params
=
Config
.
getOAuthParams
(
host:
_host
);
...
...
@@ -225,6 +251,7 @@ class _MainAppState extends State<MainApp> {
setHost:
setHost
,
openDashboardClick:
openVereign
,
authorizeClick:
startOAuth
,
buttonsHidden:
_buttonsHidden
)
);
}
...
...
This diff is collapsed.
Click to expand it.
lib/src/screens/home.dart
+
3
−
12
View file @
675f7da0
...
...
@@ -12,10 +12,12 @@ class Home extends StatefulWidget {
@required
this
.
setHost
,
@required
this
.
authorizeClick
,
@required
this
.
openDashboardClick
,
@required
this
.
buttonsHidden
,
});
final
AppMode
mode
;
final
String
host
;
final
bool
buttonsHidden
;
final
void
Function
(
String
)
setHost
;
final
void
Function
()
openDashboardClick
;
final
void
Function
()
authorizeClick
;
...
...
@@ -25,25 +27,14 @@ class Home extends StatefulWidget {
}
class
_HomeState
extends
State
<
Home
>
{
bool
_hidden
=
true
;
@override
initState
()
{
super
.
initState
();
Timer
(
Duration
(
seconds:
3
),
()
{
setState
(()
{
_hidden
=
false
;
});
}
);
}
@override
Widget
build
(
BuildContext
context
)
{
if
(
_h
idden
)
{
if
(
widget
.
buttonsH
idden
)
{
return
Scaffold
();
}
...
...
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