ruby_native 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3c48696ac459acce3d0885ddd2c2c5bb728715cfbed3f49bb144887801aec87
4
- data.tar.gz: 8f5d049551c7db746ad73e9481f7afe25ebf4f86ed089385212341847191068d
3
+ metadata.gz: 7394806f4e31b3409648ca6fce1b3b68a3bce434ce4d772901b44cbb38584132
4
+ data.tar.gz: db8244dc0bd95b86655480f96a03e01a5981f767b039f3b4c281c5212fef647e
5
5
  SHA512:
6
- metadata.gz: 07f9af8962e20997a29cf910f27d5fd839c58c05c0ca127cca883634c4cfe364227b39c68a99044cf42fe03b3215560a6bfd3032b8709f34c0d3d2832c28dc18
7
- data.tar.gz: 32a7d418b6499116d637f1f843018ecf4519e916acf7481103467d73d62a7cac14f5a59f130ae6f125ded2391e929a1ebf7cd745845748847a2ce6da4e19f8e9
6
+ metadata.gz: 9523b007d136ce47676c2aa1d3cfde09a483bb5bfe976b030082cb2a3c0339a114b486a5fbd28695999357f6ab1962c1de300e96fb0fc47a10a642bb193f61e6
7
+ data.tar.gz: 71eb82e9e48ca9c91c58e4a49de3cfd39af3594d4e23d6b6091da32adf163a97c30036fcb2402e4d770e2a46384c34ba0cbfe10d0e4374840e8f3dbff04a1853
@@ -0,0 +1,13 @@
1
+ import { createElement } from "react"
2
+
3
+ export function NativeTabs() {
4
+ return createElement("div", { "data-native-tabs": true, hidden: true })
5
+ }
6
+
7
+ export function NativePush() {
8
+ return createElement("div", { "data-native-push": true, hidden: true })
9
+ }
10
+
11
+ export function NativeForm() {
12
+ return createElement("div", { "data-native-form": true, hidden: true })
13
+ }
@@ -0,0 +1,22 @@
1
+ import { defineComponent, h } from "vue"
2
+
3
+ export const NativeTabs = defineComponent({
4
+ name: "NativeTabs",
5
+ render() {
6
+ return h("div", { "data-native-tabs": true, hidden: true })
7
+ }
8
+ })
9
+
10
+ export const NativePush = defineComponent({
11
+ name: "NativePush",
12
+ render() {
13
+ return h("div", { "data-native-push": true, hidden: true })
14
+ }
15
+ })
16
+
17
+ export const NativeForm = defineComponent({
18
+ name: "NativeForm",
19
+ render() {
20
+ return h("div", { "data-native-form": true, hidden: true })
21
+ }
22
+ })
@@ -0,0 +1,15 @@
1
+ module RubyNative
2
+ module InertiaSupport
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ unless respond_to?(:inertia_share)
7
+ raise "RubyNative::InertiaSupport requires the inertia_rails gem. Add it to your Gemfile."
8
+ end
9
+
10
+ inertia_share do
11
+ { native_app: native_app?, native_form: @native_form || false }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -150,6 +150,8 @@ module RubyNative
150
150
  else []
151
151
  end
152
152
 
153
+ redirect_url = "/" if auth_start_path?(redirect_url)
154
+
153
155
  Rails.logger.info { "[RubyNative] Captured #{cookies.size} cookies for token (raw type: #{raw_cookies.class})" }
154
156
 
155
157
  self.class.build_token(cookies: cookies, redirect_url: redirect_url)
@@ -160,6 +162,13 @@ module RubyNative
160
162
  [302, {"location" => "#{callback_scheme}://auth/callback?#{query}"}, [""]]
161
163
  end
162
164
 
165
+ def auth_start_path?(url)
166
+ path = URI.parse(url).path
167
+ path&.start_with?("/native/auth/start")
168
+ rescue URI::InvalidURIError
169
+ false
170
+ end
171
+
163
172
  def oauth_paths
164
173
  RubyNative.config&.dig(:auth, :oauth_paths) || []
165
174
  end
@@ -1,3 +1,3 @@
1
1
  module RubyNative
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/ruby_native.rb CHANGED
@@ -2,6 +2,7 @@ require "ruby_native/version"
2
2
  require "ruby_native/helper"
3
3
  require "ruby_native/native_version"
4
4
  require "ruby_native/native_detection"
5
+ require "ruby_native/inertia_support"
5
6
  require "ruby_native/oauth_middleware"
6
7
  require "ruby_native/engine"
7
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Masilotti
@@ -61,6 +61,8 @@ files:
61
61
  - app/javascript/ruby_native/bridge/push_controller.js
62
62
  - app/javascript/ruby_native/bridge/search_controller.js
63
63
  - app/javascript/ruby_native/bridge/tabs_controller.js
64
+ - app/javascript/ruby_native/react.js
65
+ - app/javascript/ruby_native/vue.js
64
66
  - app/views/ruby_native/auth/start/show.html.erb
65
67
  - config/importmap.rb
66
68
  - config/routes.rb
@@ -73,6 +75,7 @@ files:
73
75
  - lib/ruby_native/cli/preview.rb
74
76
  - lib/ruby_native/engine.rb
75
77
  - lib/ruby_native/helper.rb
78
+ - lib/ruby_native/inertia_support.rb
76
79
  - lib/ruby_native/native_detection.rb
77
80
  - lib/ruby_native/native_version.rb
78
81
  - lib/ruby_native/oauth_middleware.rb