-
Notifications
You must be signed in to change notification settings - Fork 83
[FSSDK-10619] Refactor project config manager to be injectable #945
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
a961147
saving
raju-opti eb9110c
saving
raju-opti f88fd9f
up
raju-opti c406523
fix test
raju-opti de99436
fix more tests
raju-opti ef85d65
fix tests
raju-opti 580a0b6
saving
raju-opti 7940193
saving
raju-opti 08636b7
emitter test
raju-opti f1a68e4
save
raju-opti 5439eb2
fix more test
raju-opti 2ff16c9
fix tests
raju-opti a5305f9
fix tests
raju-opti 9c6e8ee
fix
raju-opti 2441875
update
raju-opti 3755d24
update
raju-opti 2d25fd5
update
raju-opti a086e62
saving
raju-opti c705ccb
add tests
raju-opti 3c8a57c
add test
raju-opti b276b7e
tests
raju-opti cae172f
update
raju-opti 53ccf3e
update
raju-opti 8dea409
tests
raju-opti f57c315
add more tests
raju-opti 1643628
add tests
raju-opti b41f28f
update
raju-opti 0098fc2
update
raju-opti 5758a9b
tests
raju-opti a71fdd9
add more tests
raju-opti 5a29def
add tests
raju-opti fcbef0d
update name
raju-opti acf7bcf
remove notification registry
raju-opti 4a98a6d
fix repeater test
raju-opti a24e263
fixes
raju-opti d27b3b1
updates
raju-opti 3cc4e7c
update
raju-opti 515696e
update
raju-opti f92b56f
update
raju-opti 56ebf5e
update
raju-opti a877e9d
upd
raju-opti c2fbc70
exclude spec from build
raju-opti 19877a2
private
raju-opti ef4879d
update
raju-opti 0b8c06d
update
raju-opti c483d85
updating
raju-opti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
saving
- Loading branch information
commit a086e620dba3ac910c4b27aff064d7988df38306
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| /** | ||
| * Copyright 2022, Optimizely | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| // /** | ||
| // * Copyright 2022, Optimizely | ||
| // * | ||
| // * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // * you may not use this file except in compliance with the License. | ||
| // * You may obtain a copy of the License at | ||
| // * | ||
| // * http://www.apache.org/licenses/LICENSE-2.0 | ||
| // * | ||
| // * Unless required by applicable law or agreed to in writing, software | ||
| // * distributed under the License is distributed on an "AS IS" BASIS, | ||
| // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // * See the License for the specific language governing permissions and | ||
| // * limitations under the License. | ||
| // */ | ||
|
|
||
| export * from './datafileManager'; | ||
| export { default as HttpPollingDatafileManager } from './reactNativeDatafileManager'; | ||
| // export * from './datafileManager'; | ||
| // export { default as HttpPollingDatafileManager } from './reactNativeDatafileManager'; |
62 changes: 31 additions & 31 deletions
62
lib/modules/datafile-manager/reactNativeDatafileManager.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,34 @@ | ||
| /** | ||
| * Copyright 2022, 2024, Optimizely | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| // /** | ||
| // * Copyright 2022, 2024, Optimizely | ||
| // * | ||
| // * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // * you may not use this file except in compliance with the License. | ||
| // * You may obtain a copy of the License at | ||
| // * | ||
| // * http://www.apache.org/licenses/LICENSE-2.0 | ||
| // * | ||
| // * Unless required by applicable law or agreed to in writing, software | ||
| // * distributed under the License is distributed on an "AS IS" BASIS, | ||
| // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // * See the License for the specific language governing permissions and | ||
| // * limitations under the License. | ||
| // */ | ||
|
|
||
| import { makeGetRequest } from './browserRequest'; | ||
| import HttpPollingDatafileManager from './httpPollingDatafileManager'; | ||
| import { Headers, AbortableRequest } from './http'; | ||
| import { DatafileManagerConfig } from './datafileManager'; | ||
| import ReactNativeAsyncStorageCache from '../../plugins/key_value_cache/reactNativeAsyncStorageCache'; | ||
| // import { makeGetRequest } from './browserRequest'; | ||
| // import HttpPollingDatafileManager from './httpPollingDatafileManager'; | ||
| // import { Headers, AbortableRequest } from './http'; | ||
| // import { DatafileManagerConfig } from './datafileManager'; | ||
| // import ReactNativeAsyncStorageCache from '../../plugins/key_value_cache/reactNativeAsyncStorageCache'; | ||
|
|
||
| export default class ReactNativeDatafileManager extends HttpPollingDatafileManager { | ||
| protected makeGetRequest(reqUrl: string, headers: Headers): AbortableRequest { | ||
| return makeGetRequest(reqUrl, headers); | ||
| } | ||
| // export default class ReactNativeDatafileManager extends HttpPollingDatafileManager { | ||
| // protected makeGetRequest(reqUrl: string, headers: Headers): AbortableRequest { | ||
| // return makeGetRequest(reqUrl, headers); | ||
| // } | ||
|
|
||
| protected getConfigDefaults(): Partial<DatafileManagerConfig> { | ||
| return { | ||
| autoUpdate: true, | ||
| cache: new ReactNativeAsyncStorageCache(), | ||
| }; | ||
| } | ||
| } | ||
| // protected getConfigDefaults(): Partial<DatafileManagerConfig> { | ||
| // return { | ||
| // autoUpdate: true, | ||
| // cache: new ReactNativeAsyncStorageCache(), | ||
| // }; | ||
| // } | ||
| // } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 52 additions & 52 deletions
104
lib/plugins/datafile_manager/react_native_http_polling_datafile_manager.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,54 @@ | ||
| /** | ||
| * Copyright 2021-2022, 2024, Optimizely | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| import { LoggerFacade } from '../../modules/logging'; | ||
| import { HttpPollingDatafileManager } from '../../modules/datafile-manager/index.react_native'; | ||
| import { DatafileOptions, DatafileManager, PersistentCacheProvider } from '../../shared_types'; | ||
| import { DatafileManagerConfig } from '../../modules/datafile-manager/index.react_native'; | ||
| import { toDatafile, tryCreatingProjectConfig } from '../../core/project_config'; | ||
| import fns from '../../utils/fns'; | ||
| // /** | ||
| // * Copyright 2021-2022, 2024, Optimizely | ||
| // * | ||
| // * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // * you may not use this file except in compliance with the License. | ||
| // * You may obtain a copy of the License at | ||
| // * | ||
| // * http://www.apache.org/licenses/LICENSE-2.0 | ||
| // * | ||
| // * Unless required by applicable law or agreed to in writing, software | ||
| // * distributed under the License is distributed on an "AS IS" BASIS, | ||
| // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // * See the License for the specific language governing permissions and | ||
| // * limitations under the License. | ||
| // */ | ||
| // import { LoggerFacade } from '../../modules/logging'; | ||
| // import { HttpPollingDatafileManager } from '../../modules/datafile-manager/index.react_native'; | ||
| // import { DatafileOptions, DatafileManager, PersistentCacheProvider } from '../../shared_types'; | ||
| // import { DatafileManagerConfig } from '../../modules/datafile-manager/index.react_native'; | ||
| // import { toDatafile, tryCreatingProjectConfig } from '../../core/project_config'; | ||
| // import fns from '../../utils/fns'; | ||
|
|
||
| export function createHttpPollingDatafileManager( | ||
| sdkKey: string, | ||
| logger: LoggerFacade, | ||
| // TODO[OASIS-6649]: Don't use object type | ||
| // eslint-disable-next-line @typescript-eslint/ban-types | ||
| datafile?: string | object, | ||
| datafileOptions?: DatafileOptions, | ||
| persistentCacheProvider?: PersistentCacheProvider, | ||
| ): DatafileManager { | ||
| const datafileManagerConfig: DatafileManagerConfig = { sdkKey }; | ||
| if (datafileOptions === undefined || (typeof datafileOptions === 'object' && datafileOptions !== null)) { | ||
| fns.assign(datafileManagerConfig, datafileOptions); | ||
| } | ||
| if (datafile) { | ||
| const { configObj, error } = tryCreatingProjectConfig({ | ||
| datafile: datafile, | ||
| jsonSchemaValidator: undefined, | ||
| logger: logger, | ||
| }); | ||
| // export function createHttpPollingDatafileManager( | ||
| // sdkKey: string, | ||
| // logger: LoggerFacade, | ||
| // // TODO[OASIS-6649]: Don't use object type | ||
| // // eslint-disable-next-line @typescript-eslint/ban-types | ||
| // datafile?: string | object, | ||
| // datafileOptions?: DatafileOptions, | ||
| // persistentCacheProvider?: PersistentCacheProvider, | ||
| // ): DatafileManager { | ||
| // const datafileManagerConfig: DatafileManagerConfig = { sdkKey }; | ||
| // if (datafileOptions === undefined || (typeof datafileOptions === 'object' && datafileOptions !== null)) { | ||
| // fns.assign(datafileManagerConfig, datafileOptions); | ||
| // } | ||
| // if (datafile) { | ||
| // const { configObj, error } = tryCreatingProjectConfig({ | ||
| // datafile: datafile, | ||
| // jsonSchemaValidator: undefined, | ||
| // logger: logger, | ||
| // }); | ||
|
|
||
| if (error) { | ||
| logger.error(error); | ||
| } | ||
| if (configObj) { | ||
| datafileManagerConfig.datafile = toDatafile(configObj); | ||
| } | ||
| } | ||
| if (persistentCacheProvider) { | ||
| datafileManagerConfig.cache = persistentCacheProvider(); | ||
| } | ||
| return new HttpPollingDatafileManager(datafileManagerConfig); | ||
| } | ||
| // if (error) { | ||
| // logger.error(error); | ||
| // } | ||
| // if (configObj) { | ||
| // datafileManagerConfig.datafile = toDatafile(configObj); | ||
| // } | ||
| // } | ||
| // if (persistentCacheProvider) { | ||
| // datafileManagerConfig.cache = persistentCacheProvider(); | ||
| // } | ||
| // return new HttpPollingDatafileManager(datafileManagerConfig); | ||
| // } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.