-
Notifications
You must be signed in to change notification settings - Fork 52
Added an intermediate page for accessing camera in V2 extensions #20
Conversation
BaseApp/PAG99999.txt
Outdated
PageType=StandardDialog; | ||
SourceTableTemporary=Yes; | ||
OnOpenPage=BEGIN | ||
CameraAvailable := CameraProvider.IsAvailable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a codeunit is also needed to expose IsAvailable method.
This is a fine little functionality, but it needs some refactoring. We should not have this much code on a page. We will take a closer look and do a little refactoring and re-design. |
@JesperSchulz Thanks. Also got some UX feedback that it would be nice to have only one OK button on the intermediate page instead of OK/Cancel. Could you please also have a look that while refactoring? |
BaseApp/PAG99999.txt
Outdated
CameraOptions.Quality := Quality; | ||
CameraOptions.AllowEdit := AllowEdit; | ||
|
||
CASE EncodingType OF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try using Evaluate to get the string value of the enumeration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved properties to the page itself, removed options.
BaseApp/PAG99999.txt
Outdated
OnOpenPage=BEGIN | ||
CameraAvailable := CameraProvider.IsAvailable(); | ||
|
||
IF CameraAvailable THEN BEGIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better do
IF NOT CameraAvailable THEN
EXIT;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
BaseApp/PAG99999.txt
Outdated
InStream@1003 : InStream; | ||
OutStream@1004 : OutStream; | ||
BEGIN | ||
File.OPEN(PictureFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use blob.Import(filename)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
BaseApp/TAB99998.txt
Outdated
{ 3 ; ;EncodingType ;Option ;OptionString=JPEG,PNG } | ||
{ 4 ; ;MediaType ;Option ;OptionString=Picture,Video,AllMedia } | ||
{ 5 ; ;SourceType ;Option ;OptionString=Camera,PhotoLibrary } | ||
{ 6 ; ;TakenPicture ;BLOB } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just Call them Picture and PictureName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not relevant anymore.
BaseApp/TAB99998.txt
Outdated
} | ||
KEYS | ||
{ | ||
{ ;Quality ;Clustered=Yes } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you end up saving this you should have a better key. A GUID will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Table removed
BaseApp/PAG99999.txt
Outdated
CameraProvider.RequestPictureAsync(CameraOptions); | ||
END; | ||
END; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Us QueryClose to return the LookUpOK if you got a picture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not possible, as discussed. Instead added GetPicture(stream: InStream): boolean, as agreed.
Please make sure to update the usage sample to reflect the changed code. |
Create "Camera Interaction" page 1910. This pull request addresses #20.
Addressed through pull request #44. Case closed. |
@JesperSchulz i've just tested this in wave 2 with iPhone and found that So That's because And which opens this new step in the iPhone. But i think it's not longer true... So, you need to change "Camera iteraction".GetPicture business logic. |
@dkatson, thanks for letting me know! I'll see what i can do ;-) |
@JesperSchulz, We have tested the camera feature in Wave2 the same issue occurring, After uploading screen, showing blank import screen and if we cancel the import screen, we are getting following error |
We've actually not been able to get around to this issue yet. There are currently quite a few more pressing tasks we need to attend to, I'm afraid. But I've created a bug for this and we should be able to get to it soon. If you'd like to suggest a fix, please go right ahead :-) That might just speed up things! Otherwise please have a little more patience. |
Well, that was my workaround.
|
So, just completely ignore Page "Camera Interaction". It works, but not so sexy as with "Camera Interaction" :) |
Module extracted. Please take it for a spin :-) https://github.com/microsoft/ALAppExtensions/tree/master/Modules/System/Camera%20and%20Media%20Interaction |
@JesperSchulz , Could you please let us know in which build it was included |
The code went in just before Christmas on the 22nd of December. If you take the latest preview build of version 16, you should get it. The code was also backported to 15, but release usually takes a little while. Expect the change to be released by EOM. |
A request is made to use camera feature in V2 extensions.
microsoft/AL#215
The problem is that Camera API requires .NET variable which can be used only on pages. Therefore the proposed solution is to add an intermediate page which would access the camera and provide the taken picture back to the caller as a BLOB.
This solution requires the same number of clicks for the picture to be taken, but shows an intermediate form in the process. On one hand, this form could be a bit distracting, but on the other hand, this form will also report an error message if the camera is not available, so there is no need to check for that in every use case of the camera API and hide the buttons.
The form can also be customized by the extension to provide more instructions to the user.
This is how a picture could be taken using V2 code:
P.S. This is a bit non-standard request - no tests are added since it's all integration API, no codeunits either :)