turbo-native-initializer 0.0.4 → 0.0.6
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/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebFragment.kt.tt +6 -0
- 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_stack/base/app/src/main/res/drawable/ic_warning.xml +7 -0
- data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/error_web.xml +39 -0
- data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebFragment.kt.tt +7 -1
- data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_warning.xml +7 -0
- data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/error_web.xml +39 -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/TurboNavigationController.swift +4 -4
- data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/ViewController.swift +7 -5
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/TurboNavigationController.swift +4 -4
- data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/ViewController.swift +7 -5
- data/lib/turbo_native_initializer/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 893bf3c34e0baf61bb3ee5b7ce006ce9946bddc156bb8d95ea9a255d01c93d7e
|
4
|
+
data.tar.gz: 8d9677132ab1956eba6332539cddec223b6f66ffac6e5ed9b766553d104344bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b25e7862afa00d50783f259dceb567a439b807832e2f73984033f80aef10de767e13fc3c6f75b764ba32651a5974d5ebed19cacf368d3c37283f7bb329649c23
|
7
|
+
data.tar.gz: eeaccd07971c2472b78a2b4f1eaff2828f25f23fecad3043d2047de013d636a17ebfc2f7691d45c8acd45a3b7335966b9953530512f7e92010150f641aee40c0
|
data/CHANGELOG.md
CHANGED
@@ -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
|
|
@@ -15,4 +17,8 @@ open class WebFragment : TurboWebFragment(), NavDestination {
|
|
15
17
|
else -> super.onVisitErrorReceived(location, errorCode)
|
16
18
|
}
|
17
19
|
}
|
20
|
+
|
21
|
+
override fun createErrorView(statusCode: Int): View {
|
22
|
+
return layoutInflater.inflate(R.layout.error_web, null)
|
23
|
+
}
|
18
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
|
}
|
@@ -0,0 +1,7 @@
|
|
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>
|
data/lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/error_web.xml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
4
|
+
xmlns:tools="http://schemas.android.com/tools"
|
5
|
+
android:layout_width="match_parent"
|
6
|
+
android:layout_height="match_parent"
|
7
|
+
android:background="?android:colorBackground">
|
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
|
+
<com.google.android.material.textview.MaterialTextView
|
18
|
+
android:id="@+id/error_message"
|
19
|
+
style="?textAppearanceDisplaySmall"
|
20
|
+
android:layout_width="match_parent"
|
21
|
+
android:layout_height="wrap_content"
|
22
|
+
android:gravity="center_horizontal"
|
23
|
+
android:text="Error loading page"
|
24
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
25
|
+
app:layout_constraintTop_toTopOf="parent"
|
26
|
+
app:layout_constraintVertical_bias=".45"
|
27
|
+
tools:layout_editor_absoluteX="24dp" />
|
28
|
+
|
29
|
+
<com.google.android.material.textview.MaterialTextView
|
30
|
+
style="?textAppearanceTitleMedium"
|
31
|
+
android:layout_width="match_parent"
|
32
|
+
android:layout_height="wrap_content"
|
33
|
+
android:layout_marginTop="10dp"
|
34
|
+
android:gravity="center_horizontal"
|
35
|
+
android:text="Pull-to-refresh to try again"
|
36
|
+
app:layout_constraintTop_toBottomOf="@id/error_message"
|
37
|
+
tools:layout_editor_absoluteX="24dp" />
|
38
|
+
|
39
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -1,8 +1,14 @@
|
|
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
|
-
open class WebFragment : TurboWebFragment(), NavDestination
|
10
|
+
open class WebFragment : TurboWebFragment(), NavDestination {
|
11
|
+
override fun createErrorView(statusCode: Int): View {
|
12
|
+
return layoutInflater.inflate(R.layout.error_web, null)
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,7 @@
|
|
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>
|
data/lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/error_web.xml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
4
|
+
xmlns:tools="http://schemas.android.com/tools"
|
5
|
+
android:layout_width="match_parent"
|
6
|
+
android:layout_height="match_parent"
|
7
|
+
android:background="?android:colorBackground">
|
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
|
+
<com.google.android.material.textview.MaterialTextView
|
18
|
+
android:id="@+id/error_message"
|
19
|
+
style="?textAppearanceDisplaySmall"
|
20
|
+
android:layout_width="match_parent"
|
21
|
+
android:layout_height="wrap_content"
|
22
|
+
android:gravity="center_horizontal"
|
23
|
+
android:text="Error loading page"
|
24
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
25
|
+
app:layout_constraintTop_toTopOf="parent"
|
26
|
+
app:layout_constraintVertical_bias=".45"
|
27
|
+
tools:layout_editor_absoluteX="24dp" />
|
28
|
+
|
29
|
+
<com.google.android.material.textview.MaterialTextView
|
30
|
+
style="?textAppearanceTitleMedium"
|
31
|
+
android:layout_width="match_parent"
|
32
|
+
android:layout_height="wrap_content"
|
33
|
+
android:layout_marginTop="10dp"
|
34
|
+
android:gravity="center_horizontal"
|
35
|
+
android:text="Pull-to-refresh to try again"
|
36
|
+
app:layout_constraintTop_toBottomOf="@id/error_message"
|
37
|
+
tools:layout_editor_absoluteX="24dp" />
|
38
|
+
|
39
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -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
|
}
|
@@ -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
|
}
|
@@ -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
|
}
|
@@ -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
|
}
|
@@ -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.6
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -63,7 +63,9 @@ 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
|
66
67
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/activity_main.xml.tt
|
68
|
+
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/error_web.xml
|
67
69
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/fragment_native.xml
|
68
70
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/layout/fragment_web_home.xml
|
69
71
|
- lib/turbo_native_initializer/templates/android_stack/base/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
|
@@ -110,7 +112,9 @@ files:
|
|
110
112
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_home.xml
|
111
113
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/drawable/ic_launcher_foreground.xml
|
112
114
|
- 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
|
113
116
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/activity_main.xml.tt
|
117
|
+
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/error_web.xml
|
114
118
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/fragment_native.xml
|
115
119
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/layout/fragment_web_home.xml
|
116
120
|
- lib/turbo_native_initializer/templates/android_tabs/base/app/src/main/res/menu/bottom_navigation_menu.xml
|