Hybrid Mobile Apps


You may find this repo helpful: https://github.com/amirrajan/WebApp

Specifically how you can manipulate the dom after the page loads:

  def remove_popup
    evaluate_js(<<-SCRIPT) { |r, e| puts e }
      var x = document.querySelectorAll('.DualPartInterstitial');
      var results = [ ];
      var index = 0;
      for(index = 0; index < x.length; index++) {

This is another repo to peruse: https://github.com/amirrajan/RubyMotionWebApp (shows how to spin up a simple wrapper in iOS and Android.

This (alpha alpha) repo shows how to intercept an href from the DOM and instead invoke a native method: https://github.com/amirrajan/Steward/blob/master/app/expense_screen.rb#L108

  def completedLoading url
    puts "completed: #{url}"
    intercept('input[name=commit]', 'click', :hello_world)
    # if url =~ /basecamp\.com\/sign_in/
    #   intercept('form', 'submit', :hello_world)
    # elsif url =~ /forgot_password/
    #   intercept('input[name=commit]', 'click', :hello_world)
    #   intercept('input[name=commit]', 'submit', :hello_world)
    # end