Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
fix(splash): Removes splash patches (#130)
Browse files Browse the repository at this point in the history
* Removes the git patches intended to implement splash screen behavior. This will be replaced by `ignite-splash` (available at https://github.com/infinitered/ignite-splash) once it is ready for release
  • Loading branch information
jamonholmgren authored Dec 6, 2018
1 parent adf0309 commit 64340d5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 35,442 deletions.
54 changes: 8 additions & 46 deletions boilerplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ async function install(context) {
overwrite: true,
matching: '!*.ejs'
})
filesystem.copy(`${__dirname}/boilerplate/patches`, `${process.cwd()}/patches`, {
overwrite: true,
matching: '!*.ejs'
})
spinner.stop()

// generate some templates
Expand Down Expand Up @@ -179,49 +175,15 @@ async function install(context) {
ignite.patchInFile(`${process.cwd()}/android/app/src/main/java/com/${name.toLowerCase()}/MainActivity.java`, {
after: `public class MainActivity extends ReactActivity {`,
insert: '\n @Override\n' +
' protected ReactActivityDelegate createReactActivityDelegate() {\n' +
' return new ReactActivityDelegate(this, getMainComponentName()) {\n' +
' @Override\n' +
' protected ReactRootView createRootView() {\n' +
' return new RNGestureHandlerEnabledRootView(MainActivity.this);\n' +
' }\n' +
' };\n' +
' }'
' protected ReactActivityDelegate createReactActivityDelegate() {\n' +
' return new ReactActivityDelegate(this, getMainComponentName()) {\n' +
' @Override\n' +
' protected ReactRootView createRootView() {\n' +
' return new RNGestureHandlerEnabledRootView(MainActivity.this);\n' +
' }\n' +
' };\n' +
' }'
})


// patch splash screen
async function patchSplashScreen() {
spinner.text = `▸ setting up splash screen`
spinner.start()
spinner.text = `▸ setting up splash screen: configuring`
// Grab the patches
const patchPath = `${process.cwd()}/patches/splash-screen/splash-screen.patch`
const iphoneXPatchPath = `${process.cwd()}/patches/splash-screen/iphonex-splash-screen.patch`
const patch = filesystem.read(patchPath)
const iphoneXPatch = filesystem.read(iphoneXPatchPath)

// Change some android configs in the main patch
const androidOldMainPathRegex = new RegExp('/android/app/src/main/java/com/SplashScreenPatch/MainActivity.java', 'g')
const androidNewMainPath = `/android/app/src/main/java/com/${name.toLowerCase()}/MainActivity.java`
const androidPatch = patch.replace(androidOldMainPathRegex, androidNewMainPath)

// Replace placeholder name with this projects actual name
const patchForNewProject = androidPatch.replace(/SplashScreenPatch/g, name)
const iphoneXPatchForNewProject = iphoneXPatch.replace(/SplashScreenPatch/g, name)
filesystem.write(patchPath, patchForNewProject)
filesystem.write(iphoneXPatchPath, iphoneXPatchForNewProject)

// Apply the patches
await system.run(`git apply ${patchPath}`, { stdio: 'ignore' })
await system.run(`git apply ${iphoneXPatchPath}`, { stdio: 'ignore' })

// Cleanup
spinner.text = `▸ setting up splash screen: cleaning`
filesystem.remove(`${process.cwd()}/patches/splash-screen`)
}
await patchSplashScreen()
spinner.stop()
} catch (e) {
ignite.log(e)
throw e
Expand Down
25 changes: 0 additions & 25 deletions boilerplate/patches/@types/react-native+0.55.12.patch

This file was deleted.

Loading

0 comments on commit 64340d5

Please sign in to comment.