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
197a4945
Commit
197a4945
authored
3 years ago
by
Azat Alimov
Browse files
Options
Download
Email Patches
Plain Diff
updated ace bundle; fixed isolate for syncController; created `resetDB` method
parent
c7ada0f8
Pipeline
#6788
passed with stages
in 5 minutes and 16 seconds
Changes
9
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
assets/cvuAceEditorDist/bundle.simple.js
+117
-222
assets/cvuAceEditorDist/bundle.simple.js
assets/cvuAceEditorDist/bundle.simple.js.map
+1
-1
assets/cvuAceEditorDist/bundle.simple.js.map
assets/cvuAceEditorDist/index.html
+1
-0
assets/cvuAceEditorDist/index.html
lib/controllers/app_controller.dart
+11
-19
lib/controllers/app_controller.dart
lib/controllers/database_controller.dart
+5
-3
lib/controllers/database_controller.dart
lib/controllers/sync_controller.dart
+18
-18
lib/controllers/sync_controller.dart
lib/core/cvu/cvu_action.dart
+1
-0
lib/core/cvu/cvu_action.dart
lib/core/services/plugin_handler.dart
+1
-1
lib/core/services/plugin_handler.dart
lib/models/database/database.dart
+6
-0
lib/models/database/database.dart
with
161 additions
and
264 deletions
+161
-264
assets/cvuAceEditorDist/bundle.simple.js
+
117
-
222
View file @
197a4945
This diff is collapsed.
Click to expand it.
assets/cvuAceEditorDist/bundle.simple.js.map
+
1
-
1
View file @
197a4945
This diff is collapsed.
Click to expand it.
assets/cvuAceEditorDist/index.html
+
1
-
0
View file @
197a4945
...
...
@@ -16,6 +16,7 @@
</style>
<meta
charset=
"utf-8"
>
<body>
<h1>
test
</h1>
</body>
<script
src=
"bundle.simple.js"
></script>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/controllers/app_controller.dart
+
11
-
19
View file @
197a4945
...
...
@@ -105,26 +105,18 @@ class AppController {
var
documentsDirectory
;
if
(
!
kIsWeb
)
{
documentsDirectory
=
(
await
getApplicationDocumentsDirectory
())
.
path
;
syncController
.
runSync
(
IsolateSyncConfig
(
port:
receivePort
.
sendPort
,
connection:
connection
,
schema:
databaseController
.
schema
,
documentsDirectory:
documentsDirectory
,
rootKey:
Authentication
.
lastRootPublicKey
,
isolate:
databaseController
.
driftIsolate
!
));
/// TODO: Should fix this Isolate
// syncIsolate = await Isolate.spawn(
// syncController.runSync,
// IsolateSyncConfig(
// port: receivePort.sendPort,
// connection: connection,
// schema: databaseController.schema,
// documentsDirectory: documentsDirectory,
// rootKey: Authentication.lastRootPublicKey,
// isolate: databaseController.driftIsolate!));
syncIsolate
=
await
Isolate
.
spawn
(
runSync
,
IsolateSyncConfig
(
port:
receivePort
.
sendPort
,
connection:
connection
,
schema:
databaseController
.
schema
,
documentsDirectory:
documentsDirectory
,
rootKey:
Authentication
.
lastRootPublicKey
,
isolate:
databaseController
.
driftIsolate
!
));
}
else
{
syncController
.
runSync
(
SyncConfig
(
connection:
connection
,
schema:
databaseController
.
schema
));
runSync
(
SyncConfig
(
connection:
connection
,
schema:
databaseController
.
schema
));
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/controllers/database_controller.dart
+
5
-
3
View file @
197a4945
...
...
@@ -44,11 +44,13 @@ class DatabaseController {
}
Future
<
void
>
delete
()
async
{
await
databasePool
.
resetDb
();
await
databasePool
.
close
();
databasePool
.
attachedDatabase
.
close
();
if
(
!
inMemory
||
kIsWeb
)
{
await
databasePool
.
attachedDatabase
.
close
();
await
driftIsolate
?.
shutdownAll
();
/*if (!inMemory || kIsWeb) {
await deleteDb(databaseName);
}
}
*/
isInited
=
false
;
}
...
...
This diff is collapsed.
Click to expand it.
lib/controllers/sync_controller.dart
+
18
-
18
View file @
197a4945
...
...
@@ -20,6 +20,24 @@ import 'package:memri/models/sync_config.dart';
import
'package:memri/utils/extensions/collection.dart'
;
import
'package:moor/moor.dart'
;
Future
<
void
>
runSync
(
SyncConfig
config
)
async
{
var
dbController
=
DatabaseController
();
dbController
.
schema
=
config
.
schema
;
if
(
kIsWeb
)
{
dbController
.
databasePool
=
Database
.
connect
(
connectToWorker
());
}
else
{
if
(
config
is
IsolateSyncConfig
)
{
SyncController
.
documentsDirectory
=
config
.
documentsDirectory
;
SyncController
.
lastRootKey
=
config
.
rootKey
;
dbController
.
driftIsolate
=
config
.
isolate
;
dbController
.
databasePool
=
Database
.
connect
(
await
config
.
isolate
.
connect
());
}
}
final
syncController
=
SyncController
(
dbController
);
Stream
.
periodic
(
const
Duration
(
seconds:
AppSettings
.
syncControllerIntervalSecs
))
.
listen
((
_
)
=
>
syncController
.
sync
(
connectionConfig:
config
.
connection
));
}
enum
SyncControllerState
{
idle
,
started
,
...
...
@@ -128,24 +146,6 @@ class SyncController {
}
}
Future
<
void
>
runSync
(
SyncConfig
config
)
async
{
var
dbController
=
DatabaseController
();
dbController
.
schema
=
config
.
schema
;
if
(
kIsWeb
)
{
dbController
.
databasePool
=
Database
.
connect
(
connectToWorker
());
}
else
{
if
(
config
is
IsolateSyncConfig
)
{
SyncController
.
documentsDirectory
=
config
.
documentsDirectory
;
SyncController
.
lastRootKey
=
config
.
rootKey
;
dbController
.
driftIsolate
=
config
.
isolate
;
dbController
.
databasePool
=
Database
.
connect
(
await
config
.
isolate
.
connect
());
}
}
final
syncController
=
SyncController
(
dbController
);
runSyncStream
=
Stream
.
periodic
(
const
Duration
(
seconds:
AppSettings
.
syncControllerIntervalSecs
))
.
listen
((
_
)
=
>
syncController
.
sync
(
connectionConfig:
config
.
connection
));
}
sync
({
PodConnectionDetails
?
connectionConfig
,
Function
(
String
?
)
?
completion
})
async
{
currentConnection
=
connectionConfig
??
await
AppController
.
shared
.
podConnectionConfig
;
if
(
currentConnection
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/core/cvu/cvu_action.dart
+
1
-
0
View file @
197a4945
...
...
@@ -1930,6 +1930,7 @@ class CVUActionGeneratePluginCvu extends CVUAction {
RichText {
font: bodyText1
color: #333333
spans: ['''
;
for
(
var
feature
in
features
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/core/services/plugin_handler.dart
+
1
-
1
View file @
197a4945
...
...
@@ -85,7 +85,7 @@ class PluginHandler {
var
pluginName
=
(
await
plugin
.
property
(
"pluginName"
))
!
.
$value
.
value
;
await
runner
.
setPropertyValue
(
"status"
,
PropertyDatabaseValueString
(
"cvuPresented"
));
await
Future
.
delayed
(
Duration
(
seconds:
3
));
await
pageController
.
sceneController
.
navigateToNewContext
(
animated:
false
,
viewName:
"
${pluginName}
-userActionNeeded"
,
...
...
This diff is collapsed.
Click to expand it.
lib/models/database/database.dart
+
6
-
0
View file @
197a4945
...
...
@@ -453,6 +453,12 @@ class Database extends _$Database {
Future
<
int
>
navigationStateDelete
(
NavigationStack
record
)
async
{
return
await
(
delete
(
navigationState
).
.
where
((
t
)
=
>
t
.
sessionID
.
equals
(
record
.
sessionID
)))
.
go
();
}
Future
resetDb
()
async
{
for
(
var
table
in
allTables
)
{
await
delete
(
table
)
.
go
();
}
}
}
class
ItemPropertyRecordTableData
{
...
...
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