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
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/env sh
2
+
3
+ #
4
+ # Copyright 2015 the original author or authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ##############################################################################
20
+ ##
21
+ ## Gradle start up script for UN*X
22
+ ##
23
+ ##############################################################################
24
+
25
+ # Attempt to set APP_HOME
26
+ # Resolve links: $0 may be a link
27
+ PRG="$0"
28
+ # Need this for relative symlinks.
29
+ while [ -h "$PRG" ] ; do
30
+ ls=`ls -ld "$PRG"`
31
+ link=`expr "$ls" : '.*-> \(.*\)$'`
32
+ if expr "$link" : '/.*' > /dev/null; then
33
+ PRG="$link"
34
+ else
35
+ PRG=`dirname "$PRG"`"/$link"
36
+ fi
37
+ done
38
+ SAVED="`pwd`"
39
+ cd "`dirname \"$PRG\"`/" >/dev/null
40
+ APP_HOME="`pwd -P`"
41
+ cd "$SAVED" >/dev/null
42
+
43
+ APP_NAME="Gradle"
44
+ APP_BASE_NAME=`basename "$0"`
45
+
46
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
50
+ MAX_FD="maximum"
51
+
52
+ warn () {
53
+ echo "$*"
54
+ }
55
+
56
+ die () {
57
+ echo
58
+ echo "$*"
59
+ echo
60
+ exit 1
61
+ }
62
+
63
+ # OS specific support (must be 'true' or 'false').
64
+ cygwin=false
65
+ msys=false
66
+ darwin=false
67
+ nonstop=false
68
+ case "`uname`" in
69
+ CYGWIN* )
70
+ cygwin=true
71
+ ;;
72
+ Darwin* )
73
+ darwin=true
74
+ ;;
75
+ MINGW* )
76
+ msys=true
77
+ ;;
78
+ NONSTOP* )
79
+ nonstop=true
80
+ ;;
81
+ esac
82
+
83
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+
86
+ # Determine the Java command to use to start the JVM.
87
+ if [ -n "$JAVA_HOME" ] ; then
88
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
+ # IBM's JDK on AIX uses strange locations for the executables
90
+ JAVACMD="$JAVA_HOME/jre/sh/java"
91
+ else
92
+ JAVACMD="$JAVA_HOME/bin/java"
93
+ fi
94
+ if [ ! -x "$JAVACMD" ] ; then
95
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
+
97
+ Please set the JAVA_HOME variable in your environment to match the
98
+ location of your Java installation."
99
+ fi
100
+ else
101
+ JAVACMD="java"
102
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
+
104
+ Please set the JAVA_HOME variable in your environment to match the
105
+ location of your Java installation."
106
+ fi
107
+
108
+ # Increase the maximum file descriptors if we can.
109
+ if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
+ MAX_FD_LIMIT=`ulimit -H -n`
111
+ if [ $? -eq 0 ] ; then
112
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
+ MAX_FD="$MAX_FD_LIMIT"
114
+ fi
115
+ ulimit -n $MAX_FD
116
+ if [ $? -ne 0 ] ; then
117
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
118
+ fi
119
+ else
120
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
+ fi
122
+ fi
123
+
124
+ # For Darwin, add options to specify how the application appears in the dock
125
+ if $darwin; then
126
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
+ fi
128
+
129
+ # For Cygwin or MSYS, switch paths to Windows format before running java
130
+ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
+
134
+ JAVACMD=`cygpath --unix "$JAVACMD"`
135
+
136
+ # We build the pattern for arguments to be converted via cygpath
137
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
+ SEP=""
139
+ for dir in $ROOTDIRSRAW ; do
140
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
141
+ SEP="|"
142
+ done
143
+ OURCYGPATTERN="(^($ROOTDIRS))"
144
+ # Add a user-defined pattern to the cygpath arguments
145
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
+ fi
148
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
+ i=0
150
+ for arg in "$@" ; do
151
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
+
154
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
+ else
157
+ eval `echo args$i`="\"$arg\""
158
+ fi
159
+ i=`expr $i + 1`
160
+ done
161
+ case $i in
162
+ 0) set -- ;;
163
+ 1) set -- "$args0" ;;
164
+ 2) set -- "$args0" "$args1" ;;
165
+ 3) set -- "$args0" "$args1" "$args2" ;;
166
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
+ esac
173
+ fi
174
+
175
+ # Escape application args
176
+ save () {
177
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
+ echo " "
179
+ }
180
+ APP_ARGS=`save "$@"`
181
+
182
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
183
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
+
185
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,89 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%" == "" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%" == "" set DIRNAME=.
29
+ set APP_BASE_NAME=%~n0
30
+ set APP_HOME=%DIRNAME%
31
+
32
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
+
35
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
+
38
+ @rem Find java.exe
39
+ if defined JAVA_HOME goto findJavaFromJavaHome
40
+
41
+ set JAVA_EXE=java.exe
42
+ %JAVA_EXE% -version >NUL 2>&1
43
+ if "%ERRORLEVEL%" == "0" goto execute
44
+
45
+ echo.
46
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
+ echo.
48
+ echo Please set the JAVA_HOME variable in your environment to match the
49
+ echo location of your Java installation.
50
+
51
+ goto fail
52
+
53
+ :findJavaFromJavaHome
54
+ set JAVA_HOME=%JAVA_HOME:"=%
55
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
+
57
+ if exist "%JAVA_EXE%" goto execute
58
+
59
+ echo.
60
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
+ echo.
62
+ echo Please set the JAVA_HOME variable in your environment to match the
63
+ echo location of your Java installation.
64
+
65
+ goto fail
66
+
67
+ :execute
68
+ @rem Setup the command line
69
+
70
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
+
72
+
73
+ @rem Execute Gradle
74
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
+
76
+ :end
77
+ @rem End local scope for the variables with windows NT shell
78
+ if "%ERRORLEVEL%"=="0" goto mainEnd
79
+
80
+ :fail
81
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
+ rem the _cmd.exe /c_ return code!
83
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
+ exit /b 1
85
+
86
+ :mainEnd
87
+ if "%OS%"=="Windows_NT" endlocal
88
+
89
+ :omega
@@ -0,0 +1,10 @@
1
+ ## This file is automatically generated by Android Studio.
2
+ # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
+ #
4
+ # This file should *NOT* be checked into Version Control Systems,
5
+ # as it contains information specific to your local configuration.
6
+ #
7
+ # Location of the SDK. This is only used by Gradle.
8
+ # For customization when using a Version Control System, please read the
9
+ # header note.
10
+ sdk.dir=/Users/lazaro.amaral/Library/Android/sdk
@@ -0,0 +1,17 @@
1
+ pluginManagement {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ gradlePluginPortal()
6
+ }
7
+ }
8
+ dependencyResolutionManagement {
9
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10
+ repositories {
11
+ google()
12
+ mavenCentral()
13
+ }
14
+ }
15
+
16
+ rootProject.name = "<%= name %>"
17
+ include(":app")
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>UIApplicationSceneManifest</key>
6
+ <dict>
7
+ <key>UIApplicationSupportsMultipleScenes</key>
8
+ <false/>
9
+ <key>UISceneConfigurations</key>
10
+ <dict>
11
+ <key>UIWindowSceneSessionRoleApplication</key>
12
+ <array>
13
+ <dict>
14
+ <key>UISceneConfigurationName</key>
15
+ <string>Default Configuration</string>
16
+ <key>UISceneDelegateClassName</key>
17
+ <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
18
+ <key>UISceneStoryboardFile</key>
19
+ <string>Main</string>
20
+ </dict>
21
+ </array>
22
+ </dict>
23
+ </dict>
24
+ <key>NSPhotoLibraryUsageDescription</key>
25
+ <string>We use your photo library to upload images.</string>
26
+ <key>NSCameraUsageDescription</key>
27
+ <string>We use your camera to upload images.</string>
28
+ </dict>
29
+ </plist>
@@ -0,0 +1,10 @@
1
+ {
2
+ "settings": {},
3
+ "rules": [
4
+ { "patterns": ["/refresh_historical_location"], "properties": { "presentation": "refresh", "visitable": false } },
5
+ { "patterns": ["/recede_historical_location"], "properties": { "presentation": "pop", "visitable": false } },
6
+ { "patterns": ["/resume_historical_location"], "properties": { "presentation": "none", "visitable": false } },
7
+ { "patterns": ["^/$"], "properties": { "presentation": "replace-all" } },
8
+ { "patterns": ["/new$", "/edit$", "/signin$"], "properties": { "presentation": "modal" } }
9
+ ]
10
+ }
@@ -0,0 +1,74 @@
1
+ import SwiftUI
2
+ import UIKit
3
+
4
+ public protocol ErrorPresenter: UIViewController {
5
+ func presentError(_ error: Error, handler: @escaping () -> Void)
6
+ }
7
+
8
+ public extension ErrorPresenter {
9
+ func presentError(_ error: Error, handler: @escaping () -> Void) {
10
+ let errorView = ErrorView(error: error) { [unowned self] in
11
+ handler(); self.removeErrorViewController()
12
+ }
13
+
14
+ let controller = UIHostingController(rootView: errorView)
15
+ addChild(controller)
16
+ addFullScreenSubview(controller.view)
17
+ controller.didMove(toParent: self)
18
+ }
19
+
20
+ private func removeErrorViewController() {
21
+ if let child = children.first(where: { $0 is UIHostingController<ErrorView> }) {
22
+ child.willMove(toParent: nil)
23
+ child.view.removeFromSuperview()
24
+ child.removeFromParent()
25
+ }
26
+ }
27
+
28
+ private func addFullScreenSubview(_ subview: UIView) {
29
+ view.addSubview(subview)
30
+ subview.translatesAutoresizingMaskIntoConstraints = false
31
+ NSLayoutConstraint.activate([
32
+ subview.leadingAnchor.constraint(equalTo: view.leadingAnchor),
33
+ subview.trailingAnchor.constraint(equalTo: view.trailingAnchor),
34
+ subview.topAnchor.constraint(equalTo: view.topAnchor),
35
+ subview.bottomAnchor.constraint(equalTo: view.bottomAnchor)
36
+ ])
37
+ }
38
+ }
39
+
40
+ struct ErrorView: View {
41
+ let error: Error
42
+ let handler: (() -> Void)?
43
+
44
+ var body: some View {
45
+ VStack(spacing: 16) {
46
+ Image(systemName: "exclamationmark.triangle")
47
+ .font(.system(size: 38, weight: .semibold))
48
+ .foregroundColor(.accentColor)
49
+
50
+ Text("Error loading page")
51
+ .font(.largeTitle)
52
+
53
+ Text(error.localizedDescription)
54
+ .font(.body)
55
+ .multilineTextAlignment(.center)
56
+
57
+ Button("Retry") {
58
+ handler?()
59
+ }
60
+ .font(.system(size: 17, weight: .bold))
61
+ }
62
+ .padding(32)
63
+ }
64
+ }
65
+
66
+ struct ErrorView_Previews: PreviewProvider {
67
+ static var previews: some View {
68
+ return ErrorView(error: NSError(
69
+ domain: "com.example.error",
70
+ code: 1001,
71
+ userInfo: [NSLocalizedDescriptionKey: "Could not connect to the server."]
72
+ )) {}
73
+ }
74
+ }
@@ -0,0 +1,123 @@
1
+ import Foundation
2
+ import UIKit
3
+ import Turbo
4
+
5
+ class TurboNavigationController : UINavigationController {
6
+
7
+ var session: Session!
8
+ var modalSession: Session!
9
+
10
+ func push(url: URL) {
11
+ let properties = session.pathConfiguration?.properties(for: url) ?? [:]
12
+ route(url: url, options: VisitOptions(action: .advance), properties: properties)
13
+ }
14
+
15
+ func route(url: URL, options: VisitOptions, properties: PathProperties) {
16
+ // This is a simplified version of how you might build out the routing
17
+ // and navigation functions of your app. In a real app, these would be separate objects
18
+
19
+ // Dismiss any modals when receiving a new navigation
20
+ if presentedViewController != nil {
21
+ dismiss(animated: true)
22
+ }
23
+
24
+ // - Create view controller appropriate for url/properties
25
+ // - Navigate to that with the correct presentation
26
+ let viewController = makeViewController(for: url, properties: properties)
27
+ navigate(to: viewController, action: options.action, properties: properties)
28
+
29
+ // - Initiate the visit with Turbo
30
+ if isVisitable(properties) {
31
+ visit(viewController: viewController, with: options)
32
+ }
33
+ }
34
+ }
35
+
36
+ extension TurboNavigationController {
37
+ private func isModal(_ properties: PathProperties) -> Bool {
38
+ return properties["presentation"] as? String == "modal"
39
+ }
40
+
41
+ private func isClearAll(_ properties: PathProperties) -> Bool {
42
+ return properties["presentation"] as? String == "clear-all"
43
+ }
44
+
45
+ private func isPop(_ properties: PathProperties) -> Bool {
46
+ return properties["presentation"] as? String == "pop"
47
+ }
48
+
49
+ private func isRefresh(_ properties: PathProperties) -> Bool {
50
+ return properties["presentation"] as? String == "refresh"
51
+ }
52
+
53
+ private func isNone(_ properties: PathProperties) -> Bool {
54
+ return properties["presentation"] as? String == "none"
55
+ }
56
+
57
+ private func isReplaceAll(_ properties: PathProperties) -> Bool {
58
+ return properties["presentation"] as? String == "replace-all"
59
+ }
60
+
61
+ private func isReplace(_ properties: PathProperties) -> Bool {
62
+ return properties["presentation"] as? String == "replace"
63
+ }
64
+
65
+ private func isVisitable(_ properties: PathProperties) -> Bool {
66
+ return properties["visitable"] as? Bool ?? true
67
+ }
68
+
69
+ private func makeViewController(for url: URL, properties: PathProperties = [:]) -> UIViewController {
70
+ // There are many options for determining how to map urls to view controllers
71
+ // The demo uses the path configuration for determining which view controller and presentation
72
+ // to use, but that's completely optional. You can use whatever logic you prefer to determine
73
+ // how you navigate and route different URLs.
74
+
75
+ if let viewController = properties["view-controller"] as? String {
76
+ switch viewController {
77
+ case "numbers":
78
+ assertionFailure("NumbersViewController is not implemented")
79
+ default:
80
+ assertionFailure("Invalid view controller, defaulting to WebView")
81
+ }
82
+ }
83
+
84
+ return ViewController(url: url)
85
+ }
86
+
87
+ private func navigate(to viewController: UIViewController, action: VisitAction, properties: PathProperties = [:], animated: Bool = true) {
88
+ let modalNavController = UINavigationController(rootViewController: viewController)
89
+ modalNavController.modalPresentationStyle = .fullScreen
90
+
91
+ if isModal(properties) {
92
+ present(modalNavController, animated: animated)
93
+ } else if isClearAll(properties) {
94
+ popToRootViewController(animated: true)
95
+ } else if isPop(properties) {
96
+ popViewController(animated: true)
97
+ } else if isRefresh(properties) {
98
+ session.reload()
99
+ } else if isNone(properties) {
100
+ // Will result in no navigation action being taken
101
+ } else if isReplaceAll(properties) {
102
+ setViewControllers([viewController], animated: false)
103
+ } else if isReplace(properties) || action == .replace {
104
+ setViewControllers(Array(viewControllers.dropLast()) + [viewController], animated: false)
105
+ } else {
106
+ pushViewController(viewController, animated: animated)
107
+ }
108
+ }
109
+
110
+ private func visit(viewController: UIViewController, with options: VisitOptions, modal: Bool = false) {
111
+ guard let visitable = viewController as? Visitable else { return }
112
+
113
+ // Each Session corresponds to a single web view. A good rule of thumb
114
+ // is to use a session per navigation stack. Here we're using a different session
115
+ // when presenting a modal. We keep that around for any modal presentations so
116
+ // we don't have to create more than we need since each new session incurs a cold boot visit cost
117
+ if modal {
118
+ modalSession.visit(visitable, options: options)
119
+ } else {
120
+ session.visit(visitable, options: options)
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,20 @@
1
+ import UIKit
2
+ import Turbo
3
+
4
+ final class ViewController: VisitableViewController, ErrorPresenter {
5
+ override func viewDidLoad() {
6
+ super.viewDidLoad()
7
+
8
+ view.backgroundColor = .systemBackground
9
+
10
+ navigationItem.backButtonDisplayMode = .minimal
11
+
12
+ if presentingViewController != nil {
13
+ navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: #selector(dismissModal))
14
+ }
15
+ }
16
+
17
+ @objc func dismissModal() {
18
+ dismiss(animated: true)
19
+ }
20
+ }
@@ -0,0 +1,8 @@
1
+ import UIKit
2
+
3
+ @main
4
+ class AppDelegate: UIResponder, UIApplicationDelegate {
5
+ func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
6
+ return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
7
+ }
8
+ }