<commit_before>module ProMotion
  class XLFormScreen < XlFormViewController
    include ProMotion::ScreenModule
    include ProMotion::XLFormModule

    attr_reader :form_object

    def viewDidLoad
      super
      update_form_data

      form_options = self.class.get_form_options

      if form_options[:on_cancel]
        on_cancel = form_options[:on_cancel]
        title = NSLocalizedString('Cancel', nil)
        item = :cancel
        if on_cancel.is_a? Hash
          title = on_cancel[:title] if on_cancel[:title]
          item = on_cancel[:item] if on_cancel[:item]
        end

        set_nav_bar_button :left, {
          system_item: item,
          title: title,
          action: 'on_cancel:'
        }
      end

      if form_options[:on_save]
        on_cancel = form_options[:on_save]
        title = NSLocalizedString('Save', nil)
        item = :save
        if on_cancel.is_a? Hash
          title = on_cancel[:title] if on_cancel[:title]
          item = on_cancel[:item] if on_cancel[:item]
        end

        set_nav_bar_button :right, {
          system_item: item,
          title: title,
          action: 'on_save:'
        }
      end

      # support for RMQ stylesheet using `form_view`
      # this is not optimal since set_stylesheet is called from
      # viewDidLoad on RMQ but the tableView is initialized only after that
      if self.class.rmq_style_sheet_class
        self.tableView.rmq.apply_style(:form_view) if self.rmq.stylesheet.respond_to?(:form_view)
      end

      self.form_added if self.respond_to?(:form_added)
    end

    def form_data
      PM.logger.info "You need to implement a `form_data` method in #{self.class.to_s}."
      []
    end

    def update_form_data
      form_options = self.class.get_form_options
      title = self.class.title
      required = form_options[:required]
      auto_focus = form_options[:auto_focus]

      @form_builder = PM::XLForm.new(self.form_data,<commit_msg>add test for `rmq_style_sheet_class`<commit_after>module ProMotion
  class XLFormScreen < XlFormViewController
    include ProMotion::ScreenModule
    include ProMotion::XLFormModule

    attr_reader :form_object

    def viewDidLoad
      super
      update_form_data

      form_options = self.class.get_form_options

      if form_options[:on_cancel]
        on_cancel = form_options[:on_cancel]
        title = NSLocalizedString('Cancel', nil)
        item = :cancel
        if on_cancel.is_a? Hash
          title = on_cancel[:title] if on_cancel[:title]
          item = on_cancel[:item] if on_cancel[:item]
        end

        set_nav_bar_button :left, {
          system_item: item,
          title: title,
          action: 'on_cancel:'
        }
      end

      if form_options[:on_save]
        on_cancel = form_options[:on_save]
        title = NSLocalizedString('Save', nil)
        item = :save
        if on_cancel.is_a? Hash
          title = on_cancel[:title] if on_cancel[:title]
          item = on_cancel[:item] if on_cancel[:item]
        end

        set_nav_bar_button :right, {
          system_item: item,
          title: title,
          action: 'on_save:'
        }
      end

      # support for RMQ stylesheet using `form_view`
      # this is not optimal since set_stylesheet is called from
      # viewDidLoad on RMQ but the tableView is initialized only after that
      if self.class.respond_to?(:rmq_style_sheet_class) && self.class.rmq_style_sheet_class
        self.tableView.rmq.apply_style(:form_view) if self.rmq.stylesheet.respond_to?(:form_view)
      end

      self.form_added if self.respond_to?(:form_added)
    end

    def form_data
      PM.logger.info "You need to implement a `form_data` method in #{self.class.to_s}."
      []
    end

    def update_form_data
      form_options = self.class.get_form_options
      title = self.class.title
      required = form_options[:required]
      auto_focus = form_options[:auto_focus]

      @form_builder = PM::XLForm.new(self.form_data,
{'fraction_non_alphanumeric': 0.08260325406758448, 'fraction_numerical': 0.0, 'mean_word_length': 2.462738301559792, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3297213', 'n_tokens_mistral': 1252, 'n_tokens_neox': 1209, 'n_words': 279}