Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
erp5
Commits
afac180a
Commit
afac180a
authored
Apr 07, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: store the preferred device in session storage
parent
071d2901
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
+37
-9
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.js
...tem/web_page_module/scanner_gadget_document_scanner_js.js
+35
-7
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.xml
...em/web_page_module/scanner_gadget_document_scanner_js.xml
+2
-2
No files found.
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.js
View file @
afac180a
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
FileReader
,
DataView
,
URL
,
fx
)
{
FileReader
,
DataView
,
URL
,
fx
)
{
"
use strict
"
;
"
use strict
"
;
var
CROPPER_DATA_JIO_KEY
=
'
cropperjs_data_
'
;
var
CROPPER_DATA_JIO_KEY
=
'
cropperjs_data_
'
,
DEVICE_JIO_KEY
=
'
preferred_device
'
;
function
getDevicePreferredCropperData
(
gadget
)
{
function
getDevicePreferredCropperData
(
gadget
)
{
return
gadget
.
session_storage_jio
.
get
(
CROPPER_DATA_JIO_KEY
+
gadget
.
state
.
device_id
)
return
gadget
.
session_storage_jio
.
get
(
CROPPER_DATA_JIO_KEY
+
gadget
.
state
.
device_id
)
...
@@ -27,6 +28,27 @@
...
@@ -27,6 +28,27 @@
);
);
}
}
function
getPreferredDevice
(
gadget
)
{
return
gadget
.
session_storage_jio
.
get
(
DEVICE_JIO_KEY
)
.
push
(
undefined
,
function
(
error
)
{
if
((
error
instanceof
jIO
.
util
.
jIOError
)
&&
(
error
.
status_code
===
404
))
{
return
{};
}
throw
error
;
})
.
push
(
function
(
jio_document
)
{
return
jio_document
.
device_id
;
});
}
function
putPreferredDevice
(
gadget
,
device_id
)
{
return
gadget
.
session_storage_jio
.
put
(
DEVICE_JIO_KEY
,
{
device_id
:
device_id
}
);
}
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// Browser API to promise
// Browser API to promise
//////////////////////////////////////////////////
//////////////////////////////////////////////////
...
@@ -848,7 +870,10 @@
...
@@ -848,7 +870,10 @@
camera_list
=
gadget
.
state
.
camera_list
,
camera_list
=
gadget
.
state
.
camera_list
,
default_value
=
JSON
.
parse
(
options
.
value
);
default_value
=
JSON
.
parse
(
options
.
value
);
return
selectMediaDevice
(
camera_list
,
gadget
.
state
.
device_id
,
false
)
return
getPreferredDevice
(
gadget
)
.
push
(
function
(
preferred_device_id
)
{
return
selectMediaDevice
(
camera_list
,
preferred_device_id
,
false
);
})
.
push
(
function
(
device_id
)
{
.
push
(
function
(
device_id
)
{
if
(
camera_list
.
indexOf
(
device_id
)
===
-
1
)
{
if
(
camera_list
.
indexOf
(
device_id
)
===
-
1
)
{
camera_list
.
push
(
device_id
);
camera_list
.
push
(
device_id
);
...
@@ -995,11 +1020,14 @@
...
@@ -995,11 +1020,14 @@
}
else
{
}
else
{
camera_list
=
[
device_id
];
camera_list
=
[
device_id
];
}
}
return
gadget
.
changeState
({
return
putPreferredDevice
(
gadget
,
device_id
)
display_step
:
'
display_video
'
,
.
push
(
function
()
{
camera_list
:
camera_list
,
return
gadget
.
changeState
({
device_id
:
device_id
display_step
:
'
display_video
'
,
});
camera_list
:
camera_list
,
device_id
:
device_id
});
});
});
});
}
}
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.xml
View file @
afac180a
...
@@ -244,7 +244,7 @@
...
@@ -244,7 +244,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
983.
1729.31351.955
</string>
</value>
<value>
<string>
983.
2714.63510.3754
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1586
185444.24
</float>
<float>
1586
244257.05
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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