turbo-native-initializer 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/error_web.xml +4 -13
- data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/error_web.xml +4 -13
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/ErrorPresenter.swift +0 -4
- 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 +5 -5
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Delegates/SceneDelegate.swift.tt +2 -4
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/ErrorPresenter.swift +0 -4
- 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 +5 -5
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Delegates/SceneDelegate.swift.tt +2 -4
- data/lib/turbo_native_initializer/version.rb +1 -1
- metadata +2 -4
- data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/drawable/ic_warning.xml +0 -7
- data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_warning.xml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 518999c4b582f3e174bc3b7f631e3bd51e148349a92693af74a2a9e87dc4851b
|
4
|
+
data.tar.gz: a9ee896086b2836902c30a725c278c995057db62c96fb232f013e9a978413f5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbedfe1b08f53271dd0c5f803654f609320d887f5935a3ab788c4137c738f50f9ac48396fade5be9fbd440e0fc22da62da170bced13e193790c7f5fd3ca1e84f
|
7
|
+
data.tar.gz: f564171bcc1ca3776e64e752dedf629ddca463a937288eb114beb4331399c54b3f74b1cd02924c89c8eef01780cc0ae1e7cb4f9c40b02d5b8f9ad0dc1735aa7b
|
data/CHANGELOG.md
CHANGED
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
|
data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/error_web.xml
CHANGED
@@ -6,28 +6,19 @@
|
|
6
6
|
android:layout_height="match_parent"
|
7
7
|
android:background="?android:colorBackground">
|
8
8
|
|
9
|
-
<ImageView
|
10
|
-
android:id="@+id/imageView"
|
11
|
-
android:layout_width="match_parent"
|
12
|
-
android:layout_height="50dp"
|
13
|
-
android:layout_marginBottom="10dp"
|
14
|
-
app:layout_constraintBottom_toTopOf="@+id/error_message"
|
15
|
-
app:srcCompat="@drawable/ic_warning" />
|
16
|
-
|
17
9
|
<com.google.android.material.textview.MaterialTextView
|
18
10
|
android:id="@+id/error_message"
|
19
|
-
style="?
|
11
|
+
style="?textAppearanceHeadline6"
|
20
12
|
android:layout_width="match_parent"
|
21
13
|
android:layout_height="wrap_content"
|
22
14
|
android:gravity="center_horizontal"
|
23
15
|
android:text="Error loading page"
|
24
16
|
app:layout_constraintBottom_toBottomOf="parent"
|
25
17
|
app:layout_constraintTop_toTopOf="parent"
|
26
|
-
app:layout_constraintVertical_bias=".
|
27
|
-
tools:layout_editor_absoluteX="24dp" />
|
18
|
+
app:layout_constraintVertical_bias=".40" />
|
28
19
|
|
29
20
|
<com.google.android.material.textview.MaterialTextView
|
30
|
-
style="?
|
21
|
+
style="?textAppearanceCaption"
|
31
22
|
android:layout_width="match_parent"
|
32
23
|
android:layout_height="wrap_content"
|
33
24
|
android:layout_marginTop="10dp"
|
@@ -36,4 +27,4 @@
|
|
36
27
|
app:layout_constraintTop_toBottomOf="@id/error_message"
|
37
28
|
tools:layout_editor_absoluteX="24dp" />
|
38
29
|
|
39
|
-
</androidx.constraintlayout.widget.ConstraintLayout>
|
30
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/error_web.xml
CHANGED
@@ -6,28 +6,19 @@
|
|
6
6
|
android:layout_height="match_parent"
|
7
7
|
android:background="?android:colorBackground">
|
8
8
|
|
9
|
-
<ImageView
|
10
|
-
android:id="@+id/imageView"
|
11
|
-
android:layout_width="match_parent"
|
12
|
-
android:layout_height="50dp"
|
13
|
-
android:layout_marginBottom="10dp"
|
14
|
-
app:layout_constraintBottom_toTopOf="@+id/error_message"
|
15
|
-
app:srcCompat="@drawable/ic_warning" />
|
16
|
-
|
17
9
|
<com.google.android.material.textview.MaterialTextView
|
18
10
|
android:id="@+id/error_message"
|
19
|
-
style="?
|
11
|
+
style="?textAppearanceHeadline6"
|
20
12
|
android:layout_width="match_parent"
|
21
13
|
android:layout_height="wrap_content"
|
22
14
|
android:gravity="center_horizontal"
|
23
15
|
android:text="Error loading page"
|
24
16
|
app:layout_constraintBottom_toBottomOf="parent"
|
25
17
|
app:layout_constraintTop_toTopOf="parent"
|
26
|
-
app:layout_constraintVertical_bias=".
|
27
|
-
tools:layout_editor_absoluteX="24dp" />
|
18
|
+
app:layout_constraintVertical_bias=".40" />
|
28
19
|
|
29
20
|
<com.google.android.material.textview.MaterialTextView
|
30
|
-
style="?
|
21
|
+
style="?textAppearanceCaption"
|
31
22
|
android:layout_width="match_parent"
|
32
23
|
android:layout_height="wrap_content"
|
33
24
|
android:layout_marginTop="10dp"
|
@@ -36,4 +27,4 @@
|
|
36
27
|
app:layout_constraintTop_toBottomOf="@id/error_message"
|
37
28
|
tools:layout_editor_absoluteX="24dp" />
|
38
29
|
|
39
|
-
</androidx.constraintlayout.widget.ConstraintLayout>
|
30
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -43,10 +43,6 @@ struct ErrorView: View {
|
|
43
43
|
|
44
44
|
var body: some View {
|
45
45
|
VStack(spacing: 16) {
|
46
|
-
Image(systemName: "exclamationmark.triangle")
|
47
|
-
.font(.system(size: 38, weight: .semibold))
|
48
|
-
.foregroundColor(.accentColor)
|
49
|
-
|
50
46
|
Text("Error loading page")
|
51
47
|
.font(.largeTitle)
|
52
48
|
|
@@ -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
|
|
@@ -52,7 +52,7 @@ extension TurboNavigationController {
|
|
52
52
|
|
53
53
|
private func isClearAll(_ properties: PathProperties) -> Bool {
|
54
54
|
return properties["presentation"] as? String == "clear-all"
|
55
|
-
}
|
55
|
+
}
|
56
56
|
|
57
57
|
private func isReplaceAll(_ properties: PathProperties) -> Bool {
|
58
58
|
return properties["presentation"] as? String == "replace-all"
|
@@ -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 = [:]) {
|
@@ -72,11 +72,9 @@ extension SceneDelegate: SessionDelegate {
|
|
72
72
|
if let turboError = error as? TurboError, case let .http(statusCode) = turboError, statusCode == 401 {
|
73
73
|
promptForAuthentication()
|
74
74
|
} else if let errorPresenter = visitable as? ErrorPresenter {
|
75
|
-
errorPresenter.presentError(error) {
|
76
|
-
self?.session.reload()
|
77
|
-
}
|
75
|
+
errorPresenter.presentError(error) { session.reload() }
|
78
76
|
} else {
|
79
|
-
|
77
|
+
fatalError("Visit failed!")
|
80
78
|
}
|
81
79
|
}
|
82
80
|
|
@@ -43,10 +43,6 @@ struct ErrorView: View {
|
|
43
43
|
|
44
44
|
var body: some View {
|
45
45
|
VStack(spacing: 16) {
|
46
|
-
Image(systemName: "exclamationmark.triangle")
|
47
|
-
.font(.system(size: 38, weight: .semibold))
|
48
|
-
.foregroundColor(.accentColor)
|
49
|
-
|
50
46
|
Text("Error loading page")
|
51
47
|
.font(.largeTitle)
|
52
48
|
|
@@ -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
|
|
@@ -52,7 +52,7 @@ extension TurboNavigationController {
|
|
52
52
|
|
53
53
|
private func isClearAll(_ properties: PathProperties) -> Bool {
|
54
54
|
return properties["presentation"] as? String == "clear-all"
|
55
|
-
}
|
55
|
+
}
|
56
56
|
|
57
57
|
private func isReplaceAll(_ properties: PathProperties) -> Bool {
|
58
58
|
return properties["presentation"] as? String == "replace-all"
|
@@ -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 = [:]) {
|
@@ -90,11 +90,9 @@ extension SceneDelegate: SessionDelegate {
|
|
90
90
|
|
91
91
|
func session(_ session: Session, didFailRequestForVisitable visitable: Visitable, error: Error) {
|
92
92
|
if let errorPresenter = visitable as? ErrorPresenter {
|
93
|
-
errorPresenter.presentError(error) {
|
94
|
-
self?.session().reload()
|
95
|
-
}
|
93
|
+
errorPresenter.presentError(error) { session.reload() }
|
96
94
|
} else {
|
97
|
-
|
95
|
+
fatalError("Visit failed!")
|
98
96
|
}
|
99
97
|
}
|
100
98
|
|
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.8
|
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
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/anim/overshoot_interpolator.xml
|
64
64
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/drawable/ic_close.xml
|
65
65
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/drawable/ic_launcher_foreground.xml
|
66
|
-
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/drawable/ic_warning.xml
|
67
66
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/activity_main.xml.tt
|
68
67
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/error_web.xml
|
69
68
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/fragment_native.xml
|
@@ -112,7 +111,6 @@ files:
|
|
112
111
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_home.xml
|
113
112
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_launcher_foreground.xml
|
114
113
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_settings.xml
|
115
|
-
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_warning.xml
|
116
114
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/activity_main.xml.tt
|
117
115
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/error_web.xml
|
118
116
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/fragment_native.xml
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<vector android:height="24dp" android:tint="@color/color_brand"
|
2
|
-
android:viewportHeight="24" android:viewportWidth="24"
|
3
|
-
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
4
|
-
<path android:fillColor="@android:color/white" android:pathData="M12,5.99L19.53,19H4.47L12,5.99M12,2L1,21h22L12,2L12,2z"/>
|
5
|
-
<path android:fillColor="@android:color/white" android:pathData="M13,16l-2,0l0,2l2,0z"/>
|
6
|
-
<path android:fillColor="@android:color/white" android:pathData="M13,10l-2,0l0,5l2,0z"/>
|
7
|
-
</vector>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<vector android:height="24dp" android:tint="@color/color_brand"
|
2
|
-
android:viewportHeight="24" android:viewportWidth="24"
|
3
|
-
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
4
|
-
<path android:fillColor="@android:color/white" android:pathData="M12,5.99L19.53,19H4.47L12,5.99M12,2L1,21h22L12,2L12,2z"/>
|
5
|
-
<path android:fillColor="@android:color/white" android:pathData="M13,16l-2,0l0,2l2,0z"/>
|
6
|
-
<path android:fillColor="@android:color/white" android:pathData="M13,10l-2,0l0,5l2,0z"/>
|
7
|
-
</vector>
|