1. 24 May, 2017 1 commit
    • Evan W. Patton's avatar
      Miscellaneous bugfixes for the Blockly update · f970ac35
      Evan W. Patton authored
      This is a squashed commit containing bugfixes for the Blockly
      update. The individual commit bodies are below as a summary:
      
      1. After using the Paste All Blocks from Backpack menu item, undoing
      this operation requires N Undo commands whereas it should only require
      1 Undo. This commit wraps the bulk of the pasteBackpack operation in a
      try-finally to set/unset the Blockly event group so that all of the
      create block events are grouped together.
      
      2. Prevent CSS updates during paste all from backpack
      
      3. Ghica reported that when the backpack is open it is possible to
      scroll both the flyout's and workspace's scrollbars and there is no
      visual indicator which is which. This means that sometimes the user
      will scroll the workspace when intending to scroll the flyout. This
      commit makes flyouts hide their parent workspace's scrollbars and show
      them after the flyout is dismissed.
      
      4. Improve rendering of flyouts with many blocks
      
      5. Hide backpack with ESC key
      
      6. Only fire parameter orientation event after orientation change
      
      7. The implementation of Blockly.Events.filer on Google's master is
      implemented using a O(n^2) algorithm. When performing operations that
      affect a large number of blocks, e.g. arrangements or pasting from the
      Backpack, this performance is unacceptable. This commit provides a new
      implementation of Blockly.Events.filter that is linear in the number
      of pending events.
      
      8. Removing mutators for parameters or deleting the procedure block
      and then attempting to undo the operation would leave the caller
      blocks in an inconsistent state with missing parameters or not
      reconnecting the previously attached input blocks. This commit fixes
      these issues by changing the order of certain operations so that when
      Blockly reverses the order of operations variables, such as the caller
      block's PROCNAME, are set correctly.
      
      9. The way that Blockly handles changes to fields breaks how we
      renamed parameters in the mutator. This commit provides a custom
      handler for key events that makes the renaming behavior match that
      before the Blockly update.
      
      10. Cherry-picked code for mutators that fixed the ordering of the
      mutator workspace's toolbox with respect to the block canvas.
      
      11. Fixed delete area not appearing for the mutator workspace.
      
      12. Fixed ghost scrollbars from different flyouts capturing the mouse
      over event for blocks in the drawer flyout.
      
      13. Made it so that dragging a block in any direction from a flyout
      will result in a new block being created. Previously the window was
      ±70 degrees from the horizontal axis.
      
      14. Improved performance on large projects during load or after moving
      a stack of blocks.
      
      15. Fixed error checking on blocks created by typeblock and their
      relatives.
      
      16. Fixed null pointer exception when renaming a component prior to
      opening the blocks editor.
      
      17. Moved updates to the scrollbar visibility to setScrollbarsVisible
      and made all changes to scrollbar visibility go through that method,
      which includes fix 16 above.
      
      18. Made arrangement options adjust to workspace scale and
      snap-to-grid options.
      
      19. Fixed issue where changing text fields would not result in a
      Change event and therefore fail to trigger a workspace save.
      
      20. Added fix to ensure the warning handler exists before attempting
      to do error checks on variables.
      
      21. Patched Blockly code to prevent the connection database from
      throwing an error when an operation would essentially be an identity
      operation on the database.
      
      Change-Id: I0d713e3c92586c0506bfe24d138c634c29d6a208
      f970ac35
  2. 14 May, 2017 2 commits
    • Evan W. Patton's avatar
      Fix buildserver paths on Windows · f1510156
      Evan W. Patton authored
      The buildserver should return an error if Kawa cannot compile the YAIL
      file. However, on Windows we end up always pointing at the classes
      directory, which always exists, and therefore we continue compiling an
      app even though the class files are missing. On Mac/Linux the same
      project results in a Kawa compilation error. The logic error is
      introduced by the hard coding of the path "/../src/" in
      Compiler.java. On Windows the path uses the conventional Windows
      separator "\\", so the substring of interest is "\\..\\src\\". This
      commit adjusts the lookup string to use File.separator so that the
      lookup path will be correct regardless of platform.
      
      Change-Id: Id066cad6710e7fe8c6710b40465c87992f547854
      f1510156
    • Evan W. Patton's avatar
      Fix ComponentTranslation encoding on non-UTF-8-by-default platforms · 3385ac09
      Evan W. Patton authored
      Javac default output format for files is platform-specific. In the
      ai.apt macro we do not specify the encoding, so we end up with
      ISO-8859-1 strings on Windows that GWT later attempts to decode as
      UTF-8 strings. This commit sets the encoding for the javac command to
      be UTF-8 so that encodings work correctly on platforms (e.g., Windows)
      where the default encoding is not UTF-8.
      
      Change-Id: Iac68786e71983e8605e982a093d3daae09d49c01
      3385ac09
  3. 02 May, 2017 5 commits
    • Evan W. Patton's avatar
      Add custom help URLs for extensions · 910fb80b
      Evan W. Patton authored
      Extensions loaded into App Inventor have "More Information" URLs based
      on the server's documentation. Obviously, we won't have documentation
      for every single extension, nor do we want to update the GAE
      application every time someone publishes or updates an extension. This
      commit adds a new helpUrl field to the `@DesignerComponent` annotation
      that can be used to specify a custom URL for extension documentation.
      
      Closes issue #883.
      
      Change-Id: I7fdc20bb1d5e9cb1bfa257f1ed194748bd5e35ec
      910fb80b
    • Evan W. Patton's avatar
      Add support for multiple extensions per AIX · 6c36d5aa
      Evan W. Patton authored
      For the Internet of Things update, we want to be able to have
      collections of related extensions, for example, targetting different
      features of the same platform, to be imported as a single unit. This
      behavior reflects how we group components such as the LEGO EV3 or NXT
      robots and allows us to treat extensions in the same way.
      
      Change-Id: I83e1069421939e57b33689f7ae0a3d5928c6c6cd
      6c36d5aa
    • Evan W. Patton's avatar
      Allow component properties to specify accepted type · dea242fe
      Evan W. Patton authored
      For the Internet of Things update, we want to allow extensions to
      specify restrictions on designer properties. Specifically, we want IOT
      extensions with a BluetoothDevice property to be able to restrict the
      component list to the BluetoothLE extension. This commit extends the
      behavior of the component property type by allowing an extension
      author to include a colon (":") followed by the fully-qualified class
      name of the component type to accept.
      
      Change-Id: I6c38890fde99fe947bb1a305412d662694246463
      dea242fe
    • Evan W. Patton's avatar
      Update Guava to 20 to be compatible with GWT 2.8 · c57f6917
      Evan W. Patton authored
      Change-Id: Ieb6fe17306d262ff92c08e28f227767add7005b6
      c57f6917
    • Evan W. Patton's avatar
      Update appengine build to use JDK 1.7 · 7633d9e2
      Evan W. Patton authored
      Change-Id: I27191377afac5a2d01db9092934e2c4b25e639ce
      7633d9e2
  4. 29 Apr, 2017 3 commits
    • Evan W. Patton's avatar
      Fix arrangement/sort options in Blockly context menu · 409fc9cc
      Evan W. Patton authored
      The context menu items for arranging blocks and sorting by category
      did not have expected behavior due to the new Blockly events
      system. This commit introduces two new events StartArrangeBlocks and
      EndArrangeBlocks that will manipulate the appropriate flags so the
      context menu options work correctly. We also group the arrangement
      events in a single group. This makes the undo/redo menu options behave
      correctly rather than undoing/redoing individual moves within the
      larger arrangement action.
      
      Change-Id: Icb832eef1f91aec5a12025707e9c39b3257987af
      409fc9cc
    • Evan W. Patton's avatar
      Add DomHelper for goog.ui.Dialog · 28f2899c
      Evan W. Patton authored
      Because Blockly is linked into the GWT JavaScript, goog.ui.Dialog
      attempts to show itself on the GWT iframe's document rather than on
      the top window where the UI is actually displayed. This commit adds a
      goog.ui.DomHelper so that the Dialog attachs its DOM elements to the
      correct document.
      
      NB: This has the side-effect that the runtime error dialog from the
      companion is now UI global (it will show even if in the designer).
      
      Change-Id: I3f7fb60d8898e37a689cbc3f406ef39832717d99
      28f2899c
    • Evan W. Patton's avatar
      Fix variable reference renaming · 52acc3f2
      Evan W. Patton authored
      When renaming variables, references to those variables are not
      correctly renamed. This is due to a change in the order in which
      Blockly manipulates the field's value and calls the validator. Since
      the update occurs before validation, we don't know the original name
      and therefore cannot find and update all of the references. This
      commit provides the flydown with its own implementation of
      onHtmlInputChanged_ so that it can provide a behavior that is
      compatible with our renaming mechanism, mainly that it will validate
      first and only if successful will it update the field's value.
      
      Change-Id: I7569d0f0b1b6f57e476df5e32f1b2a12e7d7533c
      52acc3f2
  5. 27 Apr, 2017 1 commit
    • Evan W. Patton's avatar
      Fix vertical parameter orientation on procedure blocks · 145e718b
      Evan W. Patton authored
      Procedure definitions have the option for horizontal/vertical
      orientation of parameters. However, switching resulted in the inputs
      disappearing from the block. This was caused by the new fields not
      being initialized correctly such that when the block attempted to
      redraw, expected SVG elements were undefined.
      
      This commit fixes the updateParams_ method for procedure blocks so
      that they will correctly handle switching between the two cases.
      
      Change-Id: Ib9a161548954a2990a0351ad07a808c35d2bc928
      145e718b
  6. 26 Apr, 2017 2 commits
    • Evan W. Patton's avatar
      Fix pasting of procedures_defreturn blocks from Backpack · a5fa4f6f
      Evan W. Patton authored
      Creating new procedures that return values in the blocks editor could
      result in multiple procedures having the same name. This commit
      updates the procedures_defreturn initialization to match that of
      procedures_defnoreturn so that renaming is correctly applied.
      
      Change-Id: Ifc30ee27d538b46a61a17d0d4677dad31c4d7d4d
      a5fa4f6f
    • Evan W. Patton's avatar
      Fix backpack behavior in Blockly update · 07848d7e
      Evan W. Patton authored
      Backpack menu items in the workspace, i.e. Copy All to Backpack and
      Paste All From Backpack were broken during the transition to the
      latest Blockly. This commit changes any checks for the backpack
      presence to use the hasBackpack() test added to WorkspaceSvg.
      
      Change-Id: Iae7919d173f5a5f75003c0132d1f116af9839bd0
      07848d7e
  7. 25 Apr, 2017 5 commits
    • Evan W. Patton's avatar
      Fix help string translation in palette items · 0e9f7067
      Evan W. Patton authored
      Change-Id: I467a9c61a243dc38cd9b311016cf12893b300b66
      0e9f7067
    • Evan W. Patton's avatar
      Fix logic for vertical event parameters · 2a681986
      Evan W. Patton authored
      This commit restores the ability to change the orientation of the
      parameters in an event handler block. The functionality is updated to
      reflect the new events mechanism in Blockly.
      
      Change-Id: Ib6d9c27b6e13838af886c0abf281e24ba57e6bbe
      2a681986
    • Evan W. Patton's avatar
      Fix Chrome focus jumping in SourceStructureExplorer · 8bc52d45
      Evan W. Patton authored
      A change in Chrome results in different behavior when focusing an
      invisible element. When the list is longer than the panel, this
      results in the panel scrolling-to-top. The fix applied is adapted from
      [this issue](https://github.com/gwtproject/gwt/issues/9475#issuecomment-277777989)
      on the GWT Github repository.
      
      Change-Id: I8634a95077ee166f34aa265e81a7f272cbd620de
      8bc52d45
    • Evan W. Patton's avatar
      Fix #708 event parameter translation · 8b2a23f7
      Evan W. Patton authored
      When switching between languages, or loading an AIA created in one
      language but the user's language is different, the translation of
      event parameters would not always hold. This is due to the use of
      `eventparam` as a mutation on the lexical getter and setter
      blocks. Through certain actions, the `eventparam` cached value could
      be reset to an incorrect state.
      
      This commit does two things to address this issue: (1) adds an
      `updateMutation()` method that can be used to recompute the value of
      `eventparam` after a blocks update, including changing the dropdown or
      attaching a new parent. This keeps the `eventparam` up-to-date during
      normal operation (previously it was only computed on save). (2)
      FieldParameterFlydown caches the untranslated `eventparam` value for
      instantiating new blocks within the workspace. Previously they were
      created with the value `null`, which has special meaning as a cached
      'not an event' value. Now they are created with the correct mutation
      at the beginning and with (1) should maintain the correct value.
      
      Change-Id: I758b8d414d7ddf98f7375ee961187b06b47939cf
      8b2a23f7
    • Evan W. Patton's avatar
      Update AI2 to use latest Blockly · 1a91e92a
      Evan W. Patton authored
      This commit brings the App Inventor blocks editor current to the
      Google's Blockly. As part of the update, some additional
      organizational changes were made to the code:
      
      1. Remove old blockly in lib/ and replaces it with a git submodule
      2. Remove old closure-library in lib/ and replaces it with a git
         submodule
      3. Move AI2-specific Blockly changes out of core where possible
      
      Change-Id: I58993db05631266d95fbbcc68d49aad1e562fc22
      1a91e92a
  8. 30 Mar, 2017 1 commit
  9. 14 Mar, 2017 1 commit
  10. 09 Mar, 2017 1 commit
    • Paul Medlock-Walton's avatar
      allow https template urls · 75dd8e6f
      Paul Medlock-Walton authored
      maintain backward compatibility for current urls that expect http:// by default
      
      Change-Id: I9c62004bf6b38e06094ebad30f3cd9b789de6510
      75dd8e6f
  11. 05 Mar, 2017 3 commits
  12. 28 Feb, 2017 1 commit
    • conorshipp's avatar
      Update Backpack documentation · 0b500e91
      conorshipp authored
      After the recent App Inventor 2 update, the backpack is now persistent,
      which means that when right-clicking on the backpack icon on the block
      editor and clicking "Show Backpack documentation", some of the text in
      the dialog is incorrect. I have corrected the text to show that of the
      release notes.
      
      Change-Id: I223be859193a2b02be8bcf673bdebd6f7116444d
      0b500e91
  13. 23 Feb, 2017 1 commit
    • Evan W. Patton's avatar
      Make SmsBroadcastReceiver more robust · b2794460
      Evan W. Patton authored
      Josh ran into a NullPointerException when receiving a SMS message
      using a Pixel running Google Fi. There are a few possible reasons this
      could happen:
      
      1. We linked against android.telephony.gms.SmsMessage. If the message
         was formatted as CDMA (3gpp2) then it is possible that the message
         returned is null, resulting in the NPE.
      
      2. Any format other than 3gpp or 3gpp2 will result in the same flow as
         1 if a new format is introduced in the future, or if the format
         were something such as a data packet from Google Voice.
      
      In API 19, there was a new
      android.provider.Telephony.Sms.Intents#getMessagesFromIntent
      introduced to abstract away extracting SmsMessages from Intents. This
      commit uses this API when the SDK is 19 or higher. We also catch NPE
      in the broadcast receiver and log it to Logcat to prevent crashing.
      
      Change-Id: I9f00d6156f004d3d72938de1e57b31cfb034d241
      b2794460
  14. 14 Feb, 2017 2 commits
    • Jeffrey I. Schiller's avatar
      Make the backpack persistent · 3548e1dc
      Jeffrey I. Schiller authored
      We store the backpack in a new “user file” named backpack.xml (the other
      user file supported is “android.keystore” for the user’s signing
      key). As an optimization we remove the backpack.xml file if we store
      “[]” in it (the empty backpack represented as an empty JSON string).
      
      Change-Id: I16fb747f31e59d30535f690c1b35c80bde53629f
      3548e1dc
    • Evan W. Patton's avatar
      Fix NullPointerException in gnu.text.CharMap · f28861e2
      Evan W. Patton authored
      When an obfuscated text is used in an application with memory
      pressure, the iteration over the obfuscated string can cause a
      NullPointerException to be thrown from gnu.text.CharMap. The CharMap
      uses weak references to Char objects to make Chars eq?. However, Kawa
      does not check whether the Char returned from the WeakReference.get()
      method is null and then attempts to take its intValue(). In
      applications where there is little memory pressure the WeakReferences
      are unlikely to be GCed so we don't normally observe this erroroneous
      behavior.
      
      This commit updates kawa-1.11-modified.jar with a check whether the
      Char returned by the WeakReference is null prior to taking the
      intValue(). If the Char is null, it will fall through to recreate the
      Char and add it to the CharMap.
      
      Change-Id: Idb19540b6096a9609a8aa06e77d628cd3ce1dc6b
      f28861e2
  15. 10 Feb, 2017 1 commit
    • Jeffrey I. Schiller's avatar
      Throttle Calls to MockForm.refresh() · e5b0d1eb
      Jeffrey I. Schiller authored
      Limit the number of calls to MockForm.refresh(). This lets a project
      with a lot of designer objects load when otherwise the exponential time
      and space consumption of repeated and nested calls to refresh() would
      cause it to fail to load.
      
      This implementation throttles the calls “locally.” The idea is to limit
      the number of calls to 1 every 2 seconds. An alternative implementation
      would be to set a flag while a project is loading (which is when this is
      a problem) and inhibit all calls to refresh while this flag is set. Then
      when the project is no longer loading, clear the flag and do one final
      call to refresh. However this would be tricky because loading is
      asynchronous and knowing when it is completely finished is
      complicated. Such an implementation would be spread over several
      modules, and add complexity to the codebase. This change is simpler
      because it is limited to one module.
      
      We also add a logging call Ode.CLog to Ode that logs to the developer
      console instead of the OdeLog module which logs to the special debug
      tab. There are situations where logging to the console is desirable,
      like when the problem you are attempting to debug leaves App Inventor
      locked up so you cannot see the debug tab!
      
      Change-Id: I5fb9c832704e87c6e73903dc3a75ceb79df5f7f3
      e5b0d1eb
  16. 06 Feb, 2017 1 commit
    • Evan W. Patton's avatar
      Fix image loading in getBitmapDrawableAsync · c99fefb8
      Evan W. Patton authored
      On phones with smaller memory footprints, the use of InputStream.mark
      was causing an IOException to be thrown that resulted in images not
      loading. This patch loads the entirety of the image into a byte[] and
      then uses that in conjunction with a ByteArrayInputStream to pass the
      image around to the multiple interfaces that need it without reloading
      the content. This fixes the failure to load many images in the
      emulator.
      
      Change-Id: If7185e8e1a02e19a46037a4dd4df545241fa7f2b
      c99fefb8
  17. 05 Feb, 2017 1 commit
    • Jeffrey I. Schiller's avatar
      Use a transaction in createProject in production · 08ad4ee1
      Jeffrey I. Schiller authored
      Do not use a transaction when running in the dev server as this causes a
      multi-entity group error. This happens because the dev server simulates
      the Google Cloud Store using the datastore. If we use a transaction in
      create project it winds up covering multiple entity groups. One for our
      modifications to the “FileData” kind and a second for the simulated GCS
      bucket kind.
      
      Change-Id: I4a31eb16c7866e4ed721c02dbc77addea8df3dbf
      08ad4ee1
  18. 30 Jan, 2017 1 commit
    • Jeffrey I. Schiller's avatar
      Permit newer version projects to run · 11bdf459
      Jeffrey I. Schiller authored
      Remove the check in versioning.js that throws an exception if a
      component version is newer then the system version. This exception
      guaranteed that a project touched by a newer version of App Inventor
      would not work in the current version.
      
      With this change the project may work if the newer version made not
      incompatible changes. The user is shown a warning dialog stating that
      the project might not work.
      
      Change-Id: I72c15383b20d918ffd0077d6f7a10f8d1dd4b345
      11bdf459
  19. 27 Jan, 2017 2 commits
  20. 23 Jan, 2017 1 commit
    • Jeffrey I. Schiller's avatar
      Add a Generic MessageDialog system. · 486ac4ba
      Jeffrey I. Schiller authored
      Refactoring to reduce the number of unique dialog boxes instantiated by
      Ode. We add this generic MessageDialog method and use it for the
      Firebase experimental warning, eliminating the ode.warningDialog
      method. Future refactoring can remove more unique dialogs.
      
      Change-Id: I77e1df2a359424aac38c6e8ae8b04fec292cbe99
      486ac4ba
  21. 18 Jan, 2017 1 commit
    • Jeffrey I. Schiller's avatar
      Use the synchronous version of getBitmapDrawable · c7a02e77
      Jeffrey I. Schiller authored
      This reverts most of commit b5e78d70.
      We keep the changes to MediaUtil.getBitmapDrawable. So the actual image
      fetching happens on a non-UI thread, but the UI Thread blocks until the
      network I/O is done. This is non-ideal, as blocking on the UI thread can
      result in an Application Not Responding (ANR) error. However this might
      be more desirable then having the application apparently not load a
      background image for a long time, and then having it suddenly appear
      when the background network loading is finally finished.
      
      Change-Id: I3424918a83284d19ee6ccfc9deb8824f5c0605a2
      c7a02e77
  22. 12 Jan, 2017 1 commit
    • Evan W. Patton's avatar
      Make MediaUtil.getBitmapDrawable asynchronous · b5e78d70
      Evan W. Patton authored
      When the minSdkVersion is >= 10 and the user attempts to set an image
      to a non-file URL, the Android runtime will throw an
      android.os.NetworkOnMainThreadException. This commit changes the
      behavior of MediaUtil.getBitmapDrawable to an asynchronous design that
      takes a callback that will be triggered after the bitmap has been
      loaded. If an exception occurs, an onException callback will be
      used. Other failures are reported via the onFailure callback. Due to
      the change to AsyncCallbackPair, this change also affects a number of
      other components that may or may not have been performing network
      access on the main thread.
      
      Testing of this change should focus on the following components:
       * ButtonBase and its descendants
       * Canvas
       * Form
       * GameClient
       * HVArrangement and its descendants
       * Image
       * ImageSprite
       * MediaStore
       * TinyWebDB
       * Voting
      
      Change-Id: Ib9bd0a0a929b26ad44eeda58a7c637398dd70219
      b5e78d70
  23. 31 Dec, 2016 1 commit
    • Evan W. Patton's avatar
      Fix SoundRecorder crashing on Start method call · 8cbe40cf
      Evan W. Patton authored
      Reported by the forum posting [1], the SoundRecorder crashes when the
      Start method is called. After some debugging, this is due to
      unexpected values being reported via the onInfo method being called
      with an unexpected, non-documented value of `what`. The code always
      called controller.recorder.stop(), but since the MediaRecorder hadn't
      transitioned to the recording state yet, stop() throws an uncaught
      IllegalStateException, which kills the program.
      
      This commit makes the onInfo method more robust by reporting known
      `what` values via dispatchErrorOccurredEvent and ignoring any values
      not declared by AOSP. It also adds a call to StoppedRecording()
      otherwise the app may not have been aware of the failure state.
      
      [1] https://groups.google.com/d/msg/mitappinventortest/qMPzn5s82UY/LJu8znfrAwAJ
      
      Change-Id: Ifd12fcf016df07b500b958bd4900781bf6ff6c47
      8cbe40cf
  24. 12 Dec, 2016 1 commit
    • hal's avatar
      Add the “ShowListsAsJson” Property · 160f16c0
      hal authored
      When set this property causes lists to be displayed in JSON notation
      rather then Lisp notation. Its default value is “false” so current
      projects continue to work and new projects will still use Lisp
      format. This can be changed in the future once the Companion that
      supports ShowListsAsJson is widely deployed.
      
      Change-Id: I2e6b25c32d27377685eb8111f44536479e7c55b7
      160f16c0