Target Membership in React Native - react-native

I am involved to a project which is targeting multiple clients. We have to handle different client needs and so it can happen that a client wants to fully change a page in the application or they would like a different logic behind the screen. And of course we don't want to include one client's specific code to another code base, so separate our code with a kind of global variables is not an option.
On iOS it was really straightforward that we had to add a new target and select files to the target membership.
How we should handle it within a React Native project?
I found many articles about react-native-config, but it is just about the global variables, URLs and so on.

Related

Functionality to auto pick up the call using expo react native

As part of a project I'm developing an application for the care of people with cognitive disorders, it may happen that such a person forgets where he put his phone. Therefore, it needs functionality that will allow the phone to be automatically answered when a trusted number calls. I don't know what I could use to create such functionality.
I create the application using expo-react-native. I tried to use the expo-phone-call library, but I can't install it because it shows an error that such a library doesn't exist. On the other hand, when trying to use react-native-phone-call, I kept getting errors with importing things.

Initialize vuejs app

I'm very new to vuejs world and I'm trying to move my existing application to vuejs.
I use Laravel as a backend framework. I got a lot of entities and settings, and in order to the app to work properly I need to retrieve from server some necessary data like user role etc. So basically I need to:
Hide the whole app and show a loader instead
Make few ajax requests in order to retrieve data from server
Store the data somewhere, so that it's accessible everywhere in vuejs app
Hide loader and run the app
The data might be changed though, for example, I have a team and team members. The list of team members used in many places. So if I add a team member the team member list should be updated as well.
So I don't want to have a global javascript variable for storing such data, because any modifications in this variable should affect the data-binding and stuff.
How could I achieve this?
Thanks
Your use case seems appropriate to using Vuex.
From Vuex documentation:
Vuex is an application architecture for centralized state management
in Vue.js applications. It is inspired by Flux and Redux, but with
simplified concepts and an implementation that is designed
specifically to take advantage of Vue.js' reactivity system.
In other words, it is specifically designed to handle situations such as:
The data might be changed though, for example, I have a team and team
members. The list of team members used in many places. So if I add a
team member the team member list should be updated as well.

How to properly use Yii modules?

In Yii PHP framework, one has ability to create modules. As per Yii's official documentation here is definition of the module:
A module is a self-contained software unit that consists of models,
views, controllers and other supporting components. In many aspects, a
module is similar to an application. The main difference is that a
module cannot be deployed alone and it must reside inside of an
application. Users can access the controllers in a module like they do
with normal application controllers.
Let's say we have a huge aplication and we have to create front-end and backend. In this case, is it better to create frontend module, and backend module and use them, or it is better to implment frontend as one Yii application, and backend as second Yii application.
I'm asking this because if you look at Yii's 2 advance template, there three are different applications (common, backend, frontend), but they are not implemented as three different modules, and my question is why?
Is app is going to be slower when you use modules and what are pros and cons of using modules?
Yii2 advance template has 3 different applications however they are frontend, backend and console (not common).
is it better to create frontend module, and backend module and use them?
The answer is "it depends". Lets take some examples:
I have a "users" section in the backend that tells the system what can each user change in the backend. I use this in multiple applications with no change at all so I have created a user module that I can just insert wherever I want. It is the simplest module because I never use it for the frontend.
a blog module, the blog module is a little more complicated as it has a place to manage the blog (this part is in the backend) and the posts and comments shown in the front section (this part should be in the frontend). However I still want to be able to plug it in multiple applications. My solution was to create some folders in the actual module (I actually created the same structure frontend / backend / common). The logic is the same, in my website frontend I use what you find in the frontend folder of the module, the common holds the things that I use in both the frontend and backend (like some models) etc. Different application will use the same frontend controllers / widgets but make sure you allow the views to be changed.
The answer to use or not to use modules is actually the same answer to "Will I use this in other applications and can it function without the rest of the application?" A module should NOT be tight coupled with the rest of the application.
The idea of the modules in that they almost autonomous.
At the stage of application development you must highlight from it all stand-alone elements.
For example, I have a large CRM. I need a user module (includes all models associated with the user, controllers, display
components and their configuration - for example the rules of routes). There is also an administrative module.
There CRM module and a module for corporate events and meetings schedules.
And about 3-5 independent modules - for example internal communications module,access control module and module of electronic payments.
The convenience is that the all modules are self-contained. They have their own MVC- sets, sets of widgets and configurations.
And they can be moved from one project to another without much effort.
Here's another interesting modular system:
There are resource with various functionality. It can be divided into modules. Each module file should implement a modular interface (you need to write it).
For example, I want each module to provide its own widget for menu.(Drop-down list or just a button) and its own widget for dashboard.
Also in the module file specified access to various actions, etc.
There is a basic component,that prior to the step of rendering polls all modules at their regulated functionality and builds on its basis the menu, dashboard and other widgets.
The main thing with this approach, keep in mind, that everything that module provides must be prepared by the modular functionality(models, widgets) not to disrupt the modular autonomy.

What is the difference between component, extension & module in Yii

I am new to Yii framework, and just came across module, extension & component inside protected folder.
Can anyone please differentiate all these theoretically as well as practically also.
Components are the classes which can help you write the business logic on the basis of your models. Suppose all of your model files are using the same logic, So that logic can be written inside component instead of writing for each controller.
Extensions are like the libraries, which basically are not dependent on your models, and hence can be reused anywhere in current or later projects. For example writing any email extension.
Module is a self-contained software unit that consists of models, views, controllers and other supporting components. In many aspects, a module resembles to an application. The main difference is that a module cannot be deployed alone and it must reside inside of an application. Users can access the controllers in a module like they do with normal application controllers.
I hope it will help you.
Adding my 2 cents here...
Component
your own class file you want to do something with, specific to this site only. Examples are zip compression class in an uploader app, custom encryption algo for some security app
Extension
An external class file or group of files which are re-usable, often provided by 3rd parties. Examples are facebook connect library you or someone else built, api library from ebay.com to get listing, rss reader library to read from google etc.
Module
A mini- yii based site which serves as a subset of your site,can also be reusable in other applications or is build independent to make yii even more modular. Examples are , a forum module that is independant of the site but uses only logged in user info, a user authentication module which contains integration with several sites like openid, facebook and google

Changing provided services based on user preferences in OSX?

I would like to be able to change the OSX services that my application provides based on the current user's preferences (like adding more, changing the name,...). This basically means modifying the Info.plist (NSService key), but I don't think it is a good practice when an application modifies its own Info.plist while running, right? (At least based on few searches here). Is there any other option how to get this functionality?
I guess it should always be an external entity who does modify the Info.plist? So far I can only think about providing a system preference bundle which will do the modification in the actual app? Do you have any ideas?
Thank you
One way would be to install a service in ~/Library/Services that provides the services, and edit that application's Info.plist from your main application.
Of course, that should be an explicit action, so the user (hopefully) knows to delete the service if they delete your application. And you should document that procedure on your product's support web page, just in case they don't.
Here's a small twist to the previous recommendations, create a separate app that handles the service and bundle it within your Resources. When you want to enable the service, instead of copying the file over to ~/Library/Services, create a symbolic link within the ~/Library/Services folder that points to the app you bundled in your Resources.
This way if the user deletes your application, all that will be left behind is a symbolic link pointing to an invalid location. Does less arm than actually leaving the app behind and will have the added benefit that the service will no longer be available (since the info.plist will have been removed when the user deleted your app).