File tree Expand file tree Collapse file tree 6 files changed +69
-4
lines changed
Expand file tree Collapse file tree 6 files changed +69
-4
lines changed Original file line number Diff line number Diff line change @@ -39,4 +39,4 @@ allprojects {
3939 maven { url ' https://www.jitpack.io' }
4040 }
4141}
42- apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle"
42+ apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle" apply from : " ../../android/build.gradle " apply from : " ../../android/build.gradle "
Original file line number Diff line number Diff line change 1+ import React , { useState } from 'react' ;
2+ import { Collection } from 'cbl-reactnative' ;
3+ import CBLCollectionActionContainer from '@/components/CBLCollectionActionContainer' ;
4+ import HeaderView from '@/components/HeaderView' ;
5+ import { Divider } from '@gluestack-ui/themed' ;
6+ import { StyledTextInput } from '@/components/StyledTextInput' ;
7+ import deleteIndex from '@/service/indexes/delete' ;
8+
9+ export default function IndexCreateScreen ( ) {
10+ const [ indexName , setIndexName ] = useState < string > ( '' ) ;
11+
12+ function reset ( ) {
13+ setIndexName ( '' ) ;
14+ }
15+
16+ async function update ( collection : Collection ) : Promise < string [ ] > {
17+ try {
18+ await deleteIndex ( collection , indexName ) ;
19+ return [ `Index ${ indexName } was deleted successfully` ] ;
20+ } catch ( error ) {
21+ // @ts -ignore
22+ return [ error . message ] ;
23+ }
24+ }
25+
26+ return (
27+ < CBLCollectionActionContainer
28+ handleUpdatePressed = { update }
29+ handleResetPressed = { reset }
30+ screenTitle = "Delete Index"
31+ >
32+ < HeaderView name = "Index" iconName = "magnify" />
33+ < StyledTextInput
34+ autoCapitalize = "none"
35+ placeholder = "IndexName"
36+ onChangeText = { ( newText ) => setIndexName ( newText ) }
37+ defaultValue = { indexName }
38+ />
39+ </ CBLCollectionActionContainer >
40+ ) ;
41+ }
Original file line number Diff line number Diff line change 6262 <string >$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route </string >
6363 <string >$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route </string >
6464 <string >$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route </string >
65+ <string >$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route </string >
66+ <string >$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route </string >
6567 </array >
6668 <key >UILaunchStoryboardName </key >
6769 <string >SplashScreen </string >
Original file line number Diff line number Diff line change 1+ import { Collection } from 'cbl-reactnative' ;
2+
3+ export default async function deleteIndex (
4+ collection : Collection ,
5+ indexName : string
6+ ) : Promise < void > {
7+ await collection . deleteIndex ( indexName ) ;
8+ }
Original file line number Diff line number Diff line change @@ -169,8 +169,8 @@ class CblReactnative: NSObject {
169169 }
170170 }
171171
172- @objc ( collection_DeleteCollection : fromCollectionWithName: fromScopeWithName: fromDatabaseWithName: withResolver: withRejecter: )
173- func collection_DeleteCollection (
172+ @objc ( collection_DeleteIndex : fromCollectionWithName: fromScopeWithName: fromDatabaseWithName: withResolver: withRejecter: )
173+ func collection_DeleteIndex (
174174 indexName: NSString ,
175175 collectionName: NSString ,
176176 scopeName: NSString ,
Original file line number Diff line number Diff line change @@ -169,7 +169,21 @@ export class CblReactNativeEngine implements ICoreEngine {
169169 }
170170
171171 collection_DeleteIndex ( args : CollectionDeleteIndexArgs ) : Promise < void > {
172- return Promise . resolve ( undefined ) ;
172+ return new Promise ( ( resolve , reject ) => {
173+ this . CblReactNative . collection_DeleteIndex (
174+ args . indexName ,
175+ args . collectionName ,
176+ args . scopeName ,
177+ args . name
178+ ) . then (
179+ ( ) => {
180+ resolve ( ) ;
181+ } ,
182+ ( error : any ) => {
183+ reject ( error ) ;
184+ }
185+ ) ;
186+ } ) ;
173187 }
174188
175189 collection_GetBlobContent (
You can’t perform that action at this time.
0 commit comments