@@ -5,9 +5,7 @@ import { QBConfig } from './QBconfig';
55import useQBConnection from './Presentation/components/providers/QuickBloxUIKitProvider/useQBConnection' ;
66import { LocalDataSource } from './Data/source/local/LocalDataSource' ;
77import Login from './Presentation/components/layouts/TestStage/LoginView/Login' ;
8- import QuickBloxUIKitProvider , {
9- qbDataContext ,
10- } from './Presentation/components/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider' ;
8+ import QuickBloxUIKitProvider from './Presentation/components/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider' ;
119import TestStageMarkup from './Presentation/components/layouts/TestStage/TestStageMarkup' ;
1210import { Stubs } from './Data/Stubs' ;
1311import {
@@ -16,10 +14,13 @@ import {
1614} from './Data/source/remote/RemoteDataSource' ;
1715import QuickBloxUIKitDesktopLayout from './Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout' ;
1816import DefaultTheme from './Presentation/assets/DefaultThemes/DefaultTheme' ;
17+ import useQbUIKitDataContext from './Presentation/components/providers/QuickBloxUIKitProvider/useQbUIKitDataContext' ;
1918
2019function App ( ) {
21- const currentContext = React . useContext ( qbDataContext ) ;
22- const remoteDataSourceMock : RemoteDataSource =
20+ // const currentContext = React.useContext(qbDataContext);
21+ const currentContext = useQbUIKitDataContext ( ) ;
22+
23+ const remoteDataSource : RemoteDataSource =
2324 currentContext . storage . REMOTE_DATA_SOURCE ;
2425 // eslint-disable-next-line @typescript-eslint/no-unused-vars
2526 const localDataSource : LocalDataSource =
@@ -50,7 +51,7 @@ function App() {
5051 console . log ( 'call release...' ) ;
5152 connectionRepository . stopKeepAlive ( ) ;
5253 console . log ( 'call stopKeepAlive...' ) ;
53- await remoteDataSourceMock . disconnectAndLogoutUser ( ) ;
54+ await remoteDataSource . disconnectAndLogoutUser ( ) ;
5455 console . log ( 'call disconnectAndLogoutUser...' ) ;
5556 await currentContext . storage . LOCAL_DATA_SOURCE . clearAll ( ) ;
5657 console . log ( 'call clearAll...' ) ;
@@ -61,9 +62,9 @@ function App() {
6162 const prepareSDK = async ( authData : LoginData ) : Promise < void > => {
6263 console . log ( 'call prepareSDK with data:' , authData ) ;
6364 // todo: must be real remote datasource
64- if ( remoteDataSourceMock . needInit ) {
65+ if ( remoteDataSource . needInit ) {
6566 console . log ( 'start prepareSDK actions with data:' , authData ) ;
66- await remoteDataSourceMock . initSDKWithUser (
67+ await remoteDataSource . initSDKWithUser (
6768 {
6869 appIdOrToken : currentContext . InitParams . accountData . appId ,
6970 authKeyOrAppId : currentContext . InitParams . accountData . authKey ,
@@ -114,10 +115,10 @@ function App() {
114115 console . log ( 'call reloginSDK with data:' , JSON . stringify ( authData ) ) ;
115116 currentContext . storage . SYNC_DIALOGS_USE_CASE . release ( ) ;
116117 connectionRepository . stopKeepAlive ( ) ;
117- await remoteDataSourceMock . disconnectAndLogoutUser ( ) ;
118+ await remoteDataSource . disconnectAndLogoutUser ( ) ;
118119 await currentContext . storage . LOCAL_DATA_SOURCE . clearAll ( ) ;
119120
120- await remoteDataSourceMock . loginWithUser ( authData ) ;
121+ await remoteDataSource . loginWithUser ( authData ) ;
121122 //
122123 // todo: temporary off, must turn on and reorganize code rows
123124 await connectionRepository . initializeStates ( ) ;
@@ -135,20 +136,25 @@ function App() {
135136 const prepareContent = async ( ) : Promise < void > => {
136137 console . log ( 'PREPARE CONTENT' ) ;
137138 // todo: must delete it and ADD Preload data (read first page everywhere)
139+ // или во все юзкейсы 2) Get/Sync execute(completed/callback):Promise<Entity[]>
140+ // await prepareMockData();
138141 console . log ( 'ADD REAL DATA TO DIALOG MOCK DATA ' ) ;
142+ // await remoteDataSource.getDialogsFirstPage();
143+ // await remoteDataSource.setUpMockStorage();
144+ //
139145 //
140146 } ;
141147
142148 const loginHandler = async ( data : LoginData ) : Promise < void > => {
143149 setCurrentUser ( data ) ;
144150 console . log ( `call login actions: ${ JSON . stringify ( data ) } ` ) ;
145- if ( remoteDataSourceMock . authInformation ) {
151+ if ( remoteDataSource . authInformation ) {
146152 console . log (
147153 `authInformation: ${ JSON . stringify (
148- remoteDataSourceMock ?. authInformation . userName ,
154+ remoteDataSource ?. authInformation . userName ,
149155 ) } `,
150156 ) ;
151- if ( data . login !== remoteDataSourceMock . authInformation . userName ) {
157+ if ( data . login !== remoteDataSource . authInformation . userName ) {
152158 await reloginSDK ( data ) . catch ( ( e ) => {
153159 console . log (
154160 `exception in reloginSDK ${ ( e as unknown as Error ) . message } ` ,
@@ -161,9 +167,9 @@ function App() {
161167 }
162168 } else {
163169 console . log ( 'need prepare SDK with data:' , data ) ;
164- if ( remoteDataSourceMock . needInit ) {
170+ if ( remoteDataSource . needInit ) {
165171 console . log ( 'start prepareSDK actions with data:' , data ) ;
166- await remoteDataSourceMock . initSDKWithUser (
172+ await remoteDataSource . initSDKWithUser (
167173 {
168174 appIdOrToken : currentContext . InitParams . accountData . appId ,
169175 authKeyOrAppId : currentContext . InitParams . accountData . authKey ,
@@ -188,6 +194,18 @@ function App() {
188194 prepareSDK ( currentUser ) . catch ( ) ;
189195 } , [ ] ) ;
190196
197+ // const { apiKey } = QBConfig.configAIApi.AIAnswerAssistWidgetConfig;
198+ // // eslint-disable-next-line @typescript-eslint/no-unsafe-call
199+ // const openAIConfiguration: Configuration = new Configuration({
200+ // apiKey,
201+ // });
202+ //
203+ // // eslint-disable-next-line @typescript-eslint/no-unsafe-call
204+ // const openAIApi: OpenAIApi = new OpenAIApi(openAIConfiguration);
205+ // const defaultIncomingMessageWidget = UseDefaultIncomingMessageWidget({
206+ // openAIApi,
207+ // });
208+
191209 // todo: uncomment authSecret
192210 return (
193211 < QuickBloxUIKitProvider
@@ -215,9 +233,12 @@ function App() {
215233 < Route
216234 path = "/desktop-test-mock"
217235 element = {
218- // <QuickBloxUIKitDesktopLayout theme={new CustomTheme()} InputWidgetLeftPlaceHolder={CustomWidgetVoiceToText('','')} />
219-
220- // <QuickBloxUIKitDesktopLayout theme={new CustomTheme()} />
236+ // <QuickBloxUIKitDesktopLayout
237+ // theme={new DefaultTheme()}
238+ // IncomingMessageWidgetToRightPlaceHolder={
239+ // defaultIncomingMessageWidget
240+ // }
241+ // />
221242
222243 < QuickBloxUIKitDesktopLayout theme = { new DefaultTheme ( ) } />
223244 }
0 commit comments