Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Memri
Flutter App for Memri
Commits
c500a212
Commit
c500a212
authored
2 years ago
by
Erfan Jazeb Nikoo
Browse files
Options
Download
Plain Diff
Merge branch 'bugfix/importers_bug_fix' into 'dev'
bugfix/importers_bug_fix See merge request
!380
parents
3615a807
8d59e624
Pipeline
#9607
passed with stages
in 6 minutes and 20 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/core/services/gitlab_service.dart
+2
-6
lib/core/services/gitlab_service.dart
lib/providers/oauth_provider.dart
+5
-3
lib/providers/oauth_provider.dart
lib/providers/project_provider.dart
+22
-23
lib/providers/project_provider.dart
pubspec.yaml
+1
-1
pubspec.yaml
with
30 additions
and
33 deletions
+30
-33
lib/core/services/gitlab_service.dart
+
2
-
6
View file @
c500a212
import
'dart:convert'
;
import
'package:memri/constants/app_logger.dart'
;
import
'package:memri/core/apis/gitlab_api.dart'
;
import
'package:memri/core/models/pipeline_job.dart'
;
import
'package:memri/core/services/api_service.dart'
;
...
...
@@ -63,7 +60,8 @@ class GitlabService extends ApiService<GitlabAPI> {
var
userProjects
=
await
getUserProjects
();
for
(
var
project
in
userProjects
)
{
if
((
project
[
'name'
])
==
projectName
)
{
AppLogger
.
debug
(
'PROJECT
${_jsonPrettyString(project)}
'
);
// AppLogger.debug(
// 'PROJECT ${JsonEncoder.withIndent(' ').convert(project)}');
return
project
;
}
}
...
...
@@ -97,6 +95,4 @@ class GitlabService extends ApiService<GitlabAPI> {
}
return
jobs
;
}
String
_jsonPrettyString
(
dynamic
j
)
=
>
JsonEncoder
.
withIndent
(
' '
)
.
convert
(
j
);
}
This diff is collapsed.
Click to expand it.
lib/providers/oauth_provider.dart
+
5
-
3
View file @
c500a212
...
...
@@ -205,11 +205,11 @@ class OAuthProvider with ChangeNotifier {
bool
get
gitlabOAuthExist
=
>
_gitlabOAuthItem
!=
null
&&
_gitlabUserExist
;
Future
<
void
>
initGitlabOAuth
()
async
{
await
setGitlabTokens
();
if
(
_gitlabOAuthItem
==
null
)
{
_gitlabOAuthStream
=
_gitlabItemStream
();
_gitlabOAuthStreamSubscription
=
_gitlabOAuthStream
!.
listen
((
item
)
{
_gitlabOAuthItem
=
item
;
setGitlabTokens
();
resetGitlabStream
();
notifyListeners
();
});
...
...
@@ -414,7 +414,7 @@ class OAuthProvider with ChangeNotifier {
Stream
<
Item
>
_whatsappItemStream
(
String
id
)
async
*
{
while
(
true
)
{
await
Future
.
delayed
(
Duration
(
milli
seconds:
1
000
));
await
Future
.
delayed
(
Duration
(
seconds:
1
));
Item
?
res
;
Item
?
pluginRunItem
=
await
_podService
.
getItem
(
id:
id
);
if
(
pluginRunItem
!=
null
)
{
...
...
@@ -423,7 +423,9 @@ class OAuthProvider with ChangeNotifier {
if
(
res
!=
null
)
{
yield
res
;
if
(
res
.
get
(
'status'
)
==
'daemon'
||
res
.
get
(
'status'
)
==
'done'
)
{
if
(
res
.
get
(
'status'
)
==
'daemon'
||
res
.
get
(
'status'
)
==
'done'
||
res
.
get
(
'status'
)
==
'aborted'
)
{
cancelWhatsappStreamSubs
();
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/providers/project_provider.dart
+
22
-
23
View file @
c500a212
...
...
@@ -685,16 +685,7 @@ class ProjectProvider with ChangeNotifier {
}
void
setupProjectPackageStream
()
{
Stream
<
bool
>
checkProjectPackageStream
()
async
*
{
while
(
true
)
{
await
Future
.
delayed
(
Duration
(
seconds:
3
));
if
(
_gitlabService
.
accessToken
!=
null
&&
gitlabProjectId
!=
null
)
{
yield
await
_gitlabService
.
projectHasModelPackage
(
gitlabProjectId
!
);
}
}
}
projectPackageStream
=
checkProjectPackageStream
();
projectPackageStream
=
_checkProjectPackageStream
();
projectPackageSubscription
=
projectPackageStream
!.
listen
((
hasPackage
)
{
AppLogger
.
debug
(
'checking model package:
$hasPackage
'
);
if
(
hasPackage
!=
projectHasPackage
)
{
...
...
@@ -710,22 +701,16 @@ class ProjectProvider with ChangeNotifier {
});
}
void
setupProjectPipelineStream
()
{
Stream
<
List
<
PipelineJob
>>
_projectPipelineStream
()
async
*
{
while
(
true
)
{
await
Future
.
delayed
(
Duration
(
seconds:
3
));
if
(
_gitlabService
.
accessToken
==
null
||
gitlabProjectId
==
null
||
!
projectHasPackage
)
{
continue
;
}
else
{
var
pipelines
=
await
_gitlabService
.
getPipelineJobs
(
gitlabProjectId
!
);
yield
pipelines
;
}
Stream
<
bool
>
_checkProjectPackageStream
()
async
*
{
while
(
true
)
{
await
Future
.
delayed
(
Duration
(
seconds:
3
));
if
(
_gitlabService
.
accessToken
!=
null
&&
gitlabProjectId
!=
null
)
{
yield
await
_gitlabService
.
projectHasModelPackage
(
gitlabProjectId
!
);
}
}
}
void
setupProjectPipelineStream
()
{
projectPipelineStream
=
_projectPipelineStream
();
projectPipelineSubscription
=
projectPipelineStream
!.
listen
((
pipelines
)
{
AppLogger
.
debug
(
'found project pipelines:
${pipelines.length}
'
);
...
...
@@ -746,6 +731,20 @@ class ProjectProvider with ChangeNotifier {
});
}
Stream
<
List
<
PipelineJob
>>
_projectPipelineStream
()
async
*
{
while
(
true
)
{
await
Future
.
delayed
(
Duration
(
seconds:
3
));
if
(
_gitlabService
.
accessToken
==
null
||
gitlabProjectId
==
null
||
!
projectHasPackage
)
{
continue
;
}
else
{
var
pipelines
=
await
_gitlabService
.
getPipelineJobs
(
gitlabProjectId
!
);
yield
pipelines
;
}
}
}
// Future<Item?> testGetOauthItem() async {
// var query = '''
// query {
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
1
-
1
View file @
c500a212
...
...
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version
:
2.1.
8+1
version
:
2.1.
9+0
environment
:
sdk
:
"
>=2.12.0
<3.0.0"
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets