Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(managed-config): Add Managed Config plugin (@config-plugins/mana… #228

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gvanderclay
Copy link

@gvanderclay gvanderclay commented Mar 8, 2024

Why

The motivation behind this PR is to provide Expo developers with a way to configure their apps for Mobile Device Management (MDM) solutions. Managed are used in apps deployed in enterprise environments, allowing IT administrators to remotely manage and configure settings within an app for users within their organization. It can be complimented with react-native-emm or react-native-mdm to integrate MDM features.

This PR introduces the @config-plugins/managed-config to @expo/config-plugins to allow MDM configuration support without being tied to a specific library.

Relevant issues and requests:

How

The @config-plugins/managed-config plugin was developed following the Expo Config Plugin system's guidelines, leveraging the Android Managed Configurations XML resource file to declare app restrictions. It parses a given set of restrictions defined in the app.json or app.config.js under the plugin options and generates the corresponding XML file at build time, which is then included in the final Android app bundle.

The plugin supports all documented restriction types (e.g., bool, string, integer, choice, multi-select, hidden, bundle, and bundle_array).

Test Plan

The plugin has been thoroughly tested with a series of unit tests covering each restriction type (bool, string, integer, choice, multi-select, hidden, bundle, bundle_array). These tests validate the XML generation logic, ensuring that the output matches the expected configuration for a given set of restrictions.

Additional manual testing was performed using the apps/app project and validating that the app_restrictions file was added, and the android manifest was modified correctly.

@gvanderclay gvanderclay force-pushed the @gvanderclay/managed-config branch 2 times, most recently from 39f0e78 to 8d49fdf Compare March 8, 2024 22:23
@gvanderclay gvanderclay marked this pull request as ready for review March 8, 2024 22:27
Copy link

@ddekkers ddekkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to compile the module correctly to js, path and fs should be named imports, I think

Comment on lines +7 to +8
import fs from "fs";
import path from "path";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import fs from "fs";
import path from "path";
import * as fs from "fs";
import * as path from "path";

Comment on lines +8 to +9
import fs from "fs";
import path from "path";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import fs from "fs";
import path from "path";
import * as fs from "fs";
import * as path from "path";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants