Skip to content

Commit 56b303c

Browse files
committed
feat: added authentication form for replication config
1 parent 5fefa7c commit 56b303c

23 files changed

+239
-60
lines changed

expo-example/app/collection/create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import create from '@/service/collection/create';
44
import { Database } from 'cbl-reactnative';
55
import CBLDatabaseActionContainer from '@/components/CBLDatabaseActionContainer';
66
import { Divider } from '@gluestack-ui/themed';
7-
import HeaderView from '@/components/HeaderView';
7+
import HeaderView from '@/components/HeaderView/HeaderView';
88
import { StyleSheet, View } from 'react-native';
99
import { useStyleScheme } from '@/components/Themed';
1010

expo-example/app/collection/indexing/create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react';
22
import { Collection } from 'cbl-reactnative';
33
import CBLCollectionActionContainer from '@/components/CBLCollectionActionContainer';
4-
import HeaderView from '@/components/HeaderView';
4+
import HeaderView from '@/components/HeaderView/HeaderView';
55
import { Divider } from '@gluestack-ui/themed';
66
import { StyledTextInput } from '@/components/StyledTextInput';
77
import create from '@/service/indexes/create';

expo-example/app/collection/indexing/createFts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react';
22
import { Collection } from 'cbl-reactnative';
33
import CBLCollectionActionContainer from '@/components/CBLCollectionActionContainer';
4-
import HeaderView from '@/components/HeaderView';
4+
import HeaderView from '@/components/HeaderView/HeaderView';
55
import { Divider, Switch } from '@gluestack-ui/themed';
66
import { StyledTextInput } from '@/components/StyledTextInput';
77
import createFts from '@/service/indexes/createFts';

expo-example/app/collection/indexing/delete.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react';
22
import { Collection } from 'cbl-reactnative';
33
import CBLCollectionActionContainer from '@/components/CBLCollectionActionContainer';
4-
import HeaderView from '@/components/HeaderView';
4+
import HeaderView from '@/components/HeaderView/HeaderView';
55
import { StyledTextInput } from '@/components/StyledTextInput';
66
import deleteIndex from '@/service/indexes/delete';
77
import { useStyleScheme } from '@/components/Themed';

expo-example/app/collection/list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { StyledTextInput } from '@/components/StyledTextInput';
33
import listCollections from '@/service/collection/list';
44
import { Database } from 'cbl-reactnative';
55
import CBLDatabaseActionContainer from '@/components/CBLDatabaseActionContainer';
6-
import HeaderView from '@/components/HeaderView';
6+
import HeaderView from '@/components/HeaderView/HeaderView';
77
import { View } from 'react-native';
88
import { useStyleScheme } from '@/components/Themed';
99

expo-example/app/collection/scope/get.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import get from '@/service/scope/get';
44
import { Database } from 'cbl-reactnative';
55
import CBLDatabaseActionContainer from '@/components/CBLDatabaseActionContainer';
66
import { useStyleScheme } from '@/components/Themed';
7-
import HeaderView from '@/components/HeaderView';
7+
import HeaderView from '@/components/HeaderView/HeaderView';
88
import { StyleSheet, View } from 'react-native';
99

1010
export default function ScopeGetScreen() {

expo-example/app/replication/config.tsx

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import defaultCollection from '@/service/collection/default';
33
import { Database } from 'cbl-reactnative';
44
import { SafeAreaView, ScrollView, Text } from 'react-native';
55
import { 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

89
export 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
);

expo-example/components/CBLDocumentIdCollectionActionContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
22
import { Collection } from 'cbl-reactnative';
33
import { CBLDocumentIdCollectionContainerProps } from '@/types/CBLDocumentIdCollectionActionContainerProps.type';
44
import CBLCollectionActionContainer from '@/components/CBLCollectionActionContainer';
5-
import HeaderView from '@/components/HeaderView';
5+
import HeaderView from '@/components/HeaderView/HeaderView';
66
import { StyledTextInput } from '@/components/StyledTextInput';
77
import { useStyleScheme } from '@/components/Themed';
88
import { View } from 'react-native';

expo-example/components/DatabaseHeaderView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import HeaderView from '@/components/HeaderView';
1+
import HeaderView from '@/components/HeaderView/HeaderView';
22

33
export default function DatabaseHeaderView() {
44
return HeaderView({ name: 'Database', iconName: 'database' });

expo-example/components/DatabaseScopeCollectionForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useStyleScheme } from '@/components/Themed';
33
import { DatabaseScopeCollectionFormProps } from '@/types/databaseScopeCollectionFormProps.type';
44
import { StyledTextInput } from '@/components/StyledTextInput';
55
import { Divider } from '@gluestack-ui/themed';
6-
import HeaderView from '@/components/HeaderView';
6+
import HeaderView from '@/components/HeaderView/HeaderView';
77
import { StyleSheet, View } from 'react-native';
88

99
export default function DatabaseScopeCollectionForm({

0 commit comments

Comments
 (0)