You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/09/16 11:00:10 UTC

[GitHub] [cordova-plugin-splashscreen] StefanRein commented on issue #193: Splash Screen Spinner Position

StefanRein commented on issue #193: Splash Screen Spinner Position
URL: https://github.com/apache/cordova-plugin-splashscreen/issues/193#issuecomment-531730483
 
 
   Thanks @pedrovitor074. 
   
   You could just add a hook and set the position then:
   
   **config.xml:**
   
   ```html
   <platform name="ios">
       <hook src="hooks/after_build/after_build_modify_ios_spinner_position_action.js" type="after_build" />
   </platform>
   ```
   
   **after_build_modify_ios_spinner_position_action.js**
   ```javascript
   #!/usr/bin/env node
   
   module.exports = function (context) {
       console.log("Preparing iOS spinner position correction");
       const fs = context.requireCordovaModule('fs');
       const pathToProject = 'platforms/ios/YOUR_PROJECT_NAME/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m';
       const pathToCDVSplashScreenFile = `${context.opts.projectRoot}/${pathToProject}`;
   
       fs.access(pathToCDVSplashScreenFile, fs.F_OK, (err) => {
           if (err) {
               console.error(err);
               return;
           }
   
           const dataRead = fs.readFileSync(pathToCDVSplashScreenFile, 'utf8');
           const newData = dataRead.replace('_activityView.center = CGPointMake(parentView.bounds.size.width / 2, parentView.bounds.size.height / 2);', '_activityView.center = CGPointMake(parentView.bounds.size.width / 2, parentView.bounds.size.height / 2 + 50);');
   
           fs.writeFileSync(pathToCDVSplashScreenFile, newData, 'utf8');
           console.log("Done preparing iOS spinner position");
       });
   };
   ```
   
   Make sure you replace the `YOUR_PROJECT_NAME`.
   Would be much better if someone would create a pull request and having the positions just in the config.xml file. But right now this works for me

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org