turbo-native-initializer 0.0.3 → 0.0.4
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 +7 -0
- data/README.md +3 -4
- data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NumbersFragment.kt.tt +1 -1
- data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/values/colors.xml +2 -1
- data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/values/themes.xml.tt +3 -1
- data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/native/NumbersFragment.kt.tt +1 -1
- data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/values/colors.xml +2 -1
- data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/values/themes.xml.tt +3 -1
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/TurboNavigationController.swift +10 -13
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/ViewController.swift +1 -1
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Delegates/SceneDelegate.swift.tt +0 -2
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Assets.xcassets/AccentColor.colorset/Contents.json +27 -0
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Base.lproj/Main.storyboard.tt +1 -16
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/TurboNavigationController.swift +10 -13
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/ViewController.swift +1 -1
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Delegates/SceneDelegate.swift.tt +1 -3
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Assets.xcassets/AccentColor.colorset/Contents.json +27 -0
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Base.lproj/Main.storyboard +5 -22
- 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: 9b02a10e9fb3bdea77c7546d6a5c7ae4da7753f86232af13a88b53725a47d67f
|
4
|
+
data.tar.gz: 7be945f9a4ba16207cd4f69f9b5f56067d78f1a0dfc720f45a77c18b3d420b24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7941d020b629c6ac4d2c754e666274758b972af5cb3c2481a777017f461571f6201e3fe9ba0bbe3b26bcc3baa96df7df6f9561f2a4e23327654eeb08e1a7e83a
|
7
|
+
data.tar.gz: 8a0a7ce879c65945d50209d54a19535cfcb9048ed2429f79dce9ab7a6d28acabee63dc11ce6296b095fa213f9245667e60e50d8a98690e5f54fe7e1c868108df
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.0.4] - 2023-09-09
|
4
|
+
|
5
|
+
- Added accent color (iOS)
|
6
|
+
- Added basic theme colors (Android)
|
7
|
+
- Fallback invalid "view-controller" navigations to web (iOS)
|
8
|
+
- Fix iOS modal navigation failing when not fullscreen
|
9
|
+
|
3
10
|
## [0.0.3] - 2023-09-08
|
4
11
|
|
5
12
|
- Add a Swift UI native screen
|
data/README.md
CHANGED
@@ -5,12 +5,11 @@ A turbo native project generator for iOS and Android.
|
|
5
5
|
## Differences when compared to the demos
|
6
6
|
|
7
7
|
- Added SwiftUI error screen. (iOS)
|
8
|
-
- Added SwiftUI numbers screen. (iOS)
|
9
|
-
- Added Jetpack Compose numbers screen. (Android)
|
10
|
-
- Added UIAlertController to handle `turbo-
|
8
|
+
- Added SwiftUI numbers example screen. (iOS)
|
9
|
+
- Added Jetpack Compose numbers example screen. (Android)
|
10
|
+
- Added UIAlertController to handle `data-turbo-confirm`. (iOS)
|
11
11
|
- Added presentations `clear-all`, `replace-all`, `replace`, `pop`, `refresh`, and `none`. (iOS)
|
12
12
|
- Added visitable property in order to avoid visits. (iOS)
|
13
|
-
- Added full screen option to modals. (iOS/Android)
|
14
13
|
- Added support for tab navigation. (iOS/Android)
|
15
14
|
|
16
15
|
## Installation
|
data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/values/themes.xml.tt
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
2
2
|
<style name="Theme.<%= name %>" parent="Theme.Material3.DayNight.NoActionBar">
|
3
|
-
|
3
|
+
<item name="colorPrimary">@color/color_brand</item>
|
4
|
+
<item name="colorPrimaryDark">@color/color_brand</item>
|
5
|
+
<item name="colorAccent">@color/color_brand</item>
|
4
6
|
</style>
|
5
7
|
</resources>
|
data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/values/themes.xml.tt
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
2
2
|
<style name="Theme.<%= name %>" parent="Theme.Material3.DayNight.NoActionBar">
|
3
|
-
|
3
|
+
<item name="colorPrimary">@color/color_brand</item>
|
4
|
+
<item name="colorPrimaryDark">@color/color_brand</item>
|
5
|
+
<item name="colorAccent">@color/color_brand</item>
|
4
6
|
</style>
|
5
7
|
</resources>
|
@@ -26,9 +26,9 @@ class TurboNavigationController : UINavigationController {
|
|
26
26
|
let viewController = makeViewController(for: url, properties: properties)
|
27
27
|
navigate(to: viewController, action: options.action, properties: properties)
|
28
28
|
|
29
|
-
//
|
29
|
+
// Initiate the visit with Turbo
|
30
30
|
if isVisitable(properties) {
|
31
|
-
visit(viewController: viewController, with: options)
|
31
|
+
visit(viewController: viewController, with: options, modal: isModal(properties))
|
32
32
|
}
|
33
33
|
}
|
34
34
|
}
|
@@ -77,33 +77,30 @@ extension TurboNavigationController {
|
|
77
77
|
case "numbers":
|
78
78
|
return NumbersViewController()
|
79
79
|
default:
|
80
|
-
|
80
|
+
return ViewController(url: url)
|
81
81
|
}
|
82
|
+
} else {
|
83
|
+
return ViewController(url: url)
|
82
84
|
}
|
83
|
-
|
84
|
-
return ViewController(url: url)
|
85
85
|
}
|
86
86
|
|
87
|
-
private func navigate(to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:]
|
88
|
-
let modalNavController = UINavigationController(rootViewController: viewController)
|
89
|
-
modalNavController.modalPresentationStyle = .fullScreen
|
90
|
-
|
87
|
+
private func navigate(to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:]) {
|
91
88
|
if isModal(properties) {
|
92
|
-
present(
|
93
|
-
} else if isClearAll(properties) {
|
94
|
-
popToRootViewController(animated: true)
|
89
|
+
present(UINavigationController(rootViewController: viewController), animated: true)
|
95
90
|
} else if isPop(properties) {
|
96
91
|
popViewController(animated: true)
|
97
92
|
} else if isRefresh(properties) {
|
98
93
|
session.reload()
|
99
94
|
} else if isNone(properties) {
|
100
95
|
// Will result in no navigation action being taken
|
96
|
+
} else if isClearAll(properties) {
|
97
|
+
popToRootViewController(animated: true)
|
101
98
|
} else if isReplaceAll(properties) {
|
102
99
|
setViewControllers([viewController], animated: false)
|
103
100
|
} else if isReplace(properties) || action == .replace {
|
104
101
|
setViewControllers(Array(viewControllers.dropLast()) + [viewController], animated: false)
|
105
102
|
} else {
|
106
|
-
pushViewController(viewController, animated:
|
103
|
+
pushViewController(viewController, animated: true)
|
107
104
|
}
|
108
105
|
}
|
109
106
|
|
@@ -10,7 +10,7 @@ final class ViewController: VisitableViewController, ErrorPresenter {
|
|
10
10
|
navigationItem.backButtonDisplayMode = .minimal
|
11
11
|
|
12
12
|
if presentingViewController != nil {
|
13
|
-
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .
|
13
|
+
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismissModal))
|
14
14
|
}
|
15
15
|
}
|
16
16
|
|
@@ -15,8 +15,6 @@ final class SceneDelegate: UIResponder {
|
|
15
15
|
private func configureRootViewController() {
|
16
16
|
guard let window = window else { fatalError() }
|
17
17
|
|
18
|
-
window.tintColor = UIColor(named: "Tint")
|
19
|
-
|
20
18
|
navigationController = window.rootViewController as? TurboNavigationController
|
21
19
|
navigationController.session = session
|
22
20
|
navigationController.modalSession = modalSession
|
@@ -1,6 +1,33 @@
|
|
1
1
|
{
|
2
2
|
"colors" : [
|
3
3
|
{
|
4
|
+
"color" : {
|
5
|
+
"color-space" : "display-p3",
|
6
|
+
"components" : {
|
7
|
+
"alpha" : "1.000",
|
8
|
+
"blue" : "0.898",
|
9
|
+
"green" : "0.847",
|
10
|
+
"red" : "0.361"
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"idiom" : "universal"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"appearances" : [
|
17
|
+
{
|
18
|
+
"appearance" : "luminosity",
|
19
|
+
"value" : "dark"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"color" : {
|
23
|
+
"color-space" : "display-p3",
|
24
|
+
"components" : {
|
25
|
+
"alpha" : "1.000",
|
26
|
+
"blue" : "0.898",
|
27
|
+
"green" : "0.847",
|
28
|
+
"red" : "0.361"
|
29
|
+
}
|
30
|
+
},
|
4
31
|
"idiom" : "universal"
|
5
32
|
}
|
6
33
|
],
|
@@ -3,30 +3,15 @@
|
|
3
3
|
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
4
4
|
<dependencies>
|
5
5
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
|
6
|
-
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
7
|
-
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
8
|
-
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
9
6
|
</dependencies>
|
10
7
|
<scenes>
|
11
8
|
<!--Turbo Navigation Controller-->
|
12
9
|
<scene sceneID="s0d-6b-0kx">
|
13
10
|
<objects>
|
14
|
-
<viewController id="Y6W-OH-hqX" customClass="TurboNavigationController" customModule="
|
15
|
-
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
|
16
|
-
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
17
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
18
|
-
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
|
19
|
-
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
20
|
-
</view>
|
21
|
-
</viewController>
|
11
|
+
<viewController id="Y6W-OH-hqX" customClass="TurboNavigationController" customModule="TurboNativeProjectIos" customModuleProvider="target" sceneMemberID="viewController"/>
|
22
12
|
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
23
13
|
</objects>
|
24
14
|
<point key="canvasLocation" x="130" y="-2"/>
|
25
15
|
</scene>
|
26
16
|
</scenes>
|
27
|
-
<resources>
|
28
|
-
<systemColor name="systemBackgroundColor">
|
29
|
-
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
30
|
-
</systemColor>
|
31
|
-
</resources>
|
32
17
|
</document>
|
@@ -26,9 +26,9 @@ class TurboNavigationController : UINavigationController {
|
|
26
26
|
let viewController = makeViewController(for: url, properties: properties)
|
27
27
|
navigate(to: viewController, action: options.action, properties: properties)
|
28
28
|
|
29
|
-
//
|
29
|
+
// Initiate the visit with Turbo
|
30
30
|
if isVisitable(properties) {
|
31
|
-
visit(viewController: viewController, with: options)
|
31
|
+
visit(viewController: viewController, with: options, modal: isModal(properties))
|
32
32
|
}
|
33
33
|
}
|
34
34
|
}
|
@@ -77,33 +77,30 @@ extension TurboNavigationController {
|
|
77
77
|
case "numbers":
|
78
78
|
return NumbersViewController()
|
79
79
|
default:
|
80
|
-
|
80
|
+
return ViewController(url: url)
|
81
81
|
}
|
82
|
+
} else {
|
83
|
+
return ViewController(url: url)
|
82
84
|
}
|
83
|
-
|
84
|
-
return ViewController(url: url)
|
85
85
|
}
|
86
86
|
|
87
|
-
private func navigate(to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:]
|
88
|
-
let modalNavController = UINavigationController(rootViewController: viewController)
|
89
|
-
modalNavController.modalPresentationStyle = .fullScreen
|
90
|
-
|
87
|
+
private func navigate(to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:]) {
|
91
88
|
if isModal(properties) {
|
92
|
-
present(
|
93
|
-
} else if isClearAll(properties) {
|
94
|
-
popToRootViewController(animated: true)
|
89
|
+
present(UINavigationController(rootViewController: viewController), animated: true)
|
95
90
|
} else if isPop(properties) {
|
96
91
|
popViewController(animated: true)
|
97
92
|
} else if isRefresh(properties) {
|
98
93
|
session.reload()
|
99
94
|
} else if isNone(properties) {
|
100
95
|
// Will result in no navigation action being taken
|
96
|
+
} else if isClearAll(properties) {
|
97
|
+
popToRootViewController(animated: true)
|
101
98
|
} else if isReplaceAll(properties) {
|
102
99
|
setViewControllers([viewController], animated: false)
|
103
100
|
} else if isReplace(properties) || action == .replace {
|
104
101
|
setViewControllers(Array(viewControllers.dropLast()) + [viewController], animated: false)
|
105
102
|
} else {
|
106
|
-
pushViewController(viewController, animated:
|
103
|
+
pushViewController(viewController, animated: true)
|
107
104
|
}
|
108
105
|
}
|
109
106
|
|
@@ -10,7 +10,7 @@ final class ViewController: VisitableViewController, ErrorPresenter {
|
|
10
10
|
navigationItem.backButtonDisplayMode = .minimal
|
11
11
|
|
12
12
|
if presentingViewController != nil {
|
13
|
-
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .
|
13
|
+
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismissModal))
|
14
14
|
}
|
15
15
|
}
|
16
16
|
|
@@ -31,8 +31,6 @@ final class SceneDelegate: UIResponder {
|
|
31
31
|
private func configureRootViewController() {
|
32
32
|
guard let window = window else { fatalError() }
|
33
33
|
|
34
|
-
window.tintColor = UIColor(named: "Tint")
|
35
|
-
|
36
34
|
tabBarController = window.rootViewController as? UITabBarController
|
37
35
|
|
38
36
|
navigationController1.session = session1
|
@@ -65,7 +63,7 @@ final class SceneDelegate: UIResponder {
|
|
65
63
|
|
66
64
|
private func session() -> Session {
|
67
65
|
navigationController().session
|
68
|
-
}
|
66
|
+
}
|
69
67
|
|
70
68
|
// MARK: - Path Configuration
|
71
69
|
|
@@ -1,6 +1,33 @@
|
|
1
1
|
{
|
2
2
|
"colors" : [
|
3
3
|
{
|
4
|
+
"color" : {
|
5
|
+
"color-space" : "display-p3",
|
6
|
+
"components" : {
|
7
|
+
"alpha" : "1.000",
|
8
|
+
"blue" : "0.898",
|
9
|
+
"green" : "0.847",
|
10
|
+
"red" : "0.361"
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"idiom" : "universal"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"appearances" : [
|
17
|
+
{
|
18
|
+
"appearance" : "luminosity",
|
19
|
+
"value" : "dark"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"color" : {
|
23
|
+
"color-space" : "display-p3",
|
24
|
+
"components" : {
|
25
|
+
"alpha" : "1.000",
|
26
|
+
"blue" : "0.898",
|
27
|
+
"green" : "0.847",
|
28
|
+
"red" : "0.361"
|
29
|
+
}
|
30
|
+
},
|
4
31
|
"idiom" : "universal"
|
5
32
|
}
|
6
33
|
],
|
@@ -3,37 +3,23 @@
|
|
3
3
|
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
4
4
|
<dependencies>
|
5
5
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
|
6
|
-
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
7
|
-
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
8
6
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
9
7
|
</dependencies>
|
10
8
|
<scenes>
|
11
|
-
<!--
|
9
|
+
<!--Turbo Navigation Controller-->
|
12
10
|
<scene sceneID="GwE-Ch-DRP">
|
13
11
|
<objects>
|
14
|
-
<viewController id="cXb-wA-NUs" customClass="TurboNavigationController" customModule="
|
15
|
-
<view key="view" contentMode="scaleToFill" id="WTF-II-zfk">
|
16
|
-
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
17
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
18
|
-
<viewLayoutGuide key="safeArea" id="CoL-dA-Hxa"/>
|
19
|
-
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
20
|
-
</view>
|
12
|
+
<viewController id="cXb-wA-NUs" customClass="TurboNavigationController" customModule="TurboNativeProjectIos" customModuleProvider="target" sceneMemberID="viewController">
|
21
13
|
<tabBarItem key="tabBarItem" title="" image="gear" catalog="system" id="rhZ-zi-yeq"/>
|
22
14
|
</viewController>
|
23
15
|
<placeholder placeholderIdentifier="IBFirstResponder" id="ife-PY-okT" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
24
16
|
</objects>
|
25
17
|
<point key="canvasLocation" x="1271" y="-647"/>
|
26
18
|
</scene>
|
27
|
-
<!--
|
19
|
+
<!--Turbo Navigation Controller-->
|
28
20
|
<scene sceneID="pAD-IL-Hdw">
|
29
21
|
<objects>
|
30
|
-
<viewController id="0en-nE-vJA" customClass="TurboNavigationController" customModule="
|
31
|
-
<view key="view" contentMode="scaleToFill" id="bFn-PZ-ClM">
|
32
|
-
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
33
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
34
|
-
<viewLayoutGuide key="safeArea" id="K5f-nY-Cgh"/>
|
35
|
-
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
36
|
-
</view>
|
22
|
+
<viewController id="0en-nE-vJA" customClass="TurboNavigationController" customModule="TurboNativeProjectIos" customModuleProvider="target" sceneMemberID="viewController">
|
37
23
|
<tabBarItem key="tabBarItem" title="" image="house" catalog="system" id="ZWo-HO-m4a"/>
|
38
24
|
</viewController>
|
39
25
|
<placeholder placeholderIdentifier="IBFirstResponder" id="GRr-XE-fAM" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
@@ -61,9 +47,6 @@
|
|
61
47
|
</scenes>
|
62
48
|
<resources>
|
63
49
|
<image name="gear" catalog="system" width="128" height="122"/>
|
64
|
-
<image name="house" catalog="system" width="128" height="
|
65
|
-
<systemColor name="systemBackgroundColor">
|
66
|
-
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
67
|
-
</systemColor>
|
50
|
+
<image name="house" catalog="system" width="128" height="104"/>
|
68
51
|
</resources>
|
69
52
|
</document>
|
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.4
|
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-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|