turbo-native-initializer 0.0.5 → 0.0.7
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 +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +2 -2
- data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebFragment.kt.tt +3 -1
- data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/assets/json/configuration.json +2 -2
- data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebFragment.kt.tt +2 -0
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Configuration/path-configuration.json +2 -2
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/NumbersViewController.swift +3 -10
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/TurboNavigationController.swift +8 -8
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/ViewController.swift +7 -5
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/NumbersViewController.swift +3 -10
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/TurboNavigationController.swift +8 -8
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/ViewController.swift +7 -5
- data/lib/turbo_native_initializer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e673a3e9e9ff4dcab50c3e68a188dc5b71e4660065f87b6dd45006c3e99a43b1
|
4
|
+
data.tar.gz: c8a1d14e548b6a3fcea40b78329dc5a6721081b56fd45337c669b2a5611ec6e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06d7f520ae5c86136456042c46ef38b4c73961a47dee135b16c9d2232022545c8bb6b3a9fd197d98191a8d9745dcfda46d30a1eb076dc1c512f26d997fda0de
|
7
|
+
data.tar.gz: 3c63e69becdc8853f775cbd947714f0cb3822cbcbe35a7205afe7dfb00063665fb77791ad778215287aea5005b8e7308dee98f8ee83ff7ee1297cd45d2b0da4e
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.0.
|
3
|
+
## [0.0.7] - 2023-09-09
|
4
|
+
|
5
|
+
- Small refactor in the NumbersViewController (iOS)
|
6
|
+
|
7
|
+
## [0.0.6] - 2023-09-09
|
8
|
+
|
9
|
+
- Fix android template imports
|
10
|
+
|
11
|
+
## [0.0.5] - 2023-09-09
|
4
12
|
|
5
13
|
- Added android custom error screen
|
6
14
|
|
data/README.md
CHANGED
@@ -8,8 +8,8 @@ A turbo native project generator for iOS and Android.
|
|
8
8
|
- Added SwiftUI numbers example screen. (iOS)
|
9
9
|
- Added Jetpack Compose numbers example screen. (Android)
|
10
10
|
- Added UIAlertController to handle `data-turbo-confirm`. (iOS)
|
11
|
-
- Added presentations `
|
12
|
-
- Added visitable property in order to avoid visits. (iOS)
|
11
|
+
- Added presentations `pop`, `refresh`, `none`, `replace`, `clear-all`, and `replace-all`. (iOS)
|
12
|
+
- Added `visitable` property in order to avoid visits. (iOS)
|
13
13
|
- Added support for tab navigation. (iOS/Android)
|
14
14
|
|
15
15
|
## Installation
|
@@ -1,9 +1,11 @@
|
|
1
1
|
package <%= package_name %>.features.web
|
2
2
|
|
3
|
+
import android.view.View
|
3
4
|
import <%= package_name %>.base.NavDestination
|
4
5
|
import <%= package_name %>.util.SIGN_IN_URL
|
5
6
|
import dev.hotwire.turbo.fragments.TurboWebFragment
|
6
7
|
import dev.hotwire.turbo.nav.TurboNavGraphDestination
|
8
|
+
import <%= package_name %>.R
|
7
9
|
import dev.hotwire.turbo.visit.TurboVisitAction.REPLACE
|
8
10
|
import dev.hotwire.turbo.visit.TurboVisitOptions
|
9
11
|
|
@@ -18,5 +20,5 @@ open class WebFragment : TurboWebFragment(), NavDestination {
|
|
18
20
|
|
19
21
|
override fun createErrorView(statusCode: Int): View {
|
20
22
|
return layoutInflater.inflate(R.layout.error_web, null)
|
21
|
-
}
|
23
|
+
}
|
22
24
|
}
|
@@ -5,8 +5,8 @@
|
|
5
5
|
{ "patterns": ["/refresh_historical_location"], "properties": { "presentation": "refresh" } },
|
6
6
|
{ "patterns": ["/recede_historical_location"], "properties": { "presentation": "pop" } },
|
7
7
|
{ "patterns": ["/resume_historical_location"], "properties": { "presentation": "none" } },
|
8
|
-
{ "patterns": ["^/$"], "properties": { "uri": "turbo://fragment/web/home", "presentation": "replace_all" } },
|
9
|
-
{ "patterns": ["/new$", "/edit$"
|
8
|
+
{ "patterns": ["^/$", "/signin$"], "properties": { "uri": "turbo://fragment/web/home", "presentation": "replace_all" } },
|
9
|
+
{ "patterns": ["/new$", "/edit$"], "properties": { "context": "modal", "uri": "turbo://fragment/web/modal" } },
|
10
10
|
{ "patterns": ["/numbers$"], "properties": { "uri": "turbo://fragment/numbers", "title": "Numbers" } }
|
11
11
|
]
|
12
12
|
}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
package <%= package_name %>.features.web
|
2
2
|
|
3
|
+
import android.view.View
|
3
4
|
import <%= package_name %>.base.NavDestination
|
4
5
|
import dev.hotwire.turbo.fragments.TurboWebFragment
|
5
6
|
import dev.hotwire.turbo.nav.TurboNavGraphDestination
|
7
|
+
import <%= package_name %>.R
|
6
8
|
|
7
9
|
@TurboNavGraphDestination(uri = "turbo://fragment/web")
|
8
10
|
open class WebFragment : TurboWebFragment(), NavDestination {
|
@@ -4,8 +4,8 @@
|
|
4
4
|
{ "patterns": ["/refresh_historical_location"], "properties": { "presentation": "refresh", "visitable": false } },
|
5
5
|
{ "patterns": ["/recede_historical_location"], "properties": { "presentation": "pop", "visitable": false } },
|
6
6
|
{ "patterns": ["/resume_historical_location"], "properties": { "presentation": "none", "visitable": false } },
|
7
|
-
{ "patterns": ["^/$"], "properties": { "presentation": "replace-all" } },
|
8
|
-
{ "patterns": ["/new$", "/edit$"
|
7
|
+
{ "patterns": ["^/$", "/signin$"], "properties": { "presentation": "replace-all" } },
|
8
|
+
{ "patterns": ["/new$", "/edit$"], "properties": { "presentation": "modal" } },
|
9
9
|
{ "patterns": ["/numbers$"], "properties": { "view-controller": "numbers" } }
|
10
10
|
]
|
11
11
|
}
|
@@ -1,16 +1,9 @@
|
|
1
1
|
import SwiftUI
|
2
2
|
|
3
3
|
class NumbersViewController: UIHostingController<NumbersView> {
|
4
|
-
init() {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
required init(coder aDecoder: NSCoder) {
|
9
|
-
fatalError("init(coder:) has not been implemented")
|
10
|
-
}
|
11
|
-
|
12
|
-
override func viewDidLoad() {
|
13
|
-
super.viewDidLoad(); title = "Numbers"
|
4
|
+
convenience init(title: String) {
|
5
|
+
self.init(rootView: NumbersView())
|
6
|
+
self.title = title
|
14
7
|
}
|
15
8
|
}
|
16
9
|
|
@@ -38,10 +38,6 @@ extension TurboNavigationController {
|
|
38
38
|
return properties["presentation"] as? String == "modal"
|
39
39
|
}
|
40
40
|
|
41
|
-
private func isClearAll(_ properties: PathProperties) -> Bool {
|
42
|
-
return properties["presentation"] as? String == "clear-all"
|
43
|
-
}
|
44
|
-
|
45
41
|
private func isPop(_ properties: PathProperties) -> Bool {
|
46
42
|
return properties["presentation"] as? String == "pop"
|
47
43
|
}
|
@@ -54,6 +50,10 @@ extension TurboNavigationController {
|
|
54
50
|
return properties["presentation"] as? String == "none"
|
55
51
|
}
|
56
52
|
|
53
|
+
private func isClearAll(_ properties: PathProperties) -> Bool {
|
54
|
+
return properties["presentation"] as? String == "clear-all"
|
55
|
+
}
|
56
|
+
|
57
57
|
private func isReplaceAll(_ properties: PathProperties) -> Bool {
|
58
58
|
return properties["presentation"] as? String == "replace-all"
|
59
59
|
}
|
@@ -75,13 +75,13 @@ extension TurboNavigationController {
|
|
75
75
|
if let viewController = properties["view-controller"] as? String {
|
76
76
|
switch viewController {
|
77
77
|
case "numbers":
|
78
|
-
return NumbersViewController()
|
78
|
+
return NumbersViewController(title: "Numbers")
|
79
79
|
default:
|
80
|
-
|
80
|
+
assertionFailure("Invalid view controller, defaulting to WebView")
|
81
81
|
}
|
82
|
-
} else {
|
83
|
-
return ViewController(url: url)
|
84
82
|
}
|
83
|
+
|
84
|
+
return ViewController(url: url)
|
85
85
|
}
|
86
86
|
|
87
87
|
private func navigate(to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:]) {
|
@@ -5,16 +5,18 @@ final class ViewController: VisitableViewController, ErrorPresenter {
|
|
5
5
|
override func viewDidLoad() {
|
6
6
|
super.viewDidLoad()
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
navigationItem.backButtonDisplayMode = .minimal
|
8
|
+
navigationItem.backButtonTitle = "Back"
|
11
9
|
|
12
10
|
if presentingViewController != nil {
|
13
|
-
navigationItem.leftBarButtonItem =
|
11
|
+
navigationItem.leftBarButtonItem = dismissModalButton
|
14
12
|
}
|
15
13
|
}
|
16
14
|
|
17
|
-
|
15
|
+
private lazy var dismissModalButton = {
|
16
|
+
UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismissModal))
|
17
|
+
}()
|
18
|
+
|
19
|
+
@objc private func dismissModal() {
|
18
20
|
dismiss(animated: true)
|
19
21
|
}
|
20
22
|
}
|
@@ -1,16 +1,9 @@
|
|
1
1
|
import SwiftUI
|
2
2
|
|
3
3
|
class NumbersViewController: UIHostingController<NumbersView> {
|
4
|
-
init() {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
required init(coder aDecoder: NSCoder) {
|
9
|
-
fatalError("init(coder:) has not been implemented")
|
10
|
-
}
|
11
|
-
|
12
|
-
override func viewDidLoad() {
|
13
|
-
super.viewDidLoad(); title = "Numbers"
|
4
|
+
convenience init(title: String) {
|
5
|
+
self.init(rootView: NumbersView())
|
6
|
+
self.title = title
|
14
7
|
}
|
15
8
|
}
|
16
9
|
|
@@ -38,10 +38,6 @@ extension TurboNavigationController {
|
|
38
38
|
return properties["presentation"] as? String == "modal"
|
39
39
|
}
|
40
40
|
|
41
|
-
private func isClearAll(_ properties: PathProperties) -> Bool {
|
42
|
-
return properties["presentation"] as? String == "clear-all"
|
43
|
-
}
|
44
|
-
|
45
41
|
private func isPop(_ properties: PathProperties) -> Bool {
|
46
42
|
return properties["presentation"] as? String == "pop"
|
47
43
|
}
|
@@ -54,6 +50,10 @@ extension TurboNavigationController {
|
|
54
50
|
return properties["presentation"] as? String == "none"
|
55
51
|
}
|
56
52
|
|
53
|
+
private func isClearAll(_ properties: PathProperties) -> Bool {
|
54
|
+
return properties["presentation"] as? String == "clear-all"
|
55
|
+
}
|
56
|
+
|
57
57
|
private func isReplaceAll(_ properties: PathProperties) -> Bool {
|
58
58
|
return properties["presentation"] as? String == "replace-all"
|
59
59
|
}
|
@@ -75,13 +75,13 @@ extension TurboNavigationController {
|
|
75
75
|
if let viewController = properties["view-controller"] as? String {
|
76
76
|
switch viewController {
|
77
77
|
case "numbers":
|
78
|
-
return NumbersViewController()
|
78
|
+
return NumbersViewController(title: "Numbers")
|
79
79
|
default:
|
80
|
-
|
80
|
+
assertionFailure("Invalid view controller, defaulting to WebView")
|
81
81
|
}
|
82
|
-
} else {
|
83
|
-
return ViewController(url: url)
|
84
82
|
}
|
83
|
+
|
84
|
+
return ViewController(url: url)
|
85
85
|
}
|
86
86
|
|
87
87
|
private func navigate(to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:]) {
|
@@ -5,16 +5,18 @@ final class ViewController: VisitableViewController, ErrorPresenter {
|
|
5
5
|
override func viewDidLoad() {
|
6
6
|
super.viewDidLoad()
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
navigationItem.backButtonDisplayMode = .minimal
|
8
|
+
navigationItem.backButtonTitle = "Back"
|
11
9
|
|
12
10
|
if presentingViewController != nil {
|
13
|
-
navigationItem.leftBarButtonItem =
|
11
|
+
navigationItem.leftBarButtonItem = dismissModalButton
|
14
12
|
}
|
15
13
|
}
|
16
14
|
|
17
|
-
|
15
|
+
private lazy var dismissModalButton = {
|
16
|
+
UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismissModal))
|
17
|
+
}()
|
18
|
+
|
19
|
+
@objc private func dismissModal() {
|
18
20
|
dismiss(animated: true)
|
19
21
|
}
|
20
22
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-native-initializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|