-
Notifications
You must be signed in to change notification settings - Fork 37
feat: add example Rock app #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Juozas-Petkelis
wants to merge
9
commits into
callstack:main
Choose a base branch
from
Juozas-Petkelis:feat/rock-example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4f6c547
feat: add rock app
Juozas-Petkelis 90b99ba
feat: rename rockappreact to brownfieldlib
Juozas-Petkelis 5c54e08
feat: update rock template to RN 85
Juozas-Petkelis a9e2d5d
feat: add rock app to prepare framework script
Juozas-Petkelis d6db967
feat: prepare frameworks for rock app
Juozas-Petkelis 1fdbee7
feat: extract shared UI for vanilla and rock app
Juozas-Petkelis d7c21fa
feat: added rock actions
Juozas-Petkelis 0945f67
feat: added rock cli commands to readme
Juozas-Petkelis 3295c91
feat: home screen adjustments
Juozas-Petkelis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
.../AndroidApp/app/src/rock/java/com/callstack/brownfield/android/example/BrownfieldStore.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package com.callstack.brownfield.android.example | ||
|
|
||
| typealias BrownfieldStore = com.callstack.rnbrownfield.demo.rockapp.BrownfieldStore | ||
| typealias User = com.callstack.rnbrownfield.demo.rockapp.User |
6 changes: 6 additions & 0 deletions
6
...oidApp/app/src/rock/java/com/callstack/brownfield/android/example/ReactNativeConstants.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package com.callstack.brownfield.android.example | ||
|
|
||
| object ReactNativeConstants { | ||
| const val MAIN_MODULE_NAME = "RockApp" | ||
| const val APP_NAME = "Android" | ||
| } |
9 changes: 9 additions & 0 deletions
9
...dApp/app/src/rock/java/com/callstack/brownfield/android/example/ReactNativeHostManager.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.callstack.brownfield.android.example | ||
|
|
||
| import android.content.res.Configuration | ||
|
|
||
| typealias ReactNativeHostManager = com.callstack.rnbrownfield.demo.rockapp.ReactNativeHostManager | ||
|
|
||
| fun ReactNativeHostManager.onConfigurationChanged(application: android.app.Application, newConfig: Configuration) { | ||
| // no-op that is prepared to match of the Expo ReactNativeHostManager | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
.../Brownfield Apple App.xcodeproj/xcshareddata/xcschemes/Brownfield Apple App Rock.xcscheme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Scheme | ||
| LastUpgradeVersion = "2640" | ||
| version = "1.7"> | ||
| <BuildAction | ||
| parallelizeBuildables = "YES" | ||
| buildImplicitDependencies = "YES" | ||
| buildArchitectures = "Automatic"> | ||
| <BuildActionEntries> | ||
| <BuildActionEntry | ||
| buildForTesting = "YES" | ||
| buildForRunning = "YES" | ||
| buildForProfiling = "YES" | ||
| buildForArchiving = "YES" | ||
| buildForAnalyzing = "YES"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "793C76A62EEBF938008A2A34" | ||
| BuildableName = "Brownfield Apple App.app" | ||
| BlueprintName = "Brownfield Apple App" | ||
| ReferencedContainer = "container:Brownfield Apple App.xcodeproj"> | ||
| </BuildableReference> | ||
| </BuildActionEntry> | ||
| </BuildActionEntries> | ||
| </BuildAction> | ||
| <TestAction | ||
| buildConfiguration = "Debug Expo" | ||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| shouldUseLaunchSchemeArgsEnv = "YES" | ||
| shouldAutocreateTestPlan = "YES"> | ||
| </TestAction> | ||
| <LaunchAction | ||
| buildConfiguration = "Debug Expo" | ||
| selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| launchStyle = "0" | ||
| useCustomWorkingDirectory = "NO" | ||
| ignoresPersistentStateOnLaunch = "NO" | ||
| debugDocumentVersioning = "YES" | ||
| debugServiceExtension = "internal" | ||
| allowLocationSimulation = "YES" | ||
| queueDebuggingEnableBacktraceRecording = "Yes"> | ||
| <BuildableProductRunnable | ||
| runnableDebuggingMode = "0"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "793C76A62EEBF938008A2A34" | ||
| BuildableName = "Brownfield Apple App.app" | ||
| BlueprintName = "Brownfield Apple App" | ||
| ReferencedContainer = "container:Brownfield Apple App.xcodeproj"> | ||
| </BuildableReference> | ||
| </BuildableProductRunnable> | ||
| </LaunchAction> | ||
| <ProfileAction | ||
| buildConfiguration = "Release Expo" | ||
| shouldUseLaunchSchemeArgsEnv = "YES" | ||
| savedToolIdentifier = "" | ||
| useCustomWorkingDirectory = "NO" | ||
| debugDocumentVersioning = "YES"> | ||
| <BuildableProductRunnable | ||
| runnableDebuggingMode = "0"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "793C76A62EEBF938008A2A34" | ||
| BuildableName = "Brownfield Apple App.app" | ||
| BlueprintName = "Brownfield Apple App" | ||
| ReferencedContainer = "container:Brownfield Apple App.xcodeproj"> | ||
| </BuildableReference> | ||
| </BuildableProductRunnable> | ||
| </ProfileAction> | ||
| <AnalyzeAction | ||
| buildConfiguration = "Debug Expo"> | ||
| </AnalyzeAction> | ||
| <ArchiveAction | ||
| buildConfiguration = "Release Expo" | ||
| revealArchiveInOrganizer = "YES"> | ||
| </ArchiveAction> | ||
| </Scheme> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Run Script Build Phase invoked by the "Brownfield Apple App" target after | ||
| # the standard "Embed Frameworks" phase. | ||
| # | ||
| # When the host RN project is RockApp, the dynamic BrownfieldLib.dylib | ||
| # produced by `rock package:ios` has @rpath load commands for | ||
| # React.framework and ReactNativeDependencies.framework. They must be | ||
| # embedded in the .app bundle or the app crashes on launch with | ||
| # "Library not loaded: @rpath/React.framework/React". | ||
| # | ||
| # `prepareXCFrameworks.js --appName RockApp` drops these xcframeworks into | ||
| # `package/`. For Vanilla / Expo flavors they are absent (React core is | ||
| # statically linked into BrownfieldLib), so this script is a no-op then. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| PACKAGE_DIR="${SRCROOT}/package" | ||
| DEST_DIR="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" | ||
|
|
||
| EXTRA_XCFRAMEWORKS=( | ||
| "React.xcframework" | ||
| "ReactNativeDependencies.xcframework" | ||
| ) | ||
|
|
||
| if [[ "${PLATFORM_NAME}" == iphonesimulator* || "${PLATFORM_NAME}" == macosx* ]]; then | ||
| PRIMARY_SLICE="ios-arm64_x86_64-simulator" | ||
| FALLBACK_SLICES=("ios-arm64-simulator") | ||
| else | ||
| PRIMARY_SLICE="ios-arm64" | ||
| FALLBACK_SLICES=("ios-arm64_x86_64-maccatalyst") | ||
| fi | ||
|
|
||
| resolve_slice_dir() { | ||
| local xcframework_path="$1" | ||
| for candidate in "${PRIMARY_SLICE}" "${FALLBACK_SLICES[@]}"; do | ||
| if [[ -d "${xcframework_path}/${candidate}" ]]; then | ||
| echo "${xcframework_path}/${candidate}" | ||
| return 0 | ||
| fi | ||
| done | ||
| return 1 | ||
| } | ||
|
|
||
| mkdir -p "${DEST_DIR}" | ||
|
|
||
| for xcframework in "${EXTRA_XCFRAMEWORKS[@]}"; do | ||
| XC_PATH="${PACKAGE_DIR}/${xcframework}" | ||
| if [[ ! -d "${XC_PATH}" ]]; then | ||
| echo "note: ${xcframework} not present in ${PACKAGE_DIR}, skipping (expected for Vanilla/Expo flavors)" | ||
| continue | ||
| fi | ||
|
|
||
| framework_name="$(basename "${xcframework}" .xcframework)" | ||
| if ! slice_dir="$(resolve_slice_dir "${XC_PATH}")"; then | ||
| echo "warning: no compatible slice for platform ${PLATFORM_NAME} in ${xcframework}; skipping" | ||
| continue | ||
| fi | ||
|
|
||
| src_framework="${slice_dir}/${framework_name}.framework" | ||
| if [[ ! -d "${src_framework}" ]]; then | ||
| echo "warning: ${src_framework} is missing; skipping" | ||
| continue | ||
| fi | ||
|
|
||
| dest_framework="${DEST_DIR}/${framework_name}.framework" | ||
| echo "Embedding ${framework_name}.framework from ${slice_dir}" | ||
| rm -rf "${dest_framework}" | ||
| cp -R "${src_framework}" "${dest_framework}" | ||
|
|
||
| if [[ "${EXPANDED_CODE_SIGN_IDENTITY:-}" != "" ]]; then | ||
| /usr/bin/codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" \ | ||
| ${OTHER_CODE_SIGN_FLAGS:-} \ | ||
| --preserve-metadata=identifier,entitlements,flags \ | ||
| "${dest_framework}" | ||
| fi | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should already be happening
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove - already addressed in merged #323