npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

agr-firebase-remote-config

v1.0.2

Published

A native plugin for firebase remote config

Downloads

3

Readme

Capacitor Firebase Remote Config Plugin

Capacitor community plugin for firebase remote config.

Capacitor Compatibility

Version 1.x.x is compatible with Capacitor 5 Version 0.6.0 is compatible with Capacitor 4 Please use 0.5.2 for Capacitor 3

Installation

To use npm

npm install @teknepal/firebase-remote-config

To use yarn

yarn add @teknepal/firebase-remote-config

Sync native files

npx cap sync

On iOS, no further steps are needed.

On Android, register the plugin in your main activity:

import com.getcapacitor.community.firebaserc.FirebaseRemoteConfig;

public class MainActivity extends BridgeActivity {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(
        savedInstanceState,
        new ArrayList<Class<? extends Plugin>>() {
          {
            // Additional plugins you've installed go here
            // Ex: add(TotallyAwesomePlugin.class);
            add(FirebaseRemoteConfig.class);
          }
        }
      );
  }
}

Configuration

Download appropriate google-services.json or GoogleService-Info.plist and place it in the correct platform app directory.

For Android: /android/app

For iOS: /ios/App/App

Supported methods

| Name | Android | iOS | Web | | :----------------- | :------ | :-- | :-- | | initializeFirebase | ✅ | ✅ | ✅ | | setDefaultConfig | ✅ | ✅ | ✅ | | initialize | ✅ | ✅ | ✅ | | fetch | ✅ | ✅ | ✅ | | activate | ✅ | ✅ | ✅ | | fetchAndActivate | ✅ | ✅ | ✅ | | getBoolean | ✅ | ✅ | ✅ | | getByteArray | ✅ | ✅ | ✅ | | getNumber | ✅ | ✅ | ✅ | | getString | ✅ | ✅ | ✅ |

Usage

// Must import the package once to make sure the web support initializes
import "@teknepal/firebase-remote-config";

import { Plugins } from "@capacitor/core";

const { FirebaseRemoteConfig } = Plugins;

/**
 * This method will initialize firebase app if not yet initialized. Note that it
 * is safe to call but does nothing in iOS or Android as initialization is
 * automatic on load.
 *
 * @param firebase configs - from google-service.json or GoogleService-Info.plist
 * @returns void
 */
FirebaseRemoteConfig.initializeFirebase({
  apiKey: "...",
  authDomain: "...",
  databaseURL: "...",
  projectId: "...",
  storageBucket: "...",
  messagingSenderId: "...",
  appId: "...",
  measurementId: "...",
});

/**
 * This method will set default remote config values. On Web, it will read from
 * the parameters give. On Android and iOS it will use the build in mechanisms
 * and ignore any parameters supplied.
 *
 * @param options - key/value params with default values
 * @returns void
 */
FirebaseRemoteConfig.setDefaultConfig({
  has_sale: false,
  event_name: "clearance_event",
});

/**
 * This method will configure remote config object instance and set the minimum
 * fetch interval to allow for frequest refreshes.
 *
 * @param minimumFetchIntervalInSeconds - interval in seconds (default: 3600)
 * @returns void
 */
FirebaseRemoteConfig.initialize({
  minimumFetchIntervalInSeconds: 3600,
});

/**
 * This method will execute fetch task to retrieve config
 * @param none
 * @returns void
 */
FirebaseRemoteConfig.fetch();

/**
 * This method will activate the fetched values making it available for your app
 *
 * @param none
 * @returns void
 */
FirebaseRemoteConfig.activate();

/**
 * This method will fetch and activate the values making it available for your
 * app
 *
 * @param none
 * @returns void
 */
FirebaseRemoteConfig.fetchAndActivate();

/**
 * This method will return the parameter value for a given key in boolean
 * @param key - key to obtain boolean value
 * @returns key - key used to obtain value
 *          value - boolean value for a given key
 *          source - Indicates that the source of value retrieved (default, remote, static)
 */
FirebaseRemoteConfig.getBoolean({
  key: "bool key",
});

/**
 * This method will return the parameter value for a given key in byte array
 * @param key - key to obtain byte array value
 * @returns key - key used to obtain value
 *          value - byte array value for a given key
 *          source - Indicates that the source of value retrieved (default, remote, static)
 */
FirebaseRemoteConfig.getByteArray({
  key: "array key",
});

/**
 * This method will return the parameter value for a given key in double
 * @param key - key to obtain double value
 * @returns key - key used to obtain value
 *          value - double value for a given key
 *          source - Indicates that the source of value retrieved (default, remote, static)
 */
FirebaseRemoteConfig.getNumber({
  key: "number key",
});

/**
 * This method will return the parameter value for a given key in string
 * @param key - key to obtain string value
 * @returns key - key used to obtain value
 *          value - string value for a given key
 *          source - Indicates that the source of value retrieved (default, remote, static)
 */
FirebaseRemoteConfig.getString({
  key: "string key",
});