Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Make react-native-config work with white labels
During build phase, `react-native-config` generates a `.BuildConfig` class from the project `.env` file Then on runtime, it will try to reconstruct this classe name by querying its package name from app's resources using the following code ```java int resId = context.getResources().getIdentifier("build_config_package", "string", context.getPackageName()); className = context.getString(resId); ``` This would work only if the app's `packageId` and `namespace` are the same But since we implemented the new white label mechanism, those values can now be different. This is the case for the MaBulle version that has `io.cozy.flagship.mobile.mabulle` as package name but `io.cozy.flagship.mobile` as namespace In the previous code, the resource would be searched in `getPackageName()` which would return the `packageId` but the resource would be stored in the `namespace`, so `build_config_package` would not be found The result is that the app won't find any config value (i.e. Safetynet API key and Sentry auth token) To fix that we add a new instruction in the `build.gradle` file to set `build_config_package` in the `packageId` too As our white label mechanism always set `io.cozy.flagship.mobile` as `namespace`, so we use this value for `build_config_package` Related commit: d08fd4b
- Loading branch information