@@ -3,9 +3,11 @@ import defaultCollection from '@/service/collection/default';
33import { Database } from 'cbl-reactnative' ;
44import { SafeAreaView , ScrollView , Text } from 'react-native' ;
55import { useStyleScheme } from '@/components/Themed' ;
6- import ReplicatorConfigGeneralForm from '@/components/ReplicatorConfigGeneral' ;
6+ import ReplicatorConfigGeneralForm from '@/components/ReplicationConfigGeneralForm/ReplicatorConfigGeneralForm' ;
7+ import ReplicatorAuthenticationForm from '@/components/ReplicatorAuthenticationForm/ReplicatorAuthenticationForm' ;
78
89export default function ReplicationConfigCreateScreen ( ) {
10+ //general form
911 const [ replicatorType , setReplicatorType ] = useState < string > ( '' ) ;
1012 const [ connectionString , setConnectionString ] = useState < string > ( '' ) ;
1113 const [ heartbeat , setHeartbeat ] = useState < string > ( '300' ) ;
@@ -15,8 +17,35 @@ export default function ReplicationConfigCreateScreen() {
1517 const [ autoPurgeEnabled , setAutoPurgeEnabled ] = useState < boolean > ( false ) ;
1618 const [ acceptParentDomainCookies , setAcceptParentDomainCookies ] =
1719 useState < boolean > ( false ) ;
20+ const [ acceptOnlySelfSignedCerts , setAcceptOnlySelfSignedCerts ] =
21+ useState < boolean > ( false ) ;
22+ //used for authentication type and authentication fields
23+ const [ selectedAuthenticationType , setSelectedAuthenticationType ] =
24+ useState < string > ( '' ) ;
25+ const [ username , setUsername ] = useState < string > ( '' ) ;
26+ const [ password , setPassword ] = useState < string > ( '' ) ;
27+ const [ sessionId , setSessionId ] = useState < string > ( '' ) ;
28+ const [ cookieName , setCookieName ] = useState < string > ( '' ) ;
29+
30+ function reset ( ) {
31+ setConnectionString ( '' ) ;
32+ //setHeaders('');
33+ setHeartbeat ( '60' ) ;
34+ setMaxAttempts ( '0' ) ;
35+ setMaxWaitTime ( '300' ) ;
36+ setReplicatorType ( '' ) ;
37+ setContinuous ( true ) ;
38+ setAutoPurgeEnabled ( true ) ;
39+ setAcceptParentDomainCookies ( false ) ;
40+ setAcceptOnlySelfSignedCerts ( false ) ;
1841
19- function reset ( ) { }
42+ //authentication section
43+ setSelectedAuthenticationType ( '' ) ;
44+ setUsername ( '' ) ;
45+ setPassword ( '' ) ;
46+ setSessionId ( '' ) ;
47+ setCookieName ( '' ) ;
48+ }
2049
2150 async function update ( database : Database ) {
2251 try {
@@ -51,6 +80,18 @@ export default function ReplicationConfigCreateScreen() {
5180 setMaxWaitTime = { setMaxWaitTime }
5281 setReplicatorType = { setReplicatorType }
5382 />
83+ < ReplicatorAuthenticationForm
84+ selectedAuthenticationType = { selectedAuthenticationType }
85+ setSelectedAuthenticationType = { setSelectedAuthenticationType }
86+ username = { username }
87+ setUsername = { setUsername }
88+ password = { password }
89+ setPassword = { setPassword }
90+ sessionId = { sessionId }
91+ setSessionId = { setSessionId }
92+ cookieName = { cookieName }
93+ setCookieName = { setCookieName }
94+ />
5495 </ ScrollView >
5596 </ SafeAreaView >
5697 ) ;
0 commit comments