Skip to content
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

Getting podspec details from package information #591

Merged
merged 1 commit into from
Mar 13, 2019
Merged

Getting podspec details from package information #591

merged 1 commit into from
Mar 13, 2019

Conversation

maestor
Copy link
Contributor

@maestor maestor commented Mar 13, 2019

For example version is now hardcoded antique 0.21.5. So why not get needed details from package.json and those are always up-to-date.

Description

Fixed podspec to be more dynamically.

Compatibility

OS Implemented
iOS ✅❌
Android ✅❌
Windows ✅❌

Checklist

  • I have tested this on a device/simulator for each compatible OS (tested that app with device-info dependency runs and works normally with iOS simulator after change)
  • I mentioned this change in CHANGELOG.md.

For example version is now hardcoded antique 0.21.5. So why not get needed details from package.json and those are always up-to-date.
@mikehardy
Copy link
Collaborator

I will quickly admit I am very new to iOS development. This looks very clean and simple though. May I ask what steps you took to test that it worked, and what results I should expect before and after your change so I can reproduce that it works as intended?

@maestor
Copy link
Contributor Author

maestor commented Mar 13, 2019

I have project where that library is one dependency. Since pods are default way to go with React Native and iOS dependencies sooner than later (react-native-community/discussions-and-proposals#104, first issue), I have move everything I easily could installed with cocoapods.

In this case:

  1. Replace react-native-device-info's podspec from node_modules with that PR one
  2. go to project ios folder
  3. rm -rf Pods Podfile.lock, then pod install (there is probably better ways to clean Pods project than delete Podfile.lock but it works)
  4. Check from installation output that pod get installed with correct version:
...
Fetching podspec for `RNDeviceInfo` from `../node_modules/react-native-device-info`
Installing RNDeviceInfo (0.29.1)
...
Pod installation complete! There are 21 dependencies from the Podfile and 33 total pods installed. (numbers from my project)
  1. Check diff from Podfile.lock, RNDeviceInfo version and checksum should be changed:
-  - RNDeviceInfo (0.21.5):
+  - RNDeviceInfo (0.29.1):

-  RNDeviceInfo: e7c5fcde13d40e161d8a27f6c5dc69c638936002
+  RNDeviceInfo: a80e94f282c91e3b3a7d4ae75ed68b11479474b8
  1. Run app with iOS Simulator, go somewhere where you use react-native-device-info and notice that a) app won't crash, b) used method returns value as expected

I'm not very familiar too with native side (especially iOS) and don't know if this changed really anything with how this library behaviour when you use it, looks like pods have worked with wrong version number too just fine. I have just noticed that if I upgrade react-native-device-info, it won't install Pod with new version like it will do (mainly) with other dependencies I use, so checked what is wrong here and find that reason is hardcoded version in podspec which won't follow librarys version 🙂

@machour
Copy link
Contributor

machour commented Mar 13, 2019

Awesome, thank you!
This will be shipped in the next release when it's due.

@machour machour merged commit 2dfa809 into react-native-device-info:master Mar 13, 2019
@maestor maestor deleted the patch-1 branch March 13, 2019 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants