Which library is better for offline support: redux-offline or react-native-offline? - react-native

Need suggestion on which library to use for a large react native mobile app using redux ? redux-offline or react-native-offline ?
I need to regularly check connection status, render view depending on the connection status, add actions to queue when offline and run them when online, cancel actions if some contradiction is there, and persist/rehydrate data offline.

I am using redux-offline in my react-native project, it works just great. The feature that you are looking for all are presents like
It regularly checks for connection status
Add action to offline anytime (online \ offline)
Run the action as soon as device became online (moreover, you can decide the retry interval)
You can write your own discard method to drop any action based on your business requirement.
It uses redux-persist which automatically persist\rehydrate data. Also, you can provide your own store mechanism.
redux-offline is working just great for me, Sorry, I haven't used react-native-offline yet so can't provide you any benchmark.

I would suggest going for react-native-offline.
React-native-Offline provides :
Easier queue handling for actions based on a regex expression or a list of actions
Auto Triggering the online only actions , once the network is back.
Your Saga looks cleaner and readable, with both online/offline cases , on a maintenance perspective.
Redux-Offline provides:
It basically on separate online and offline actions
Each action and associated rollback needs to be handled
Both provides the redux-presist with connectors of your preference.

I have evaluated both, and for my use case I decided to go with react-native-offline. I liked its integration and ease of setup with redux-sagas, and it's offlineQueue was very convenient to have when you expect your users to conduct many operations offline.

Related

Offline notification with nuxt/pwa

I am currently looking through the options of creating an offline indication for the nuxt/pwa project. Since this moment, app is running perfectly offline, but what I want to do is to push a small notification when there is no connection saying something simple such as "you are currently offline".
I can see that there are multiple ways of doing this such as writing the event listener directly in the default layout, but my question is which one is the most suitable and reliable for the nuxt setup.
I think you don't need to write your own event listener, as this seems to be taken care of by the nuxt already. The network status seems to be accessible via $nuxt helper's isOnline and isOffline properties. Check out this example:
https://nuxtjs.org/api/$nuxt/
I have not worked with this yet, but I think it might be what you are looking for.
Note: Make sure to copy the whole link, as stackoverflow cuts it off at /$nuxt.

How to delete Operation(s) with Java SDK

It seems that in the Java SDK it is not implemented to delete Operations. The REST API supports it. So I'm wondering if I miss something or if this is the case.
Are there any workaround except using a REST Client to delete Operation(s) in a Java Application?
No, currently not (but feel free to send a pull request with an added method).
As background, operations should usually not be deleted by clients, but instead cycled through their process (pending -> executing -> successful/failed). If you delete an operation, it will be not available anymore and you cannot reproduce what happened on a device at a particular point in time. Deletion is usually taken care of by data retention management.
The easiest way to use an API that is not implemented in the client is calling the rest() method on your platform object.
This will return you the underlaying RestConnector for all API (fully initialised with credentials) and you can execute the calls with it (kind of manually).

How to auto-refresh a screen in Moqui?

Use case is a regularly updated display of vehicle tracking data retrieved through a REST call, onto a central office screen, with no user interaction.
There is no single answer for this, but some alternatives to consider:
add some JavaScript to your screen that uses the JS setTimeout() method or something similar to reload the page
for a smoother result but a lot more effort write the section of the screen that needs to auto-update as a Vue component and use the standard websocket interface to send data to the browser to update the data in the HTML; this is generally best done using the NotificationMessage interfaces and methods in the Moqui API where the JavaScript client registers on a topic and gets a notification along with any others registered (structure the topic ID as needed to differentiate different feeds) and have a scheduled service job feed the notification topic

Can you have automated regression/integration tests for Azure Logic Apps?

Can you have automated regression/integration tests for Azure Logic Apps?
And if you can, how? ... especially in the context of CI/CD builds and deployments
... and if you can't, why not!!
There isn't any out-of-the-box tooling yet to provide automated testing of Azure Logic Apps. We have a few customers who have followed one of the following patterns. There is also this article that goes into detail on how to create a Logic App deployment template:
After deployment (using a release management tool like Visual Studio Release Management), a series of unit tests are run (writtin in something like C#) to test the Logic App.
Since a logic app could have any kind of trigger (on queue item, on HTTP request), the code usually performs the action and asserts the result.
A logic app in the resource group that can run a series of basic tests in a workflow. This one requires a bit more chewing on, but idea being you have a workflow that makes use of connectors or "calling nested apps" to perform basic validation tests (ensure connections are active, etc.)
It's something we have had discussions on from time-to-time, but would love to know if you have any thoughts on what types of tooling/configuration you'd want to configure for an app (remember that some apps "trigger" on something like a message in a queue or a file in FTP).
I would like to share one of the approach for LogicApp testing that my team has followed.
First level of validation is the ARM template deployment status (ProvisioningState) which should not have any errors.
After that we have developed test automation using the logic app sdk which does the following
Get auth token.
Execute a specific logic app trigger with a synthetic transaction.
Waits till the execution is completed.
Gets logic app & its action status (succeed, failed or skipped), validates it as per the expected scenario.
Gets the outputs from each action execution, validates them against an expected scenario.
Repeat above steps for all the various cases that logic app might go through.
Hook this all-in CI/CD :)
Deployed an LA, ran a synthetic transaction & validated the results.
Hope this helps.

Porting PHP API over to Parse

I am a PHP dev looking to port my API over to the Parse platform.
Am I right in thinking that you only need cloud code for complex operations? For example, consider the following methods:
// Simple function to fetch a user by id
function getUser($userid) {
return (SELECT * FROM users WHERE userid=$userid LIMIT 1)
}
// another simple function, fetches all of a user's allergies (by their user id)
function getAllergies($userid) {
return (SELECT * FROM allergies WHERE userid=$userid)
}
// Creates a script (story?) about the user using their user id
// Uses their name and allergies to create the story
function getScript($userid) {
$user = getUser($userid)
$allergies = getAllergies($userid).
return "My name is {$user->getName()}. I am allergic to {$allergies}"
}
Would I need to implement getUser()/getAllergies() endpoints in Cloud Code? Or can I simply use Parse.Query("User")... thus leaving me with only the getScript() endpoint to implement in cloud code?
Cloud code is for computation heavy operations that should not be performed on the client, i.e. handling a large dataset.
It is also for performing beforeSave/afterSave and similar hooks.
In your example, providing you have set up a reasonable data model, none of the operations require cloud code.
Your approach sounds reasonable. I tend to put simply queries that will most likely not change on the client side, but it all depends on your scenario. When developing mobile apps I tend to put a lot of code in cloud code. I've found that it speeds up my development cycle. For example, if someone finds a bug and it's in cloud code, make the fix, run parse deploy, done! The change is available to all mobile environments instantly!!! If that same code is in my mobile app, it really sucks, cause now I have to fix the bug, rebuild, push it to the app store/google play, wait x number of days for it to be approved, have the users download it... you see where I'm going here.
Take for example your
SELECT * FROM allergies WHERE userid=$userid query.
Even though this is a simple query, what if you want to sort it? maybe add some additional filtering?
These are the kinds of things I think of when deciding where to put the code. Hope this helps!
As a side note, I have also found cloud code very handy when needing to add extra security to my apps.