Giter Site home page Giter Site logo

capawesome-team / capacitor-managed-configurations Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 465 KB

⚡️ Capacitor plugin to access managed configuration settings.

Home Page: https://capawesome.io/plugins/managed-configurations/

License: MIT License

Ruby 7.83% Java 37.12% Swift 28.19% Objective-C 6.63% JavaScript 3.87% TypeScript 16.37%
capacitor capacitor-plugin android ios managed-configurations mdm capawesome capacitor-android capacitor-ios

capacitor-managed-configurations's Introduction

⚠️ Deprecated repository

This project has been moved to the following monorepo: capawesome-team/capacitor-plugins.



Managed Configuration

@capawesome/capacitor-managed-configurations

Capacitor plugin to access managed configuration settings.


Maintainers

Maintainer GitHub Social
Robin Genz robingenz @robin_genz

Sponsors

This is an MIT-licensed open source project. It can grow thanks to the support by these awesome people. If you'd like to join them, please read more here.

Installation

npm install @capawesome/capacitor-managed-configurations
npx cap sync

On Android, see Define managed configurations and follow the instructions to declare the app's managed configurations correctly.

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

Usage

import { ManagedConfigurations } from '@capawesome/capacitor-managed-configurations';

const getString = async () => {
  const result = await ManagedConfigurations.getString({ key: 'server_url' });
  return result.value;
};

const getNumber = async () => {
  const result = await ManagedConfigurations.getNumber({ key: 'server_port' });
  return result.value;
};

const getBoolean = async () => {
  const result = await ManagedConfigurations.getBoolean({ key: 'download_on_cellular' });
  return result.value;
};

API

getString(...)

getString(options: GetOptions) => Promise<GetResult<string>>

Fetches the value associated with the given key, or null if no mapping exists for the given key.

Only available for Android and iOS.

Param Type
options GetOptions

Returns: Promise<GetResult<string>>


getNumber(...)

getNumber(options: GetOptions) => Promise<GetResult<number>>

Fetches the value associated with the given key, or null if no mapping exists for the given key.

Only available for Android and iOS.

Param Type
options GetOptions

Returns: Promise<GetResult<number>>


getBoolean(...)

getBoolean(options: GetOptions) => Promise<GetResult<boolean>>

Fetches the value associated with the given key, or null if no mapping exists for the given key.

Only available for Android and iOS.

Param Type
options GetOptions

Returns: Promise<GetResult<boolean>>


Interfaces

GetResult

Prop Type Description
value T | null The value of the configuration entry, or null if no mapping exists for the given key.

GetOptions

Prop Type Description
key string Unique key for the configuration entry.

Test your implementation

On Android, see Set up device owner for testing and follow the instructions to set up a device owner testing environment.

On iOS, you need to install the app as a managed app with a MDM solution.

Changelog

See CHANGELOG.md.

License

See LICENSE.

capacitor-managed-configurations's People

Contributors

dependabot[bot] avatar robingenz avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

capacitor-managed-configurations's Issues

bug(ios): `undefined` is returned instead of `null`

Current behavior:

Fetches the value associated with the given key, or null if no mapping exists for the given key.

This is wrong. On iOS, undefined is currently returned.

Expected behavior:

It should return null as described.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.