<commit_before>`import Ember from 'ember'`
`import ENUMS from 'irene/enums';`
`import ENV from 'irene/config/environment';`
`import { translationMacro as t } from 'ember-i18n'`

vncHeight = 512
vncWidth = 385

VncViewerComponent = Ember.Component.extend
  i18n: Ember.inject.service()
  onboard: Ember.inject.service()

  rfb: null
  file: null
  isPoppedOut: false
  classNameBindings: ["isPoppedOut:modal", "isPoppedOut:is-active"]

  vncPopText: (->
    if @get "isPoppedOut"
      "Close Modal"
    else
      "Pop Out Modal"
  ).property "isPoppedOut"

  setupRFB: ->
    rfb = @get "rfb"
    if !Ember.isEmpty rfb
      return
    canvasEl = @element.getElementsByClassName("canvas")[0]
    that = @
    @set "rfb", new RFB
      'target': canvasEl
      'encrypt': ENV.deviceFarmSsl
      'repeaterID': ''
      'true_color': true
      'local_cursor': false
      'shared': true
      'view_only': false

      'onUpdateState': ->
        if ENUMS.PLATFORM.IOS isnt that.get "file.project.platform"
          # Only resize iOS Devices
          return true
        display = @get_display()
        scaleRatio = display.autoscale vncHeight, vncWidth  # TODO: This needs to be set Dynamically
        @get_mouse().set_scale scaleRatio
        true

      'onXvpInit': ->
        true

    if @get 'file.isReady'
      @send("connect")


  didInsertElement: ->
    @setupRFB()

  statusChange: ( ->
    if @get 'file.isReady'
      @send("connect")
    else
      @send "disconnect"
  ).observes 'file.dynamicStatus'

  isAndroidDevice: (->
    platform = @get "file.project.platform"
    if platform is ENUMS.PLATFORM.ANDROID
      true
  ).property "file.project.platform"

  isIOSDevice: (->
    platform = @get "file.project.platform"
    if platform is ENUMS.PLATFORM.IOS
      true
  ).property "file.project.platform"

  isNeitherAndroidNorIOS: (->
    platform = @get "file.project.platform"
    if platform not in [ENUMS.PLATFORM.ANDROID, ENUMS.PLATFORM.IOS]<commit_msg>refactor: also test using `didUpdate`<commit_after>`import Ember from 'ember'`
`import ENUMS from 'irene/enums';`
`import ENV from 'irene/config/environment';`
`import { translationMacro as t } from 'ember-i18n'`

vncHeight = 512
vncWidth = 385

VncViewerComponent = Ember.Component.extend
  i18n: Ember.inject.service()
  onboard: Ember.inject.service()

  rfb: null
  file: null
  isPoppedOut: false
  classNameBindings: ["isPoppedOut:modal", "isPoppedOut:is-active"]

  vncPopText: (->
    if @get "isPoppedOut"
      "Close Modal"
    else
      "Pop Out Modal"
  ).property "isPoppedOut"

  setupRFB: ->
    rfb = @get "rfb"
    if !Ember.isEmpty rfb
      return
    canvasEl = @element.getElementsByClassName("canvas")[0]
    that = @
    @set "rfb", new RFB
      'target': canvasEl
      'encrypt': ENV.deviceFarmSsl
      'repeaterID': ''
      'true_color': true
      'local_cursor': false
      'shared': true
      'view_only': false

      'onUpdateState': ->
        if ENUMS.PLATFORM.IOS isnt that.get "file.project.platform"
          # Only resize iOS Devices
          return true
        display = @get_display()
        scaleRatio = display.autoscale vncHeight, vncWidth  # TODO: This needs to be set Dynamically
        @get_mouse().set_scale scaleRatio
        true

      'onXvpInit': ->
        true

    if @get 'file.isReady'
      @send("connect")

  didUpdate: ->
    @setupRFB()

  didInsertElement: ->
    @setupRFB()

  statusChange: ( ->
    if @get 'file.isReady'
      @send("connect")
    else
      @send "disconnect"
  ).observes 'file.dynamicStatus'

  isAndroidDevice: (->
    platform = @get "file.project.platform"
    if platform is ENUMS.PLATFORM.ANDROID
      true
  ).property "file.project.platform"

  isIOSDevice: (->
    platform = @get "file.project.platform"
    if platform is ENUMS.PLATFORM.IOS
      true
  ).property "file.project.platform"

  isNeitherAndroidNorIOS: (->
    platform = @get "file.project.platform"
    if platform not in [ENUMS.PLATFORM.ANDROID, ENUMS.PLATFORM.IOS]
{'fraction_non_alphanumeric': 0.12102385685884692, 'fraction_numerical': 0.0054671968190854875, 'mean_word_length': 2.7935909519321394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '341263', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1373, 'n_words': 315}