I am trying to teach myself Xamarin forms but am having a hard time wrapping my head around how activities and shared code interact with the application specific MVVM.. from what I can gather the model part can be accessed from both the viewmodel and say the main activity, and in turn main activity can access shared code? It feels like all the reference documents are missing out the relationship with activities and shared code?
So if I wanted to make an app that could scan an NFC tag and relay that info to a REST service I would need to create a shared code object API client, platform specific NFC (mainactivity.cs?) And then bind to a model to put data onto the UI?
The aim for MVVM is complete isolation between business logic, UI and data models.
So, given your scenario, you would create your android view, most likely in AXML. Any logic you would generally do in an Android activity, would be done in a ViewModel, in shared code.
You would then create the REST API client connectivity in shared code, perhaps under a services folder for example. As this is functionality that does not need to be platform specific. All platforms can use this as is.
From the ViewModel you can then call the REST API and populate your models, which will be called from the views - ie. the activity will have reference to the ViewModel and any Models the ViewModel contains.
When it comes to your NFC scenario, you will write NFC methods in the ViewModel, you will then use something like Dependency Service to determine the platform, which will then run the NFC logic, written in each platforms project.
This then means that when you introduce iOS or other platforms, you can re-use that Model and ViewModel, which will then call the NFC logic written in the iOS project.
Related
I'm very new to React Native (did some courses) and now building my first app on my own which is going great, but I need some advice regarding user applied filters and how to handle this.
Quick summary of what needs to be done.
The user should be able to set some filters so only certain data is displayed and this state is saved even after closing the application, user logs in again and still sees only the data that is filtered because of the filter option he/she set before.
In one of my courses I got an introduction into Redux and my question here is should I use Redux for this feature or maybe Context for this ? My data is fetched from Firestore and I'm able to use a query to filter data from firestore but that just ends up in many read/writes which cost money.
All advice is more than welcome!
use redux
when you need some static state globally in your app then use context like open close drawer etc. For dynamic states go for redux
As mentioned in stackoverflow answer :
As Context is no longer an experimental feature and you can use
Context in your application directly and it is going to be great for
passing down data to deeply nested components which is what it was
designed for.
As Mark Erikson has written in his blog:
If you're only using Redux to avoid passing down props, context could
replace Redux - but then you probably didn't need Redux in the first
place.
Context also doesn't give you anything like the Redux DevTools, the
ability to trace your state updates, middleware to add centralized
application logic, and other powerful capabilities that Redux enables.
Redux is much more powerful and provides a large number of features
that the Context API doesn't provide, also as #danAbramov mentioned
React Redux uses context internally but it doesn’t expose this fact in
the public API. So you should feel much safer using context via React
Redux than directly because if it changes, the burden of updating the
code will be on React Redux and not you.
It's up to Redux to actually update its implementation to adhere with
the latest Context API.
The latest Context API can be used for Applications where you would
simply be using Redux to pass data between components, however
applications which use centralized data and handle API requests in
Action creators using redux-thunk or redux-saga still would need
Redux. Apart from this Redux has other libraries associated with it
like redux-persist which allows you to save/store data in localStorage
and rehydrate on refresh which is what the Context API still doesn't
support.
You can refer to the blog1 and blog2 in order to get more clarity on when to use redux and context.
I am new to IMIS which is an Engagement management system with membership handling inbuilt. I need some inputs about the business process automation in IMIS. I see IMIS does not allow creating stored procedures to clients using IMIS cloud hosting. This seems to be a concern as every business has simple to complex processes and many processes updates data too. I am surprised to see that IMIS does not have a proper workflow builder (GUI based) where one can select as if some Business object is updated/created or have some value X then "update" some other business object/data i.e update the database table with specific values.
Best example if I want to use a custom Membership numbers (autonumbers) then I cannot do that. I cannot update table data via IMIS "process automation". IMIS "process builder" offers very limited functionality. It do allows calling stored procedure via it but what is the use of it as we cannot create a stored procedure in IMIS. IMIS does allow calling 3rd party REST api via process automation too for particular trigger. With in IMIS there is no way to add custom code handling or custom process handling or a UI based workflow with if/else (a BPM which is available in Salesforce, Zoho and other CRM).
SO I want to know if there is any IMIS consultant here then please guide me how do you suggest handling complex business process automations ? I know IMIS allows REST API but that means I need to write a custom code to handle the process automation and it also means I need to do it outside of IMIS cloud. I just need a confirmation that business process need to be handled via customization outside IMIS through an external system. The external system will get data from IMIS, make the data changes and push it back to IMIS via API. I can build it but before doing so I am trying to make sure I am not missing something which is inside in IMIS (99% sure it cannot be done inside IMIS)
I also believe IMIS does not have webhooks as well as there is no menu to configure the same in IMIS. Please guide on this.
Please do not point me back to "process automation" menu or feature of IMIS as I am aware of it and its limitation too. I have explained its limitation above after checking with the IMIS support desk.
Nope, you can't do complex workflows in iMIS cloud (yet, as of July 2022). No web hooks either. Both of these requirements can be covered with a cloud based RPA solution.
So I have been working with Ethereum's metamask, and implemented web app where the user can come while being logged into metamask, and call a function on my smart contract via metamask. Tutorials for this exist and it's not very hard.
I want to implement calling a smart contract, when a user comes into a store ([physically). I want to do it the following way:
Some customer comes in and uses some application $A on his phone, which may be a wallet app or some other application that has access to his ethereum wallet.
On my POS application, I will render a QR code.
When he scans the QR code with his mobile phone, it is equivalent to either:
sending ethereum funds to our company account, while I am able to verify that this has happened via an event, or
he calls a function on a smart contract. This seems more appealing because I know that you can send events via smart contract calls.
So my question is:
Do any applications that have the functionality of application $A exist, are they widely used?
What can I use to implement exposing a QR code which is effectively some form of visual API for my program?
What you need is a library in your application to create a QR code. This QR code will need to be created for the function/method you need to call on the smart contract. You can use https://github.com/jibrelnetwork/ethereum-qr-code/blob/master/README.md
The QR code will be scanned by the user using the wallet on their mobile phone app wallet. This transaction will trigger the smart contract function and allow your application to proceed forward.
Hope this helps.
Cheers,
Answer to Q1:
Yes, there are applications like this(i made one myself). Most existing mobile wallets use this approach, for eg. Tenx.
Answer to Q2:
Sorry but this question is not totally clear to me. Are you asking for some sort of library for creating a QR code?
My company has a 3rd party web service we are designing a front end for. The "objects" used by this web service are very large (and variable depending on the number of sub-entities created). The web service does not expose methods to commit/load sub-entities, only the full object hierarchy.
The UI itself is split into many sub screens, and master/detail views to be able to efficiently/easily edit the large amount of data.
The issue is where to store all the data you aren't currently looking at.
Doing the web service commit takes up to 30 seconds for large records, so it is not feasible to use the web service for the intermittent data storage.
You can consider using .Net's SessionState out of the box, with the SQL persistence mode to cache the web service data, although you do need to ensure that you have a strategy to clear out expired data from the database. All objects stored in SessionState will need to be Serializable.
Also, instead of using the external web service's entity structure (e.g. the serializable proxy entities generated by a .Net added Service Reference), you should also
consider building your own customized class hierarchy for your screens (i.e. custom view models), and then build the bridging to map / project the web service graph to your viewmodel after the initial fetch from the web service, and then back again to the web service entities after the user has finished updating the graph. LINQ is great for this purpose, or possibly AutoMapper, if you haven't deviated from the web service class and property naming standards.
I'm not really sure how to best word this. We have an ASP.NET web application with the backend services accessible over a WCF service layer. We need to add some reporting/dashboard type bits to the web application.
To make it scalable the data needed for the reporting needs to be calculated on the backend. I'm just wondering if there is a recommended way to pass this data around. It doesn't make much sense to have different service methods to get the different bits of data, it feels like it should be summarised already.
I had a look at WCF Data Services, but that seems more for retrieving full object trees. Maybe some sort of XML document so extra items can be added to the summary without needing service layer changes?
The data would be things like number of orders today, number of orders specific to the person running it, open orders outstanding etc.
Does anyone have any pointers?
Thanks for your time
You can look at something like ASP.NET Web API and use an XML Formatter for your data. You can use ViewModels to flatten your data and send over the wire to your web app to bind to grids or whatever you need to.
Basically you would get request (filters, keywords, etc) from your web app, send the parameters to your reporting back-end, retrieve the reporting data, map the values to your ViewModels and serialize them using Web API. Using Web API you can use all kinds of formatters for your data to XML, CSV and JSON to vCard, iCal, PDF, etc...
You can read more about it here: http://www.asp.net/web-api