/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/scripts/featureflags/templates/android/ReactNativeFeatureFlagsCxxInterop.kt-template.js
58 строк
1 KB
Rubén Norte
Add new dangerouslyForceOverride method to feature flags (#46963)
11 окт 2024, 20:05
11 окт 2024, 20:05
c86b5c1
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict * @format */ import type {FeatureFlagDefinitions} from '../../types'; import { DO_NOT_MODIFY_COMMENT, getKotlinTypeFromDefaultValue, } from '../../utils'; import signedsource from 'signedsource'; export default function (definitions: FeatureFlagDefinitions): string { return signedsource.signFile(`/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * ${signedsource.getSigningToken()} */ ${DO_NOT_MODIFY_COMMENT} package com.facebook.react.internal.featureflags import com.facebook.proguard.annotations.DoNotStrip import com.facebook.soloader.SoLoader @DoNotStrip public object ReactNativeFeatureFlagsCxxInterop { init { SoLoader.loadLibrary("react_featureflagsjni") } ${Object.entries(definitions.common) .map( ([flagName, flagConfig]) => ` @DoNotStrip @JvmStatic public external fun ${flagName}(): ${getKotlinTypeFromDefaultValue( flagConfig.defaultValue, )}`, ) .join('\n\n')} @DoNotStrip @JvmStatic public external fun override(provider: Any) @DoNotStrip @JvmStatic public external fun dangerouslyReset() @DoNotStrip @JvmStatic public external fun dangerouslyForceOverride(provider: Any): String? } `); }