Commit bbf9c58c authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Hide deprecated blocks

In earlier versions of App Inventor, the deprecated flag was stored as
the string 'true' or 'false'. More recently, we made the flag output a
Boolean rather than a string (i.e., `true` or `false`). However, the
code to handle creating the blocks for the drawer wasn't updated to
handle this scenario. Luckily, it was a sensible fallback such that
the block showed, but that means that deprecated blocks show when they
shouldn't. This change fixes this by checking for both the string
version (to support extensions that use the old format) and the
Boolean version.

Change-Id: I6ae272d8e36887ea4259a7948a56badb62f817d6
parent 82d04c8a
...@@ -259,7 +259,7 @@ Blockly.Drawer.prototype.instanceRecordToXMLArray = function(instanceRecord) { ...@@ -259,7 +259,7 @@ Blockly.Drawer.prototype.instanceRecordToXMLArray = function(instanceRecord) {
//create event blocks //create event blocks
goog.object.forEach(componentInfo.eventDictionary, function (event, name) { goog.object.forEach(componentInfo.eventDictionary, function (event, name) {
if (event.deprecated != 'true') { if (event.deprecated != 'true' && event.deprecated !== true) {
Array.prototype.push.apply(xmlArray, this.blockTypeToXMLArray('component_event', { Array.prototype.push.apply(xmlArray, this.blockTypeToXMLArray('component_event', {
'component_type': typeName, 'instance_name': instanceRecord.name, 'event_name': name 'component_type': typeName, 'instance_name': instanceRecord.name, 'event_name': name
})); }));
...@@ -268,7 +268,7 @@ Blockly.Drawer.prototype.instanceRecordToXMLArray = function(instanceRecord) { ...@@ -268,7 +268,7 @@ Blockly.Drawer.prototype.instanceRecordToXMLArray = function(instanceRecord) {
//create non-generic method blocks //create non-generic method blocks
goog.object.forEach(componentInfo.methodDictionary, function (method, name) { goog.object.forEach(componentInfo.methodDictionary, function (method, name) {
if (method.deprecated != 'true') { if (method.deprecated != 'true' && method.deprecated !== true) {
Array.prototype.push.apply(xmlArray, this.blockTypeToXMLArray('component_method', { Array.prototype.push.apply(xmlArray, this.blockTypeToXMLArray('component_method', {
'component_type': typeName, 'instance_name': instanceRecord.name, 'method_name': name 'component_type': typeName, 'instance_name': instanceRecord.name, 'method_name': name
})); }));
...@@ -277,7 +277,7 @@ Blockly.Drawer.prototype.instanceRecordToXMLArray = function(instanceRecord) { ...@@ -277,7 +277,7 @@ Blockly.Drawer.prototype.instanceRecordToXMLArray = function(instanceRecord) {
//for each property //for each property
goog.object.forEach(componentInfo.properties, function (property, name) { goog.object.forEach(componentInfo.properties, function (property, name) {
if (property.deprecated != 'true') { if (property.deprecated != 'true' && property.deprecated !== true) {
var params = { var params = {
'component_type': typeName, 'instance_name': instanceRecord.name, 'component_type': typeName, 'instance_name': instanceRecord.name,
'property_name': name 'property_name': name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment