Added configurable requiresExternalPower and requiresNetworkConnectivity params
Added support to configure this params, fixing this issue: https://github.com/transistorsoft/transistor-background-fetch/issues/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.
Not bad.
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.
Ok, fixed the issue but now _CodeSignature folder got deleted, not sure if this is an issue
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.
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'
@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.
@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
@christocracy any updates on this?
@christocracy ping
@christocracy The implementation of this feature would be very helpful.
@christocracy fixed conflicts