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

Added configurable requiresExternalPower and requiresNetworkConnectivity params #96

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

tudor07
Copy link

@tudor07 tudor07 commented Mar 17, 2020

Added support to configure this params, fixing this issue: transistorsoft/transistor-background-fetch#6

I am not familiar with Objective-C or the way to build a .framework and I am not sure what's with the _CodeResources folder, so please review these thoughtfully.

@christocracy
Copy link
Member

Not bad.

@tudor07
Copy link
Author

tudor07 commented Mar 17, 2020

Using my version via git dependency I get the following error: missing required architecture arm64 in file. So I think I messed up something regarding the way I built the .framework. Looking into it, as I said I am not familiar with Obj-C packages.

@tudor07
Copy link
Author

tudor07 commented Mar 17, 2020

Ok, fixed the issue but now _CodeSignature folder got deleted, not sure if this is an issue

@christocracy
Copy link
Member

Sorry, I can't accept this PR as-is. The plugin already has existing config options requiresCharging and requiredNetworkType (used by Android) which can be applied for iOS.

@christocracy
Copy link
Member

Also, you're sending null values to the native iOS side from toMapwhen those values are not provided.

{
  stopOnTerminate: false, 
  enableHeadless: true, 
  forceAlarmManager: true, 
  requiresExternalPower: null, 
  requiresNetworkConnectivity: null
}

Which crashes iOS.

'NSInvalidArgumentException', reason: '-[NSNull boolValue]: unrecognized selector sent to instance 0x7fff80618070'

@tudor07
Copy link
Author

tudor07 commented Mar 18, 2020

@christocracy
I think we can re-use requiresCharging param but nor sure about requiredNetworkType since it's an enum on Android and a bool on iOS. Do you think NetworkType.NONE should be false on iOS and anything else true? I would rather separate them because someone can get confused. For example someone may use NetworkType.CELLULAR thinking it would work on iOS also but the job will get executed even if there is wifi. What do you think?

Btw, regarding the second comment I initialise the variables to false, so that happens only if user explicitly passes null which is weird but I will provide a fix to treat that case also.

@tudor07
Copy link
Author

tudor07 commented Mar 18, 2020

@christocracy I pushed new commit where I re-use the requiresCharging param for iOS and fixed the requiresNetworkConnectivity: null crash. Still not sure about requiredNetworkType enum vs requiresNetworkConnectivity bool

@tudor07
Copy link
Author

tudor07 commented Mar 31, 2020

@christocracy any updates on this?

@tudor07
Copy link
Author

tudor07 commented Jun 4, 2020

@christocracy ping

@proninyaroslav
Copy link

@christocracy
The implementation of this feature would be very helpful.

@tudor07
Copy link
Author

tudor07 commented Aug 25, 2020

@christocracy fixed conflicts

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