turbo-native-initializer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +5 -0
  3. data/CODE_OF_CONDUCT.md +84 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +53 -0
  6. data/Rakefile +2 -0
  7. data/exe/turbo-native-initializer +3 -0
  8. data/lib/turbo-native-initializer.rb +1 -0
  9. data/lib/turbo_native_initializer/generator.rb +79 -0
  10. data/lib/turbo_native_initializer/templates/android_stack/app/.gitignore +1 -0
  11. data/lib/turbo_native_initializer/templates/android_stack/app/build.gradle.kts.tt +44 -0
  12. data/lib/turbo_native_initializer/templates/android_stack/app/proguard-rules.pro +21 -0
  13. data/lib/turbo_native_initializer/templates/android_stack/app/src/debug/AndroidManifest.xml.tt +4 -0
  14. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/AndroidManifest.xml.tt +29 -0
  15. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/assets/json/configuration.json +11 -0
  16. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/base/NavDestination.kt.tt +69 -0
  17. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebFragment.kt.tt +37 -0
  18. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebHomeFragment.kt.tt +15 -0
  19. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebModalFragment.kt.tt +17 -0
  20. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/main/MainActivity.kt.tt +18 -0
  21. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/main/MainSessionNavHostFragment.kt.tt +37 -0
  22. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/java/dev/hotwire/turbo/turbonativeproject/util/Constants.kt.tt +8 -0
  23. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/anim/nav_slide_enter.xml +10 -0
  24. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/anim/nav_slide_exit.xml +7 -0
  25. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/anim/nav_slide_pop_enter.xml +15 -0
  26. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/anim/nav_slide_pop_exit.xml +15 -0
  27. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/anim/overshoot_interpolator.xml +4 -0
  28. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/drawable/ic_close.xml +5 -0
  29. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/drawable/ic_launcher_foreground.xml +17 -0
  30. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/layout/activity_main.xml.tt +17 -0
  31. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/layout/fragment_web_home.xml +36 -0
  32. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/layout/toolbar_progress.xml +13 -0
  33. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/menu/web.xml +14 -0
  34. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  35. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  36. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  37. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  38. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  39. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  40. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  41. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  42. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/values/colors.xml +5 -0
  43. data/lib/turbo_native_initializer/templates/android_stack/app/src/main/res/values/themes.xml.tt +5 -0
  44. data/lib/turbo_native_initializer/templates/android_stack/build.gradle.kts +5 -0
  45. data/lib/turbo_native_initializer/templates/android_stack/gradle/wrapper/gradle-wrapper.jar +0 -0
  46. data/lib/turbo_native_initializer/templates/android_stack/gradle/wrapper/gradle-wrapper.properties +6 -0
  47. data/lib/turbo_native_initializer/templates/android_stack/gradle.properties +23 -0
  48. data/lib/turbo_native_initializer/templates/android_stack/gradlew +185 -0
  49. data/lib/turbo_native_initializer/templates/android_stack/gradlew.bat +89 -0
  50. data/lib/turbo_native_initializer/templates/android_stack/local.properties +10 -0
  51. data/lib/turbo_native_initializer/templates/android_stack/settings.gradle.kts.tt +17 -0
  52. data/lib/turbo_native_initializer/templates/android_tabs/app/.gitignore +1 -0
  53. data/lib/turbo_native_initializer/templates/android_tabs/app/build.gradle.kts.tt +44 -0
  54. data/lib/turbo_native_initializer/templates/android_tabs/app/proguard-rules.pro +21 -0
  55. data/lib/turbo_native_initializer/templates/android_tabs/app/src/debug/AndroidManifest.xml.tt +4 -0
  56. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/AndroidManifest.xml.tt +29 -0
  57. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/assets/json/configuration.json +11 -0
  58. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/base/NavDestination.kt.tt +69 -0
  59. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebFragment.kt.tt +29 -0
  60. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebHomeFragment.kt.tt +15 -0
  61. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/features/web/WebModalFragment.kt.tt +17 -0
  62. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/main/MainActivity.kt.tt +47 -0
  63. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/main/TabOneSessionNavHostFragment.kt.tt +37 -0
  64. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/main/TabTwoSessionNavHostFragment.kt.tt +37 -0
  65. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/java/dev/hotwire/turbo/turbonativeproject/util/Constants.kt.tt +8 -0
  66. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/anim/nav_slide_enter.xml +10 -0
  67. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/anim/nav_slide_exit.xml +7 -0
  68. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/anim/nav_slide_pop_enter.xml +15 -0
  69. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/anim/nav_slide_pop_exit.xml +15 -0
  70. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/anim/overshoot_interpolator.xml +4 -0
  71. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/drawable/ic_close.xml +5 -0
  72. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/drawable/ic_home.xml +5 -0
  73. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/drawable/ic_launcher_foreground.xml +17 -0
  74. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/drawable/ic_settings.xml +5 -0
  75. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/layout/activity_main.xml.tt +34 -0
  76. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/layout/fragment_web_home.xml +36 -0
  77. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/layout/toolbar_progress.xml +13 -0
  78. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/menu/bottom_navigation_menu.xml +12 -0
  79. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/menu/web.xml +14 -0
  80. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  81. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  82. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  83. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  84. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  85. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  86. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  87. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  88. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/values/colors.xml +5 -0
  89. data/lib/turbo_native_initializer/templates/android_tabs/app/src/main/res/values/themes.xml.tt +5 -0
  90. data/lib/turbo_native_initializer/templates/android_tabs/build.gradle.kts +5 -0
  91. data/lib/turbo_native_initializer/templates/android_tabs/gradle/wrapper/gradle-wrapper.jar +0 -0
  92. data/lib/turbo_native_initializer/templates/android_tabs/gradle/wrapper/gradle-wrapper.properties +6 -0
  93. data/lib/turbo_native_initializer/templates/android_tabs/gradle.properties +23 -0
  94. data/lib/turbo_native_initializer/templates/android_tabs/gradlew +185 -0
  95. data/lib/turbo_native_initializer/templates/android_tabs/gradlew.bat +89 -0
  96. data/lib/turbo_native_initializer/templates/android_tabs/local.properties +10 -0
  97. data/lib/turbo_native_initializer/templates/android_tabs/settings.gradle.kts.tt +17 -0
  98. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Configuration/Info.plist +29 -0
  99. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Configuration/path-configuration.json +10 -0
  100. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/ErrorPresenter.swift +74 -0
  101. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/TurboNavigationController.swift +123 -0
  102. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Controllers/ViewController.swift +20 -0
  103. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Delegates/AppDelegate.swift +8 -0
  104. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Delegates/SceneDelegate.swift.tt +139 -0
  105. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  106. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  107. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Assets.xcassets/AppIcon.appiconset/turbo.png +0 -0
  108. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Assets.xcassets/Contents.json +6 -0
  109. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Assets.xcassets/SplashIcon.imageset/Contents.json +21 -0
  110. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Assets.xcassets/SplashIcon.imageset/turbo.png +0 -0
  111. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Base.lproj/LaunchScreen.storyboard +39 -0
  112. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/Resources/Base.lproj/Main.storyboard.tt +32 -0
  113. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject/TurboNativeProject.swift.tt +10 -0
  114. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject.xcodeproj/project.pbxproj.tt +436 -0
  115. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  116. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  117. data/lib/turbo_native_initializer/templates/ios_stack/TurboNativeProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +14 -0
  118. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Configuration/Info.plist +29 -0
  119. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Configuration/path-configuration.json +10 -0
  120. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/ErrorPresenter.swift +74 -0
  121. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/TurboNavigationController.swift +123 -0
  122. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Controllers/ViewController.swift +20 -0
  123. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Delegates/AppDelegate.swift +8 -0
  124. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Delegates/SceneDelegate.swift.tt +156 -0
  125. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  126. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  127. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Assets.xcassets/AppIcon.appiconset/turbo.png +0 -0
  128. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Assets.xcassets/Contents.json +6 -0
  129. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Assets.xcassets/SplashIcon.imageset/Contents.json +21 -0
  130. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Assets.xcassets/SplashIcon.imageset/turbo.png +0 -0
  131. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Base.lproj/LaunchScreen.storyboard +39 -0
  132. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/Resources/Base.lproj/Main.storyboard +69 -0
  133. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject/TurboNativeProject.swift.tt +10 -0
  134. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject.xcodeproj/project.pbxproj.tt +436 -0
  135. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  136. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  137. data/lib/turbo_native_initializer/templates/ios_tabs/TurboNativeProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +14 -0
  138. data/lib/turbo_native_initializer/version.rb +3 -0
  139. data/lib/turbo_native_initializer.rb +5 -0
  140. metadata +199 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cf0fb14c659e3a981d1174b378d7a064f6cba913476b82413bd32f5f41448248
4
+ data.tar.gz: 2e1bf6f4f9f54b1a11ea72d1bf69a21e1793632c2502da9218fee889d15b9efb
5
+ SHA512:
6
+ metadata.gz: f559f58710faa8aff5a7dc6fe4c331dfb77ae08e8f7b9dac937d8f94781839c409d2ebca00255e41e45daf71a01fac95282eccd7734fe7dd7b9b69280d9d07c3
7
+ data.tar.gz: 4d4dbc4750b58104185d6527b131f69f35b978ced92b72171815406d9eb76d66cae8ead57bd5d02eb5fe25c7144e62f61cbbbee5ec450ad0f1202a25196fd734
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-08-23
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at lazaronixon@hotmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Nixon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Turbo Native Initializer
2
+
3
+ A turbo native project generator for iOS and Android.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ $ gem install turbo-native-initializer
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ iOS (Xcode is required)
14
+
15
+ ```
16
+ $ turbo-native-initializer AwesomeProject --platform=ios
17
+ $ cd AwesomeProject
18
+ $ xed .
19
+ ```
20
+
21
+ Android (Android Studio is required)
22
+
23
+ To be able to open projects from terminal, open Android Studio and click on `Tools -> Create Command-line Launcher...`.
24
+
25
+ ```
26
+ $ turbo-native-initializer AwesomeProject --platform=android
27
+ $ cd AwesomeProject
28
+ $ studio .
29
+ ```
30
+
31
+ For more options check --help.
32
+
33
+ ```
34
+ $ turbo-native-initializer --help
35
+ ```
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lazaronixon/turbo-native-initializer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/lazaronixon/turbo-native-initializer/blob/master/CODE_OF_CONDUCT.md).
46
+
47
+ ## License
48
+
49
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
50
+
51
+ ## Code of Conduct
52
+
53
+ Everyone interacting in the TurboNativeInitializer project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/turbo-native-initializer/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task default: %i[]
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "turbo_native_initializer"
3
+ TurboNativeInitializer::Generator.start
@@ -0,0 +1 @@
1
+ require "turbo-native-initializer"
@@ -0,0 +1,79 @@
1
+ require "thor"
2
+
3
+ module TurboNativeInitializer
4
+ class Generator < Thor::Group
5
+ include Thor::Actions
6
+
7
+ argument :name
8
+
9
+ class_option :platform, type: :string, enum: %w[ios android], required: true
10
+ class_option :navigation, type: :string, enum: %w[stack tabs], default: "stack"
11
+ class_option :package, type: :string, default: "dev.hotwire.turbo"
12
+
13
+ source_root File.expand_path("templates", __dir__)
14
+
15
+ def self.exit_on_failure?
16
+ true
17
+ end
18
+
19
+ def copy_template_files
20
+ case options.platform
21
+ when "android"
22
+ copy_android_files
23
+ when "ios"
24
+ copy_ios_files
25
+ end
26
+ end
27
+
28
+ private
29
+ def project
30
+ "#{options[:platform]}_#{options[:navigation]}"
31
+ end
32
+
33
+ def copy_ios_files
34
+ # project/TurboNativeProject
35
+ directory "#{project}/TurboNativeProject/Configuration", "#{name}/#{name}/Configuration"
36
+ directory "#{project}/TurboNativeProject/Controllers", "#{name}/#{name}/Controllers"
37
+ directory "#{project}/TurboNativeProject/Delegates", "#{name}/#{name}/Delegates"
38
+ directory "#{project}/TurboNativeProject/Resources", "#{name}/#{name}/Resources"
39
+ template "#{project}/TurboNativeProject/TurboNativeProject.swift", "#{name}/#{name}/#{name}.swift"
40
+ # project
41
+ directory "#{project}/TurboNativeProject.xcodeproj", "#{name}/#{name}.xcodeproj"
42
+ end
43
+
44
+ def copy_android_files
45
+ # project/app
46
+ copy_file "#{project}/app/.gitignore", "#{name}/app/.gitignore"
47
+ copy_file "#{project}/app/proguard-rules.pro", "#{name}/app/proguard-rules.pro"
48
+ template "#{project}/app/build.gradle.kts", "#{name}/app/build.gradle.kts"
49
+ # project/app/src/debug
50
+ directory "#{project}/app/src/debug", "#{name}/app/src/debug"
51
+ # project/app/src/main
52
+ directory "#{project}/app/src/main/assets", "#{name}/app/src/main/assets"
53
+ directory "#{project}/app/src/main/java/dev/hotwire/turbo/turbonativeproject", "#{name}/app/src/main/java/#{package_path}"
54
+ directory "#{project}/app/src/main/res", "#{name}/app/src/main/res"
55
+ template "#{project}/app/src/main/AndroidManifest.xml", "#{name}/app/src/main/AndroidManifest.xml"
56
+ # project/gradle
57
+ directory "#{project}/gradle", "#{name}/gradle"
58
+ # project
59
+ copy_file "#{project}/build.gradle.kts", "#{name}/build.gradle.kts"
60
+ copy_file "#{project}/gradle.properties", "#{name}/gradle.properties"
61
+ copy_file "#{project}/gradlew", "#{name}/gradlew"
62
+ copy_file "#{project}/gradlew.bat", "#{name}/gradlew.bat"
63
+ copy_file "#{project}/local.properties", "#{name}/local.properties"
64
+ template "#{project}/settings.gradle.kts", "#{name}/settings.gradle.kts"
65
+ end
66
+
67
+ def package_path
68
+ options[:package].split(".").join("/")
69
+ end
70
+
71
+ def package_name
72
+ "#{options[:package]}.#{name.downcase}"
73
+ end
74
+
75
+ def bundle_identifier
76
+ "#{options[:package]}.#{name}"
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,44 @@
1
+ plugins {
2
+ id("com.android.application")
3
+ id("org.jetbrains.kotlin.android")
4
+ }
5
+
6
+ android {
7
+ namespace = "<%= package_name %>"
8
+ compileSdk = 33
9
+
10
+ defaultConfig {
11
+ applicationId = "<%= package_name %>"
12
+ minSdk = 24
13
+ targetSdk = 33
14
+ versionCode = 1
15
+ versionName = "1.0"
16
+
17
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18
+ }
19
+
20
+ buildTypes {
21
+ release {
22
+ isMinifyEnabled = false
23
+ proguardFiles(
24
+ getDefaultProguardFile("proguard-android-optimize.txt"),
25
+ "proguard-rules.pro"
26
+ )
27
+ }
28
+ }
29
+ compileOptions {
30
+ sourceCompatibility = JavaVersion.VERSION_1_8
31
+ targetCompatibility = JavaVersion.VERSION_1_8
32
+ }
33
+ kotlinOptions {
34
+ jvmTarget = "1.8"
35
+ }
36
+ }
37
+
38
+ dependencies {
39
+ implementation("androidx.core:core-ktx:1.9.0")
40
+ implementation("androidx.appcompat:appcompat:1.6.1")
41
+ implementation("androidx.browser:browser:1.5.0")
42
+ implementation("com.google.android.material:material:1.9.0")
43
+ implementation("dev.hotwire:turbo:7.0.0")
44
+ }
@@ -0,0 +1,21 @@
1
+ # Add project specific ProGuard rules here.
2
+ # You can control the set of applied configuration files using the
3
+ # proguardFiles setting in build.gradle.
4
+ #
5
+ # For more details, see
6
+ # http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+ # If your project uses WebView with JS, uncomment the following
9
+ # and specify the fully qualified class name to the JavaScript interface
10
+ # class:
11
+ #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+ # public *;
13
+ #}
14
+
15
+ # Uncomment this to preserve the line number information for
16
+ # debugging stack traces.
17
+ #-keepattributes SourceFile,LineNumberTable
18
+
19
+ # If you keep the line number information, uncomment this to
20
+ # hide the original source file name.
21
+ #-renamesourcefileattribute SourceFile
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <application android:usesCleartextTraffic="true"></application>
4
+ </manifest>
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+
5
+ <uses-permission android:name="android.permission.INTERNET"/>
6
+
7
+ <application
8
+ android:allowBackup="false"
9
+ android:enableOnBackInvokedCallback="true"
10
+ android:icon="@mipmap/ic_launcher"
11
+ android:label="<%= name %>"
12
+ android:roundIcon="@mipmap/ic_launcher_round"
13
+ android:supportsRtl="true"
14
+ android:theme="@style/Theme.<%= name %>"
15
+ tools:targetApi="31">
16
+ <activity
17
+ android:name="<%= package_name %>.main.MainActivity"
18
+ android:launchMode="singleInstance"
19
+ android:theme="@style/Theme.<%= name %>"
20
+ android:windowSoftInputMode="adjustResize"
21
+ android:exported="true">
22
+ <intent-filter>
23
+ <action android:name="android.intent.action.MAIN"/>
24
+ <category android:name="android.intent.category.LAUNCHER"/>
25
+ </intent-filter>
26
+ </activity>
27
+ </application>
28
+
29
+ </manifest>
@@ -0,0 +1,11 @@
1
+ {
2
+ "settings": {},
3
+ "rules": [
4
+ { "patterns": [".*"], "properties": { "uri": "turbo://fragment/web", "pull_to_refresh_enabled": true } },
5
+ { "patterns": ["/refresh_historical_location"], "properties": { "presentation": "refresh" } },
6
+ { "patterns": ["/recede_historical_location"], "properties": { "presentation": "pop" } },
7
+ { "patterns": ["/resume_historical_location"], "properties": { "presentation": "none" } },
8
+ { "patterns": ["^/$"], "properties": { "uri": "turbo://fragment/web/home", "presentation": "replace_all" } },
9
+ { "patterns": ["/new$", "/edit$", "/signin$"], "properties": { "context": "modal", "uri": "turbo://fragment/web/modal" } }
10
+ ]
11
+ }
@@ -0,0 +1,69 @@
1
+ package <%= package_name %>.base
2
+
3
+ import android.net.Uri
4
+ import android.view.MenuItem
5
+ import androidx.browser.customtabs.CustomTabColorSchemeParams
6
+ import androidx.browser.customtabs.CustomTabsIntent
7
+ import androidx.browser.customtabs.CustomTabsIntent.SHARE_STATE_ON
8
+ import androidx.navigation.NavOptions
9
+ import androidx.navigation.navOptions
10
+ import dev.hotwire.turbo.config.TurboPathConfigurationProperties
11
+ import dev.hotwire.turbo.config.context
12
+ import <%= package_name %>.R
13
+ import <%= package_name %>.util.BASE_URL
14
+ import dev.hotwire.turbo.nav.TurboNavDestination
15
+ import dev.hotwire.turbo.nav.TurboNavPresentationContext.MODAL
16
+
17
+ interface NavDestination : TurboNavDestination {
18
+ val menuProgress: MenuItem?
19
+ get() = toolbarForNavigation()?.menu?.findItem(R.id.menu_progress)
20
+
21
+ override fun shouldNavigateTo(newLocation: String): Boolean {
22
+ return when (isNavigable(newLocation)) {
23
+ true -> true
24
+ else -> { launchCustomTab(newLocation); false }
25
+ }
26
+ }
27
+
28
+ override fun getNavigationOptions(
29
+ newLocation: String,
30
+ newPathProperties: TurboPathConfigurationProperties
31
+ ): NavOptions {
32
+ return when (newPathProperties.context) {
33
+ MODAL -> slideAnimation()
34
+ else -> super.getNavigationOptions(newLocation, newPathProperties)
35
+ }
36
+ }
37
+
38
+ private fun isNavigable(location: String): Boolean {
39
+ return location.startsWith(BASE_URL)
40
+ }
41
+
42
+ private fun launchCustomTab(location: String) {
43
+ val context = fragment.context ?: return
44
+ val color = context.getColor(R.color.white)
45
+ val colorParams = CustomTabColorSchemeParams.Builder()
46
+ .setToolbarColor(color)
47
+ .setNavigationBarColor(color)
48
+ .build()
49
+
50
+ CustomTabsIntent.Builder()
51
+ .setShowTitle(true)
52
+ .setShareState(SHARE_STATE_ON)
53
+ .setUrlBarHidingEnabled(false)
54
+ .setDefaultColorSchemeParams(colorParams)
55
+ .build()
56
+ .launchUrl(context, Uri.parse(location))
57
+ }
58
+
59
+ private fun slideAnimation(): NavOptions {
60
+ return navOptions {
61
+ anim {
62
+ enter = R.anim.nav_slide_enter
63
+ exit = R.anim.nav_slide_exit
64
+ popEnter = R.anim.nav_slide_pop_enter
65
+ popExit = R.anim.nav_slide_pop_exit
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,37 @@
1
+ package <%= package_name %>.features.web
2
+
3
+ import android.os.Bundle
4
+ import android.view.View
5
+ import <%= package_name %>.R
6
+ import <%= package_name %>.base.NavDestination
7
+ import <%= package_name %>.util.SIGN_IN_URL
8
+ import dev.hotwire.turbo.fragments.TurboWebFragment
9
+ import dev.hotwire.turbo.nav.TurboNavGraphDestination
10
+ import dev.hotwire.turbo.visit.TurboVisitAction.REPLACE
11
+ import dev.hotwire.turbo.visit.TurboVisitOptions
12
+
13
+ @TurboNavGraphDestination(uri = "turbo://fragment/web")
14
+ open class WebFragment : TurboWebFragment(), NavDestination {
15
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
16
+ super.onViewCreated(view, savedInstanceState); setupMenu()
17
+ }
18
+
19
+ override fun onFormSubmissionStarted(location: String) {
20
+ menuProgress?.isVisible = true
21
+ }
22
+
23
+ override fun onFormSubmissionFinished(location: String) {
24
+ menuProgress?.isVisible = false
25
+ }
26
+
27
+ override fun onVisitErrorReceived(location: String, errorCode: Int) {
28
+ when (errorCode) {
29
+ 401 -> navigate(SIGN_IN_URL, TurboVisitOptions(action = REPLACE))
30
+ else -> super.onVisitErrorReceived(location, errorCode)
31
+ }
32
+ }
33
+
34
+ private fun setupMenu() {
35
+ toolbarForNavigation()?.inflateMenu(R.menu.web)
36
+ }
37
+ }
@@ -0,0 +1,15 @@
1
+ package <%= package_name %>.features.web
2
+
3
+ import android.os.Bundle
4
+ import android.view.LayoutInflater
5
+ import android.view.View
6
+ import android.view.ViewGroup
7
+ import <%= package_name %>.R
8
+ import dev.hotwire.turbo.nav.TurboNavGraphDestination
9
+
10
+ @TurboNavGraphDestination(uri = "turbo://fragment/web/home")
11
+ class WebHomeFragment : WebFragment() {
12
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
13
+ return inflater.inflate(R.layout.fragment_web_home, container, false)
14
+ }
15
+ }
@@ -0,0 +1,17 @@
1
+ package <%= package_name %>.features.web
2
+
3
+ import android.os.Bundle
4
+ import android.view.View
5
+ import dev.hotwire.turbo.nav.TurboNavGraphDestination
6
+ import <%= package_name %>.R
7
+
8
+ @TurboNavGraphDestination(uri = "turbo://fragment/web/modal")
9
+ class WebModalFragment : WebFragment() {
10
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
11
+ super.onViewCreated(view, savedInstanceState); initToolbar()
12
+ }
13
+
14
+ private fun initToolbar() {
15
+ toolbarForNavigation()?.navigationIcon = context?.getDrawable(R.drawable.ic_close)
16
+ }
17
+ }
@@ -0,0 +1,18 @@
1
+ package <%= package_name %>.main
2
+
3
+ import android.os.Bundle
4
+ import androidx.appcompat.app.AppCompatActivity
5
+ import dev.hotwire.turbo.activities.TurboActivity
6
+ import dev.hotwire.turbo.delegates.TurboActivityDelegate
7
+ import <%= package_name %>.R
8
+
9
+ class MainActivity : AppCompatActivity(), TurboActivity {
10
+ override lateinit var delegate: TurboActivityDelegate
11
+
12
+ override fun onCreate(savedInstanceState: Bundle?) {
13
+ super.onCreate(savedInstanceState)
14
+ setContentView(R.layout.activity_main)
15
+
16
+ delegate = TurboActivityDelegate(this, R.id.main_nav_host)
17
+ }
18
+ }
@@ -0,0 +1,37 @@
1
+ package <%= package_name %>.main
2
+
3
+ import android.webkit.WebView
4
+ import androidx.appcompat.app.AppCompatActivity
5
+ import androidx.fragment.app.Fragment
6
+ import dev.hotwire.turbo.config.TurboPathConfiguration
7
+ import <%= package_name %>.features.web.WebFragment
8
+ import <%= package_name %>.features.web.WebHomeFragment
9
+ import <%= package_name %>.features.web.WebModalFragment
10
+ import <%= package_name %>.util.CURRENT_URL
11
+ import dev.hotwire.turbo.session.TurboSessionNavHostFragment
12
+ import kotlin.reflect.KClass
13
+
14
+ @Suppress("unused")
15
+ class MainSessionNavHostFragment : TurboSessionNavHostFragment() {
16
+ override val sessionName = "main"
17
+
18
+ override val startLocation = CURRENT_URL
19
+
20
+ override val registeredActivities: List<KClass<out AppCompatActivity>>
21
+ get() = listOf()
22
+
23
+ override val registeredFragments: List<KClass<out Fragment>>
24
+ get() = listOf(WebFragment::class, WebHomeFragment::class, WebModalFragment::class)
25
+
26
+ override val pathConfigurationLocation: TurboPathConfiguration.Location
27
+ get() = TurboPathConfiguration.Location(assetFilePath = "json/configuration.json")
28
+
29
+ override fun onSessionCreated() {
30
+ super.onSessionCreated()
31
+ session.webView.settings.userAgentString = customUserAgent(session.webView)
32
+ }
33
+
34
+ private fun customUserAgent(webView: WebView): String {
35
+ return "Turbo Native Android ${webView.settings.userAgentString}"
36
+ }
37
+ }
@@ -0,0 +1,8 @@
1
+ package <%= package_name %>.util
2
+
3
+ private const val DEVELOPMENT_URL = "http://10.0.2.2:3000"
4
+ private const val PRODUCTION_URL = "https://turbo-native-demo.glitch.me"
5
+
6
+ const val BASE_URL = PRODUCTION_URL
7
+ const val CURRENT_URL = "$BASE_URL/"
8
+ const val SIGN_IN_URL = "$BASE_URL/signin"
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <set xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:shareInterpolator="false">
4
+
5
+ <translate
6
+ android:interpolator="@anim/overshoot_interpolator"
7
+ android:fromYDelta="40%p"
8
+ android:toYDelta="0%p"
9
+ android:duration="300"/>
10
+ </set>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <set xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <alpha
4
+ android:fromAlpha="1.0"
5
+ android:toAlpha="1.0"
6
+ android:duration="300"/>
7
+ </set>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <set xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:shareInterpolator="false">
4
+
5
+ <alpha
6
+ android:fromAlpha="0.0"
7
+ android:toAlpha="1.0"
8
+ android:duration="300"/>
9
+
10
+ <translate
11
+ android:interpolator="@anim/overshoot_interpolator"
12
+ android:fromYDelta="-10%p"
13
+ android:toYDelta="0%p"
14
+ android:duration="300"/>
15
+ </set>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <set xmlns:android="http://schemas.android.com/apk/res/android"
3
+ android:shareInterpolator="false">
4
+
5
+ <alpha
6
+ android:fromAlpha="1.0"
7
+ android:toAlpha="0.0"
8
+ android:duration="300"/>
9
+
10
+ <translate
11
+ android:interpolator="@android:interpolator/decelerate_cubic"
12
+ android:fromYDelta="0%p"
13
+ android:toYDelta="100%p"
14
+ android:duration="300"/>
15
+ </set>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <overshootInterpolator
3
+ xmlns:android="http://schemas.android.com/apk/res/android"
4
+ android:tension="1.1" />