Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Understanding Update/Install Lifecycle #125

Closed
jboothe opened this issue Mar 23, 2016 · 11 comments
Closed

Understanding Update/Install Lifecycle #125

jboothe opened this issue Mar 23, 2016 · 11 comments

Comments

@jboothe
Copy link

jboothe commented Mar 23, 2016

First I must say I’m loving CHCP!

I have some questions that may help clarify the update cycle in my mind.

Does fetchUpdate occur only on startup?

  • Regardless of what I set the update property to (startup, resume, now), the app will only install the new update when I close and restart the app.
  • However, I have been able to get the app to update and install while the app is open only by manually triggering the fetchUpdate followed by installUpdate.

So the question is, how do I get the app to update & install on resume?

Also, are there any disadvantages to setting "update": "now"? (other than the obvious - user is redirected to the index page)

All tests conducted on iPhone 6+.

@nikDemyankov
Copy link
Member

Does fetchUpdate occur only on startup?

Yes, at the moment automatically it fetches update only on startup. Right now there is no preference to define, when plugin should ping the server for update.

The update property in chcp.json is only for installation: when install the update.

  • startup - install it only when application is launched.
  • resume - install it when application is resumed from the background, or launched.
  • now - install immediately after fetching it from the server, or app launched.

The actual update should be loaded in order for these preferences to trigger the update. It is strange, that you could not make work resume properly, will check it out.

Also, are there any disadvantages to setting "update": "now"?

Maybe unexpected behaviour for the user. If he is on some internal page and plugin done loading update - now will result in instantly reloading app to the index page, which will be a surprise for the user. So, I think, this should be used only for development.

@jboothe
Copy link
Author

jboothe commented Mar 24, 2016

@nikDemyankov , I'm really digging your responsiveness. Thank you.

I want to give you more details of my config and workflow to see if we can zero in on the issue. I MUST submit to the app store Friday so I'm all in.

Base setup

  • S3 bucket setup
  • Not using cordova-hot-code-push-local-dev-addon
  • Note: not using ios-CFBundleVersion at this point.
// config.xml
<widget id="com.fun.app"
  version="1.9.0"
...
<chcp>
    <config-file url="http://app.fun.com/chcp.json"/>
  </chcp>
// cordova-hcp.json  
{
  "name": "FunApp",
  "s3bucket": "app.fun.com",
  "s3region": "us-west-1",
  "ios_identifier": "FunApp",
  "android_identifier": "com.fun.app",
  "update": "now",
  "content_url": "https://s3-us-west-1.amazonaws.com/app.fun.com"
}

Deployed base app to iPhone

> ionic build ios
> ionic run ios

Release 1

// chcp.json - same as cordova-hcp.json except "release" property has timestamp
{
  "name": "FunApp",
  ...
  "release": "2016.03.24-01.00.00"
}
// config.xml
<widget id="com.fun.app"
  version="1.9.1"
...

Deploy to iPhone and S3

> ionic build ios
> ionic run ios

Then I pushed everything to S3

> cordova-hcp build www
> cordova-hcp deploy

iPhone Behavior Release 1

  • The only way I could get the CHCP to update was by closing/re-opening the app.
  • App would not update on resume even when "update" property set to "resume".
  • Performing an > ionic build ios and ionic run ios would not show up on the iPhone
  • iPhone would only show new build by > cordova-hcp build and > cordova-hcp deploy

Release 2

Made changes to index.html and styles.css

// chcp.json  - same as release 1 except `release` property updated. 
{
  "name": "FunApp",
  ...
  "release": "2016.03.24-02.00.00"
}

Note: Now using ios-CFBundleVersion="1"

// config.xml
<widget id="com.onegreatevent.snf.dev"
  version="1.9.2"
  ios-CFBundleVersion="1"
...

Deploy to S3

> cordova-hcp build www
> cordova-hcp deploy

iPhone Behavior Release 2

  • Again app would update only with a close/re-open
  • The index.html page would NOT update
  • The styles.css changes DID update

At this point I:

  • verified index.html on S3 was indeed the new file.
  • in chcp.manifest listing, verified hash for index.html had changed from the previous version

So index.html is either not coming down to the device or the device is hanging onto the old index.html. But strangely, all other new files are updated!? I think this is related to issue #99 as well.

What tests would you recommend to validate/clarify these issues.

Thanks again! ☀️

@nikDemyankov
Copy link
Member

In you project's directory try to open platforms/ios/<YOUR_PROJECT_NAME>.xcodeproj file in the Xcode. Then run the app from it on your device/emulator and look into xcode logs. Maybe you will see there some error message.

For now I tried both of your setups (locally, without S3) and it worked fine :(

@jboothe
Copy link
Author

jboothe commented Mar 25, 2016

Thanks, Nik.

So my workflow looks ok?

Should the original submission to the App Store include ios-CFBundleVersion?

Does the updater only pull down the changed files?

BTW, I have been running the app thru Xcode and seen no errors. I'm going to start fresh- delete all bucket files, and zero everything out. I'll let you know.

@nikDemyankov
Copy link
Member

So my workflow looks ok?

Yes, looks okey.

Should the original submission to the App Store include ios-CFBundleVersion?

Yes, I think it is required anyway by the apple.

Does the updater only pull down the changed files?

Yes, it downloads only changed files.

BTW, I have been running the app thru Xcode and seen no errors. I'm going to start fresh- delete all bucket files, and zero everything out. I'll let you know.

Good, let me know the results :)

@barocsi
Copy link

barocsi commented May 1, 2016

cordova-hcp build overwrites my chcp.json and eliminates all properties only this remains:

{
  "autogenerated": true,
  "release": "2016.05.01-21.24.08"
}

why?

@barocsi
Copy link

barocsi commented May 1, 2016

#16 says something about it, however it is not clear in the docs.

@nikDemyankov
Copy link
Member

Yes, my bad, need to add this in the docs. Just create cordova-hcp.json file in the project's root folder and add your properties in there. When you execute cordova-hcp build - it will take contents of that file and use it for generating chcp.json in the www/ folder. Otherwise - CLI client doesn't have a default config and just creates a new one on each build.

@pablomaurer
Copy link
Contributor

Nik, some days ago I felt like updating the files through your plugin works great, but breaks normal update path.

Update Path 1 (plugin)

  • changed style.css
  • cordova-hcp build
  • updated and -> style.css updated

Update Path 2 (standard)

  • changed style.css
  • cordova-hcp build
  • ionic build
  • opened xcode and clicked run -> style.css did not update (only native stuff updated)

I need to test it again to be shure, but maybe you already know why what where this is coming from.

@pablomaurer
Copy link
Contributor

pablomaurer commented Jun 3, 2016

Ups forget it, that was the thing with comparing only integer instead of the whole version number... you already fixed. Just for the others see issue #99.

Haha what a bad brain...

@nordnet-deprecation-bot
Copy link
Contributor

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-hot-code-push anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #371 for more information.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants