Skip to content

Commit

Permalink
Merge pull request #694 from smartdevicelink/release/5.8.0
Browse files Browse the repository at this point in the history
Release 5.8.0
  • Loading branch information
jacobkeeler authored Oct 26, 2022
2 parents fb1f122 + 4159ea1 commit 3915459
Show file tree
Hide file tree
Showing 12 changed files with 531 additions and 217 deletions.
55 changes: 0 additions & 55 deletions app/controller/sdl/Abstract/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1589,61 +1589,6 @@ SDL.SDLController = Em.Object.extend(
app.deactivateWindow(window);
},

/**
* @function getDefaultCapabilities
* @param {Integer} windowID
* @description returns string of predefined system capabilities for windowID
*/
getDefaultCapabilities: function (windowID, appID) {
let windowType = (windowID === undefined || windowID === 0) ? "MAIN" : "WIDGET";

let windowCapability = SDL.deepCopy(SDL.SDLModelData.defaultWindowCapability[windowType]);
if(windowType === "WIDGET") {
windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["windowID"] = windowID;
}

if(appID) {
const is_web_view_template = function(model) {
const template = model.templateConfiguration.template;
if (template == "DEFAULT" && model.appType.indexOf('WEB_VIEW') >= 0) {
return true;
}

return template == "WEB_VIEW";
}

var appModel = this.getApplicationModel(appID);
if (appModel && is_web_view_template(appModel) && windowType == "MAIN") {
let text_fields = windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["textFields"];
const text_fields_to_exclude = [
'mainField1', 'mainField2', 'mainField3', 'mainField4',
'mediaClock', 'mediaTrack'
];
for (var i = text_fields.length - 1; i >= 0; i--) {
if (text_fields_to_exclude.includes(text_fields[i].name)) {
text_fields.splice(i, 1);
}
}

let image_fields = windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["imageFields"];
const image_fields_to_exclude = [
'softButtonImage', 'menuIcon', 'graphic', 'secondaryGraphic'
];
for (var i = image_fields.length - 1; i >= 0; i--) {
if (image_fields_to_exclude.includes(image_fields[i].name)) {
image_fields.splice(i, 1);
}
}

delete windowCapability["systemCapability"]["displayCapabilities"][0]["windowCapabilities"][0]["softButtonCapabilities"];
}

windowCapability["appID"] = appID;
}

return windowCapability;
},

/**
* @function getDisplayCapability
* @param {Integer} appID
Expand Down
146 changes: 93 additions & 53 deletions app/model/media/AudioModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,73 +260,85 @@ SDL.AudioModel = Em.Object.extend({
/**
* Turn on CD
*/
turnOnCD: function () {
turnOnCD: function (event=null, is_background=false) {
if (!SDL.States.media.player.cd.active) {
this.deactivateAll();
SDL.States.goToStates('media.player.cd');
this.changeAudioSource('media.player.cd', is_background);
}
if (!is_background) {
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.cdModel, 'cd');
}
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.cdModel, 'cd');
this.returnParameters();
},

/**
* Turn on USB
*/
turnOnUSB: function () {
turnOnUSB: function (event=null, is_background=false) {
if (!SDL.States.media.player.usb.active) {
this.deactivateAll();
SDL.States.goToStates('media.player.usb');
this.changeAudioSource('media.player.usb', is_background);
}
if (!is_background) {
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.usbModel, 'usb');
}
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.usbModel, 'usb');
this.returnParameters();
},

/**
* Turn on Radio
*/
turnOnRadio: function () {
turnOnRadio: function (event=null, is_background=false) {
if (!SDL.States.media.player.radio.active) {
this.deactivateAll();
SDL.States.goToStates('media.player.radio');
this.changeAudioSource('media.player.radio', is_background);
}
SDL.RCModulesController.currentRadioModel.saveCurrentOptions();
SDL.RCModulesController.currentRadioModel.set('active', true);
if (!is_background) {
SDL.RCModulesController.currentRadioModel.set('active', true);
}
this.returnParameters();
},

/**
* Turn on Bluetooth
*/
turnOnBluetooth: function () {
turnOnBluetooth: function (event=null, is_background=false) {
if (!SDL.States.media.player.bluetooth.active) {
this.deactivateAll();
SDL.States.goToStates('media.player.bluetooth');
this.changeAudioSource('media.player.bluetooth', is_background);
}
if (!is_background) {
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.bluetoothModel, 'bluetooth');
}
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.bluetoothModel, 'bluetooth');
this.returnParameters();
},

/**
* Turn on LineIn
*/
turnOnLineIn: function () {
turnOnLineIn: function (event=null, is_background=false) {
if (!SDL.States.media.player.lineIn.active) {
this.deactivateAll();
SDL.States.goToStates('media.player.lineIn');
this.changeAudioSource('media.player.lineIn', is_background);
}
if (!is_background) {
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.lineInModel, 'lineIn');
}
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.lineInModel, 'lineIn');
this.returnParameters();
},

/**
* Turn on IPod
*/
turnOnIPod: function () {
turnOnIPod: function (event=null, is_background=false) {
if (!SDL.States.media.player.ipod.active) {
this.deactivateAll();
SDL.States.goToStates('media.player.ipod');
this.changeAudioSource('media.player.ipod', is_background);
}
if (!is_background) {
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.ipodModel, 'ipod');
}
this.onPlayerEnter(SDL.RCModulesController.currentAudioModel.ipodModel, 'ipod');
this.returnParameters();
},

Expand Down Expand Up @@ -544,12 +556,12 @@ SDL.AudioModel = Em.Object.extend({
this.changeSourceFromBluetooth(is_background);
break;
}
case 'media.player.lieIn': {
case 'media.player.lineIn': {
this.changeSourceFromLineIn(is_background);
break;
}
case 'media.player.ipod': {
this.changeSourceFromIpod(is_background);
this.changeSourceFromIPod(is_background);
break;
}
default: {
Expand All @@ -558,17 +570,63 @@ SDL.AudioModel = Em.Object.extend({
}
},

/**
* Switch RC Audio source based on whether the app is in focus
* @param nextState Audio source to transition to
* @param isBackground
*/
changeAudioSource : function (nextState, isBackground){
if (!isBackground) {
SDL.States.goToStates(nextState);
return;
}

SDL.RCModulesController.currentAudioModel.set('activeState', nextState);
if (FFW.RC.isSetVdInProgress) {
return;
}
let currentAudioModel = this.getAudioModel(nextState);
currentAudioModel.sendAudioNotification();
},

/**
* Get audio model based on state name
* @param stateName name of audio source state(e.g. 'media.player.ipod')
*/
getAudioModel : function (stateName){
switch (stateName) {
case 'media.player.radio': {
return SDL.RCModulesController.currentRadioModel;
}
case 'media.player.cd': {
return SDL.RCModulesController.currentAudioModel.cdModel;
}
case 'media.player.usb': {
return SDL.RCModulesController.currentAudioModel.usbModel;
}
case 'media.player.bluetooth': {
return SDL.RCModulesController.currentAudioModel.bluetoothModel;
}
case 'media.player.lineIn': {
return SDL.RCModulesController.currentAudioModel.lineInModel;
}
case 'media.player.ipod': {
return SDL.RCModulesController.currentAudioModel.ipodModel;
}
default: { // Default to RADIO
return SDL.RCModulesController.currentRadioModel;
}
}
},

/**
* Switches to next after radio source
* @param is source switched from background or not
*/
changeSourceFromRadio: function (is_background) {
var old_state = SDL.States.currentState.get('path');
this.deactivateRadio();
this.turnOnCD();
if (is_background) {
SDL.States.goToStates(old_state);
}
this.turnOnCD(null, is_background);
},

/**
Expand All @@ -578,10 +636,7 @@ SDL.AudioModel = Em.Object.extend({
changeSourceFromCD: function (is_background) {
var old_state = SDL.States.currentState.get('path');
this.deactivateCD();
this.turnOnUSB();
if (is_background) {
SDL.States.goToStates(old_state);
}
this.turnOnUSB(null, is_background);
},

/**
Expand All @@ -591,14 +646,7 @@ SDL.AudioModel = Em.Object.extend({
changeSourceFromUSB: function (is_background) {
var old_state = SDL.States.currentState.get('path');
this.deactivateUSB();
if (SDL.SDLMediaController.currentAppId != null && !is_background) {
SDL.SDLMediaController.activateCurrentApp();
} else {
this.turnOnRadio();
}
if (is_background) {
SDL.States.goToStates(old_state);
}
this.turnOnBluetooth(null, is_background);
},

/**
Expand All @@ -608,10 +656,7 @@ SDL.AudioModel = Em.Object.extend({
changeSourceFromBluetooth: function (is_background) {
var old_state = SDL.States.currentState.get('path');
this.deactivateBluetooth();
this.turnOnLineIn();
if (is_background) {
SDL.States.goToStates(old_state);
}
this.turnOnLineIn(null, is_background);
},

/**
Expand All @@ -621,22 +666,20 @@ SDL.AudioModel = Em.Object.extend({
changeSourceFromLineIn: function (is_background) {
var old_state = SDL.States.currentState.get('path');
this.deactivateLineIn();
this.turnOnIpod();
if (is_background) {
SDL.States.goToStates(old_state);
}
this.turnOnIPod(null, is_background);
},

/**
* Switches to next after IPod source
* @param is source switched from background or not
*/
changeSourceFromIpod: function (is_background) {
changeSourceFromIPod: function (is_background) {
var old_state = SDL.States.currentState.get('path');
this.deactivateIpod();
this.turnOnIpod();
if (is_background) {
SDL.States.goToStates(old_state);
this.deactivateIPod();
if (SDL.SDLMediaController.currentAppId != null && !is_background) {
SDL.SDLMediaController.activateCurrentApp();
} else {
this.turnOnRadio(null, is_background);
}
},

Expand All @@ -646,10 +689,7 @@ SDL.AudioModel = Em.Object.extend({
*/
changeSourceFromUnknown: function (is_background) {
var old_state = SDL.States.currentState.get('path');
this.turnOnRadio();
if (is_background) {
SDL.States.goToStates(old_state);
}
this.turnOnRadio(null, is_background);
},

/**
Expand Down
Loading

0 comments on commit 3915459

Please sign in to comment.