Skip to content

[Feature] Use Firebase Remote Config in FluxStore

Hiếu edited this page Jul 30, 2021 · 2 revisions

A. Config Project FluxStore

  • Open file env.dart
  • Update the value of the variable enableRemoteConfigFirebase to true and save config.

B. Config Firebase

1. Values from Firebase Remote Config are supported in FluxStore

serverConfig

key: serverConfig
value: 
{
    "type": "woo",
    "url": "https://mstore.io",
    "consumerKey": "ck_c16dab9336b72ae8faff2",
    "consumerSecret": "cs_1c11c22f20f6b49c8497a",
    "blog": "https://mstore.io", 
    "forgetPassword": "https://mstore.io/wp-login.php?action=lostpassword"
}

advanceConfig

key: advanceConfig
value: 

{
    "DefaultLanguage": "en",
    "DetailedBlogLayout": "halfSizeImageType",
    "EnablePointReward": true,
    "hideOutOfStock": false,
    "EnableRating": true,
    "hideEmptyProductListRating": true,
    "EnableSkuSearch": true,
    "showStockStatus": true,
    "GridCount": 3,
    "isCaching": false,
    "kIsResizeImage": false,
    "DefaultCurrency": {
      "symbol": "$",
      "decimalDigits": 2,
      "symbolBeforeTheNumber": true,
      "currency": "USD",
      "currencyCode": "usd",
      "smallestUnitRate": 100
    },
    "Currencies": [
      {
        "symbol": "$",
        "decimalDigits": 2,
        "symbolBeforeTheNumber": true,
        "currency": "USD",
        "currencyCode": "usd",
        "smallestUnitRate": 100
      },
      {
        "symbol": "đ",
        "decimalDigits": 2,
        "symbolBeforeTheNumber": false,
        "currency": "VND",
        "currencyCode": "VND"
      },
      {
        "symbol": "€",
        "decimalDigits": 2,
        "symbolBeforeTheNumber": true,
        "currency": "EUR",
        "currencyCode": "EUR"
      },
      {
        "symbol": "£",
        "decimalDigits": 2,
        "symbolBeforeTheNumber": true,
        "currency": "Pound sterling",
        "currencyCode": "gbp",
        "smallestUnitRate": 100
      },
      {
        "symbol": "AR$",
        "decimalDigits": 2,
        "symbolBeforeTheNumber": true,
        "currency": "ARS",
        "currencyCode": "ARS"
      }
    ],
    "DefaultStoreViewCode": "",
    "EnableAttributesConfigurableProduct": ["color", "size"],
    "EnableAttributesLabelConfigurableProduct": ["color", "size"],
    "isMultiLanguages": true,
    "EnableApprovedReview": false,
    "EnableSyncCartFromWebsite": false,
    "EnableSyncCartToWebsite": false,
    "EnableShoppingCart": false,
    "EnableFirebase": true,
    "RatioProductImage": 1.2,
    "EnableCouponCode": true,
    "ShowCouponList": true,
    "ShowAllCoupons": true,
    "ShowExpiredCoupons": true,
    "AlwaysShowTabBar": false,
    "PrivacyPoliciesPageId": 25569,
    "QueryRadiusDistance": 10, 
    "AutoDetectLanguage": false
}

productDetail

key: productDetail
value: 
{
    "height": 0.4,
    "marginTop": 0,
    "safeArea": false,
    "showVideo": true,
    "showBrand": true,
    "showThumbnailAtLeast": 1,
    "layout": "simpleType",
    "borderRadius": 3.0,
    "ShowSelectedImageVariant": true,
    "ForceWhiteBackground": false,
    "AutoSelectFirstAttribute": true,
    "enableReview": false,
    "attributeImagesSize": 50.0,
    "showSku": true,
    "showStockQuantity": true,
    "showProductCategories": true,
    "showProductTags": true,
    "hideInvalidAttributes": false,
    "showQuantityInList": false,
    "productListItemHeight": 125
  }

onBoardingData

key: onBoardingData
value:
[
    {
      "title": "Welcome to FluxStore",
      "image": "assets/images/fogg-delivery-1.png",
      "desc": "Fluxstore is on the way to serve you. "
    },
    {
      "title": "Connect Surrounding World",
      "image": "assets/images/fogg-uploading-1.png",
      "desc":
          "See all things happening around you just by a click in your phone. Fast, convenient and clean."
    },
    {
      "title": "Let's Get Started",
      "image": "fogg-order-completed.png",
      "desc": "Waiting no more, let's see what we get!"
    }
]

blogDetail

key: blogDetail
value:
{
    'showComment': true,
    'showHeart': true,
    'showSharing': true,
    'showTextAdjustment': true,
    'enableAudioSupport': false
}

smartChat

key: smartChat
value:
[
    {"app": "https://wa.me/849908854", "iconData": "whatsapp"},
    {"app": "tel:8499999999", "iconData": "phone"},
    {"app": "sms://8499999999", "iconData": "sms"},
    {"app": "firebase", "iconData": "google"},
    {
      "app": "https://tawk.to/chat/5d830419c22bdd393bb69888/default",
      "iconData": "facebookMessenger"
    }
]

2. Adding data to Firebase Remote Config

  • Open your Firebase Console project → in the left menu bar, scroll down to the bottom → in the Engage section, select Remote Config

  • Adding data for the first time. Add key and value data

  • Click Publish changes to finish

  • Done

  • Add new config. Click button Add parameter

NOTE:

  • You can choose json editor when adding/editing data to ensure the correct data format

--> When add or edit parameter, click Json Editor

--> When the format is not correct, an error message will be displayed and button SAVE is disable

--> the data is correct

  • If the data is json (list or map), make sure it's in the correct json format
    • do not include "\” and “\” characters
    • the last elements of the map or list must not have commas (,)
    Example data wrong format:
    
    [
        {"app": "https://wa.me/849908854", "iconData": "whatsapp"},
        {"app": "tel:8499999999", "iconData": "phone"},
        {"app": "sms://8499999999", "iconData": "sms"},
        {"app": "firebase", "iconData": "google"},
        {
          "app": "https://tawk.to/chat/5d830419c22bdd393bb69888/default",
          "iconData": "facebookMessenger",   <<=== wrong
        }, <<=== wrong
    ]
    
    
    [
        {"app": "https://wa.me/849908854", "iconData": "whatsapp"},
        {"app": "tel:8499999999", "iconData": "phone"},
        {"app": "sms://8499999999", "iconData": "sms"},
        {"app": "firebase", "iconData": "google"},
        {
          "app": "https://tawk.to/chat/5d830419c22bdd393bb69888/default",
          "iconData": "facebookMessenger"   <<=== correct
        } <<=== correct