Skip to content

Commit 4ad5548

Browse files
committed
APL-CORE: December 2021 Release of APL 1.9 compilant core engine (1.9.0)
For more details on this release refer to CHANGELOG.md To learn about APL see: https://developer.amazon.com/docs/alexa-presentation-language/understand-apl.html
1 parent b085927 commit 4ad5548

File tree

149 files changed

+6509
-961
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+6509
-961
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [1.9.0]
4+
5+
This release adds support for version 1.9 of the APL specification.
6+
7+
### Added
8+
9+
- Added new flag to disallow video player.
10+
- Added new gesture, Tap.
11+
- Added support for animating bound values and vector graphic parameters.
12+
- Added support for source http headers on images, vector graphics and video tracks.
13+
- Allow config change objects to contain custom environment property values.
14+
15+
### Changed
16+
17+
- Alpha feature: APL Extension logic is no longer interleaved with APL
18+
- Bug fixes.
19+
- Build improvements.
20+
321
## [1.8.1]
422

523
### Changed
@@ -28,6 +46,12 @@ This release adds support for version 1.8 of the APL specification.
2846
- Bug fixes
2947
- Build improvements
3048

49+
## [1.7.2]
50+
51+
### Changed
52+
53+
- Bug fixes
54+
3155
## [1.7.1]
3256

3357
### Changed
@@ -61,6 +85,12 @@ This release adds support for version 1.7 of the APL specification.
6185
- Other bug fixes
6286
- Build improvements
6387

88+
## [1.6.3]
89+
90+
### Changed
91+
92+
- Bug fixes
93+
6494
## [1.6.2]
6595

6696
### Changed

aplcore/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,15 @@ target_link_libraries(apl
115115
libyoga)
116116

117117
# include the alexa extensions library
118-
if (BUILD_ALEXAEXTENSIONS)
118+
if (ENABLE_ALEXAEXTENSIONS)
119+
if (NOT BUILD_ALEXAEXTENSIONS)
120+
# Check to see if it's available from the system.
121+
find_package(alexaext REQUIRED)
122+
endif (NOT BUILD_ALEXAEXTENSIONS)
119123
target_link_libraries(apl
120124
PUBLIC
121125
alexa::extensions)
122-
endif(BUILD_ALEXAEXTENSIONS)
126+
endif(ENABLE_ALEXAEXTENSIONS)
123127

124128
# Log dependencies for Android
125129

aplcore/aplcoreConfig.cmake.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ else()
1313

1414
endif()
1515

16+
set(USE_INTERNAL_ALEXAEXT @BUILD_ALEXAEXTENSIONS@)
17+
18+
if(NOT USE_INTERNAL_ALEXAEXT)
19+
find_package(alexaext REQUIRED)
20+
endif()
21+
1622
include("${CMAKE_CURRENT_LIST_DIR}/aplcoreTargets.cmake")
1723

1824
set_target_properties(apl::core

aplcore/include/apl/animation/animatedproperty.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "apl/common.h"
2020
#include "apl/component/componentproperties.h"
2121
#include "apl/primitives/transform.h"
22+
#include "apl/utils/make_unique.h"
2223
#include "apl/utils/noncopyable.h"
2324

2425
namespace apl {
@@ -34,31 +35,36 @@ class AnimatedProperty : public NonCopyable {
3435
const Object& object);
3536

3637
virtual void update(const CoreComponentPtr& component, float alpha) = 0;
37-
38-
virtual PropertyKey key() const = 0;
38+
virtual std::string key() const = 0;
3939
};
4040

4141
class AnimatedDouble : public AnimatedProperty {
4242
public:
43-
AnimatedDouble(PropertyKey key, double from, double to);
44-
AnimatedDouble(PropertyKey key, const CoreComponentPtr& component, double to);
43+
static std::unique_ptr<AnimatedDouble> create(PropertyKey key, std::string property, double from, double to) {
44+
return std::make_unique<AnimatedDouble>(key, std::move(property), from, to);
45+
}
4546

46-
void update(const CoreComponentPtr& component, float alpha) override;
47+
AnimatedDouble(PropertyKey key, std::string property, double from, double to)
48+
: mKey(key), mProperty(std::move(property)), mFrom(from), mTo(to) {}
4749

48-
PropertyKey key() const override { return mKey; }
50+
private:
51+
void update(const CoreComponentPtr& component, float alpha) override;
52+
std::string key() const override { return mProperty; }
4953

5054
private:
5155
PropertyKey mKey; // The component property we're animating
56+
std::string mProperty;
5257
double mFrom; // The from value
5358
double mTo; // The to value
5459
};
5560

5661
class AnimatedTransform : public AnimatedProperty {
5762
public:
58-
AnimatedTransform(const std::shared_ptr<InterpolatedTransformation>& transformation);
63+
explicit AnimatedTransform(std::shared_ptr<InterpolatedTransformation> transformation);
64+
5965
void update(const CoreComponentPtr& component, float alpha) override;
66+
std::string key() const override { return "transform"; }
6067

61-
PropertyKey key() const override { return kPropertyTransform; }
6268
private:
6369
std::shared_ptr<InterpolatedTransformation> mTransformation;
6470
};

aplcore/include/apl/apl_config.h.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16+
#ifndef _APL_GENERATED_CONFIG_H
17+
#define _APL_GENERATED_CONFIG_H
18+
1619
/* Build time configuration options */
1720

1821
#cmakedefine USER_DATA_RELEASE_CALLBACKS
22+
23+
#ifndef ALEXAEXTENSIONS
24+
#cmakedefine ALEXAEXTENSIONS
25+
#endif //ALEXAEXTENSIONS
26+
27+
#endif //_APL_GENERATED_CONFIG_H

aplcore/include/apl/component/component.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,16 @@ class Component : public Counter<Component>,
289289
virtual bool updateGraphic(const GraphicContentPtr& json);
290290

291291
/**
292-
* Updates state of resource associated with extension component
293-
* @param state resource state enum.
294-
*/
295-
virtual void updateResourceState(const ExtensionComponentResourceState& state);
292+
* Updates state of resource associated with extension component. The extension
293+
* is notified of the change.
294+
*
295+
* @param state resource state enum.
296+
* @param errorCode Error code used when the state is kResourceError
297+
* @param error Error message used when the state is kResourceError
298+
*/
299+
virtual void updateResourceState(const ExtensionComponentResourceState& state,
300+
int errorCode = 0,
301+
const std::string& error = "");
296302

297303
/*
298304
* @return The number of children displayed.

aplcore/include/apl/component/componentproperties.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ enum PropertyKey {
612612
kPropertyResourceOnFatalError,
613613
// The state of the rendered resource of an extension component
614614
kPropertyResourceState,
615+
/// The type of the system resource for an extension component
616+
kPropertyResourceType,
615617
/// ContainerComponent child absolute right position
616618
kPropertyRight,
617619
/// Component accessibility role

aplcore/include/apl/component/corecomponent.h

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Pointer;
3939
struct PointerEvent;
4040
class StickyChildrenTree;
4141

42+
using ConstComponentPropIterator = std::map<PropertyKey, ComponentPropDef>::const_iterator;
43+
4244
extern const std::string VISUAL_CONTEXT_TYPE_MIXED;
4345
extern const std::string VISUAL_CONTEXT_TYPE_GRAPHIC;
4446
extern const std::string VISUAL_CONTEXT_TYPE_TEXT;
@@ -224,11 +226,29 @@ class CoreComponent : public Component,
224226
bool hasProperty(PropertyKey key) const { return mAssigned.count(key) != 0; }
225227

226228
/**
227-
* The opposite of setProperty(), this method retrieves the property value.
229+
* Return the value and writeable state of a component property. This is the opposite of the
230+
* setProperty(const std::string& key, const Object& value) method. It checks for (a) intrinsic
231+
* component properties [such as "width"], (b) data-bindings accessible to the component, and
232+
* (c) internal component properties that are exposed (currently just the parameters passed
233+
* to a vector graphic). This method is used by animators to read the current value of a
234+
* property and to verify that the property can be written with setProperty().
235+
* @param key The name of the property
236+
* @return The current value of the property and true if the property is writeable. If the
237+
* property does not exist, returns null and false.
238+
*/
239+
std::pair<Object, bool> getPropertyAndWriteableState(const std::string& key) const;
240+
241+
/**
242+
* Return the value of a component property. This is the opposite of the
243+
* setProperty(const std::string& key, const Object& value) method. It checks for (a) intrinsic
244+
* component properties [such as "width"], (b) data-bindings accessible to the component, and
245+
* (c) internal component properties that are exposed (currently just the parameters passed
246+
* to a vector graphic). This method is used by the "preserve" property to save existing
247+
* property values.
228248
* @param key The property or data-binding to retrieve
229249
* @return The value or null if the property does not exist
230250
*/
231-
Object getProperty(const std::string& key);
251+
Object getProperty(const std::string& key) { return getPropertyAndWriteableState(key).first; }
232252

233253
/**
234254
* Mark a property as being changed. This only applies to properties set to
@@ -657,7 +677,16 @@ class CoreComponent : public Component,
657677
CoreComponentPtr findStateOwner();
658678

659679
/**
660-
* Check if component attached to yoga hierarchy.
680+
* Check if this component is attached to a yoga hierarchy.
681+
*
682+
* Note that depending on the components used, an APL document may be laid
683+
* out using multiple independent yoga trees, which can introduce
684+
* discontinuities in the overall hierarchy. For example, a component may
685+
* choose to treat each child as a top-level yoga node for layout purposes
686+
* (e.g. Pager). This has the effect that a child may not be "attached" to
687+
* its parent component (i.e. isAttached() will return false).
688+
*
689+
* @return true if the component's yoga node has a parent
661690
*/
662691
bool isAttached() const;
663692

@@ -949,6 +978,26 @@ class CoreComponent : public Component,
949978
*/
950979
void fixVisualHash(bool useDirtyFlag);
951980

981+
/**
982+
* Set an internal property that is component-specific and not part of the component definition.
983+
* This should be overridden in a subclass that supports internal properties.
984+
* @param key The name of the property.
985+
* @param value The value to set it to.
986+
* @return True if the property was found and changed.
987+
*/
988+
virtual bool setPropertyInternal(const std::string& key, const Object& value) { return false; }
989+
990+
/**
991+
* Retrieve an internal property that is component-specific and not part of the component
992+
* definition. This should be overridden in a subclass that supports internal properties.
993+
* @param key The name of the property
994+
* @return A Object-Boolean pair. Returns true and the value of the property if it exists and
995+
* can be read. Returns { NULL, false } if the property is not found.
996+
*/
997+
virtual std::pair<Object, bool> getPropertyInternal(const std::string& key) const {
998+
return { Object::NULL_OBJECT(), false };
999+
}
1000+
9521001
private:
9531002
friend streamer& operator<<(streamer&, const Component&);
9541003

@@ -971,10 +1020,10 @@ class CoreComponent : public Component,
9711020

9721021
void updateInheritedState();
9731022

974-
bool setPropertyInternal(const ComponentPropDefSet& propDefSet,
975-
PropertyKey key, const Object& value);
1023+
std::pair<bool, ConstComponentPropIterator> find(PropertyKey key) const;
9761024

977-
virtual bool setPropertyInternal(const std::string& key, const Object& value) { return false; }
1025+
bool setPropertyInternal(ConstComponentPropIterator it, const Object& value);
1026+
std::pair<Object, bool> getPropertyInternal(ConstComponentPropIterator it) const;
9781027

9791028
bool markPropertyInternal(const ComponentPropDefSet& propDefSet, PropertyKey key);
9801029

aplcore/include/apl/component/imagecomponent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ImageComponent : public CoreComponent,
4040
std::string getVisualContextType() const override;
4141

4242
/// Media component trait overrides
43-
std::vector<std::string> getSources() override;
43+
std::vector<URLRequest> getSources() override;
4444
EventMediaType mediaType() const override { return kEventMediaTypeImage; }
4545
void onFail(const MediaObjectPtr&) override;
4646
void onLoad() override;

aplcore/include/apl/component/mediacomponenttrait.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class MediaComponentTrait : public ComponentTrait {
6161
/**
6262
* @return vector of source URI's required by component. Note that order matters.
6363
*/
64-
virtual std::vector<std::string> getSources() = 0;
64+
virtual std::vector<URLRequest> getSources() = 0;
6565

6666
/**
6767
* Override this method in your subclass if you need a callback when a pending media object is returned.

aplcore/include/apl/component/vectorgraphiccomponent.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ class VectorGraphicComponent : public TouchableComponent,
4848
protected:
4949
std::string getVisualContextType() const override;
5050
bool setPropertyInternal(const std::string& key, const Object& value) override;
51+
std::pair<Object, bool> getPropertyInternal(const std::string& key) const override;
5152

5253
// Media component trait overrides
53-
std::vector<std::string> getSources() override;
54+
std::vector<URLRequest> getSources() override;
5455
EventMediaType mediaType() const override { return kEventMediaTypeVectorGraphic; }
5556
void onFail(const MediaObjectPtr&) override;
5657
void onLoad() override;

aplcore/include/apl/content/aplversion.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class APLVersion {
3333
kAPLVersion16 = 0x1U << 6, /// Support version 1.6
3434
kAPLVersion17 = 0x1U << 7, /// Support version 1.7
3535
kAPLVersion18 = 0x1U << 8, /// Support version 1.8
36+
kAPLVersion19 = 0x1U << 9, /// Support version 1.9
3637
kAPLVersion10to11 = kAPLVersion10 | kAPLVersion11, /// Convenience ranges from 1.0 to latest,
3738
kAPLVersion10to12 = kAPLVersion10to11 | kAPLVersion12,
3839
kAPLVersion10to13 = kAPLVersion10to12 | kAPLVersion13,
@@ -41,9 +42,10 @@ class APLVersion {
4142
kAPLVersion10to16 = kAPLVersion10to15 | kAPLVersion16,
4243
kAPLVersion10to17 = kAPLVersion10to16 | kAPLVersion17,
4344
kAPLVersion10to18 = kAPLVersion10to17 | kAPLVersion18,
44-
kAPLVersionLatest = kAPLVersion10to18, /// Support the most recent engine version
45-
kAPLVersionDefault = kAPLVersion10to18, /// Default value
46-
kAPLVersionReported = kAPLVersion18, /// Default reported version
45+
kAPLVersion10to19 = kAPLVersion10to18 | kAPLVersion19,
46+
kAPLVersionLatest = kAPLVersion10to19, /// Support the most recent engine version
47+
kAPLVersionDefault = kAPLVersion10to19, /// Default value
48+
kAPLVersionReported = kAPLVersion19, /// Default reported version
4749
kAPLVersionAny = 0xffffffff, /// Support any versions in the list
4850
};
4951

0 commit comments

Comments
 (0)