Skip to content

Commit

Permalink
July 2023 Release of the APL 2023.2 compliant APL Client Library
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amzn-admfox committed Jul 6, 2023
1 parent df2c9b0 commit 51f7df1
Show file tree
Hide file tree
Showing 20 changed files with 207 additions and 203 deletions.
5 changes: 0 additions & 5 deletions APLClient/include/APLClient/AplCoreConnectionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,6 @@ class AplCoreConnectionManager
*/
void sendViewhostScalingMessage();

/**
* Sends document theme information to the client
*/
void sendDocumentThemeMessage();

/**
* Sends document background information to the client
* @param background
Expand Down
1 change: 1 addition & 0 deletions APLClient/include/APLClient/AplCoreMediaPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class AplCoreMediaPlayer : public apl::MediaPlayer {
void previous() override;
void rewind() override;
void seek(int offset) override;
void seekTo(int position) override;
void setTrackIndex(int trackIndex) override;
void setAudioTrack(apl::AudioTrack audioTrack) override;
void setMute(bool mute) override;
Expand Down
23 changes: 1 addition & 22 deletions APLClient/src/AplCoreConnectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ void AplCoreConnectionManager::handleConfigurationChange(const rapidjson::Value&
// config change for theme
if (configurationChange.HasMember(DOCTHEME_KEY) && configurationChange[DOCTHEME_KEY].IsString()) {
configChange = configChange.theme(configurationChange[DOCTHEME_KEY].GetString());
sendDocumentThemeMessage();
}
// config change for mode
if (configurationChange.HasMember(MODE_KEY) &&
Expand Down Expand Up @@ -762,7 +761,6 @@ void AplCoreConnectionManager::handleBuild(const rapidjson::Value& message) {
{apl::RootProperty::kAnimationQuality, static_cast<apl::RootConfig::AnimationQuality>(animationQuality)},
{apl::RootProperty::kUTCTime, getCurrentTime().count()},
{apl::RootProperty::kLocalTimeAdjustment, aplOptions->getTimezoneOffset().count()},
{apl::RootProperty::kSequenceChildCache, 5},
{apl::RootProperty::kDefaultIdleTimeout, -1}
})
.measure(std::make_shared<AplCoreTextMeasurement>(shared_from_this(), m_aplConfiguration))
Expand Down Expand Up @@ -887,7 +885,6 @@ void AplCoreConnectionManager::handleBuild(const rapidjson::Value& message) {
inflationTimer->stop();
// Init viewhost globals
sendViewhostScalingMessage();
sendDocumentThemeMessage();
sendDocumentBackgroundMessage(background);

// Start rendering component hierarchy
Expand Down Expand Up @@ -926,19 +923,6 @@ void AplCoreConnectionManager::sendViewhostScalingMessage() {
}
}

void AplCoreConnectionManager::sendDocumentThemeMessage() {
if (m_Root) {
auto themeMsg = AplCoreViewhostMessage(DOCTHEME_KEY);
auto& alloc = themeMsg.alloc();
rapidjson::Value payload(rapidjson::kObjectType);
std::string docTheme = "dark";
docTheme = m_Root->getTheme();
payload.AddMember(DOCTHEME_KEY, rapidjson::Value(docTheme.c_str(), alloc).Move(), alloc);
themeMsg.setPayload(std::move(payload));
send(themeMsg);
}
}

void AplCoreConnectionManager::sendDocumentBackgroundMessage(const apl::Object& background) {
auto backgroundMsg = AplCoreViewhostMessage(BACKGROUND_KEY);
auto& alloc = backgroundMsg.alloc();
Expand Down Expand Up @@ -998,11 +982,6 @@ void AplCoreConnectionManager::handleUpdate(const rapidjson::Value& update) {
component->update(type, value);
} else {
auto value = update["value"].GetFloat();

if (type == apl::UpdateType::kUpdateScrollPosition) {
value = m_AplCoreMetrics->toCore(value);
}

component->update(type, value);
}
}
Expand Down Expand Up @@ -1075,7 +1054,7 @@ void AplCoreConnectionManager::handleGraphicUpdate(const rapidjson::Value& updat
return;
}

auto json = apl::GraphicContent::create(m_Root->getSession(), update["avg"].GetString());
auto json = apl::GraphicContent::create(update["avg"].GetString());
component->updateGraphic(json);
}

Expand Down
12 changes: 12 additions & 0 deletions APLClient/src/AplCoreMediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@ AplCoreMediaPlayer::seek(int offset)
sendMediaPlayerCommand("mediaPlayerSeek", std::move(payload));
}

void
AplCoreMediaPlayer::seekTo(int position)
{
if (!isActive()) return;
resolveExistingAction();

rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> alloc;
rapidjson::Value payload(rapidjson::kObjectType);
payload.AddMember("position", position, alloc);
sendMediaPlayerCommand("mediaPlayerSeekTo", std::move(payload));
}

void
AplCoreMediaPlayer::setTrackIndex(int trackIndex)
{
Expand Down
2 changes: 0 additions & 2 deletions APLClient/test/AplCoreConnectionManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,6 @@ TEST_F(AplCoreConnectionManagerTest, HandleReInflateSuccess) {
SetupMocksForDocumentRender();
// Given a document build success.
BuildDocument(DOCUMENT, DATA, VIEWPORT);
const std::string measureMessageType = "\"type\":\"measure\"";
EXPECT_CALL(*m_mockAplOptions, sendMessage(_, MatchOutMessage(measureMessageType, ""))).Times(AtLeast(1));
const std::string hierarchyMessageType = "\"type\":\"hierarchy\"";
EXPECT_CALL(*m_mockAplOptions, sendMessage(_, MatchOutMessage(hierarchyMessageType, ""))).Times(1);

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog for apl-client-library

## [2023.2]
This release adds support for version 2023.2 of the APL specification. Please also see APL Core Library for changes: [apl-core-library CHANGELOG](https://github.com/alexa/apl-core-library/blob/master/CHANGELOG.md)

### Added
- Add support for the seekTo ControlMedia command

### Changed
- Remove usage of APL Core Library's deprecated getTheme API
- Bug fixes

## [2023.1]
This release adds support for version 2023.1 of the APL specification. Please also see APL Core Library for changes: [apl-core-library CHANGELOG](https://github.com/alexa/apl-core-library/blob/master/CHANGELOG.md)

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Alexa Presentation Language (APL) Client Library

<p>
<a href="https://github.com/alexa/apl-client-library/tree/v2023.1.0" alt="version">
<img src="https://img.shields.io/badge/stable%20version-2023.1.0-brightgreen" /></a>
<a href="https://github.com/alexa/apl-core-library/tree/v2023.1.0" alt="APLCore">
<img src="https://img.shields.io/badge/apl%20core%20library-2023.1.0-navy" /></a>
<a href="https://github.com/alexa/apl-client-library/tree/v2023.2.0" alt="version">
<img src="https://img.shields.io/badge/stable%20version-2023.2.0-brightgreen" /></a>
<a href="https://github.com/alexa/apl-core-library/tree/v2023.2.0" alt="APLCore">
<img src="https://img.shields.io/badge/apl%20core%20library-2023.2.0-navy" /></a>
</p>

## Introduction
Expand Down
2 changes: 1 addition & 1 deletion apl-client-js/@types/apl-html/lib/APLRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export default abstract class APLRenderer<Options = any> {
*/
onDisplayStateChange(displayStateOptions: IDisplayStateOptions): void;
getComponentCount(): number;
private setBackground(docTheme);
private setBackground();
/**
* Get developer tool options (if defined)
*/
Expand Down
1 change: 0 additions & 1 deletion apl-client-js/@types/apl-html/lib/dts/Context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ declare namespace APL {
export class Context extends Deletable {
public static create(options: any, text: TextMeasure, metrics?: APL.Metrics, content?: APL.Content, config?: APL.RootConfig, scalingOptions?: any): Context;
public topComponent(): APL.Component;
public getTheme(): string;
public getBackground(): APL.IBackground;
public setBackground(background: APL.IBackground): void;
public getDataSourceContext(): Promise<string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export declare enum CommandControlMedia {
kCommandControlMediaPrevious = 3,
kCommandControlMediaRewind = 4,
kCommandControlMediaSeek = 5,
kCommandControlMediaSetTrack = 6
kCommandControlMediaSeekTo = 6,
kCommandControlMediaSetTrack = 7
}
4 changes: 3 additions & 1 deletion apl-client-js/@types/apl-html/lib/enums/CommandType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ export declare enum CommandType {
kCommandTypeClearFocus = 20,
kCommandTypeFinish = 21,
kCommandTypeReinflate = 22,
kCommandTypeCustomEvent = 23
kCommandTypeCustomEvent = 23,
kCommandTypeInsertItem = 24,
kCommandTypeRemoveItem = 25
}
17 changes: 9 additions & 8 deletions apl-client-js/@types/apl-html/lib/enums/ComponentType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ export declare enum ComponentType {
kComponentTypeExtension = 2,
kComponentTypeFrame = 3,
kComponentTypeGridSequence = 4,
kComponentTypeImage = 5,
kComponentTypePager = 6,
kComponentTypeScrollView = 7,
kComponentTypeSequence = 8,
kComponentTypeText = 9,
kComponentTypeTouchWrapper = 10,
kComponentTypeVectorGraphic = 11,
kComponentTypeVideo = 12
kComponentTypeHost = 5,
kComponentTypeImage = 6,
kComponentTypePager = 7,
kComponentTypeScrollView = 8,
kComponentTypeSequence = 9,
kComponentTypeText = 10,
kComponentTypeTouchWrapper = 11,
kComponentTypeVectorGraphic = 12,
kComponentTypeVideo = 13
}

0 comments on commit 51f7df1

Please sign in to comment.