From 835a8f0deb87890b6ef6509fcb7bcb88263c51e5 Mon Sep 17 00:00:00 2001 From: verystone Date: Tue, 1 Mar 2022 10:13:25 +0800 Subject: [PATCH] Modify data share extension api to async method Signed-off-by: verystone --- ...application.DataShareExtensionAbility.d.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/api/@ohos.application.DataShareExtensionAbility.d.ts b/api/@ohos.application.DataShareExtensionAbility.d.ts index dce6c206a8..495ac85091 100644 --- a/api/@ohos.application.DataShareExtensionAbility.d.ts +++ b/api/@ohos.application.DataShareExtensionAbility.d.ts @@ -62,7 +62,7 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the MIME type of the matched files; returns null if there is no type that matches the Data */ - getFileTypes?(uri: string, mimeTypeFilter: string): Array; + getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; /** * Inserts a data record into the database. This method should be implemented by a data share. @@ -74,7 +74,7 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the index of the newly inserted data record. */ - insert?(uri: string, valueBucket: rdb.ValuesBucket): number; + insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback): void; /** * Updates one or more data records in the database. This method should be implemented by a data share. @@ -88,7 +88,8 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the number of data records updated. */ - update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates): number; + update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, + callback: AsyncCallback): void; /** * Deletes one or more data records. This method should be implemented by a data share. @@ -101,7 +102,7 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the number of data records deleted. */ - delete?(uri: string, predicates: dataAbility.DataAbilityPredicates): number; + delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; /** * Queries one or more data records in the database. This method should be implemented by a data share. @@ -116,7 +117,8 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the queried data. */ - query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates): ResultSet; + query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, + callback: AsyncCallback): void; /** * Obtains the MIME type matching the data specified by the URI of the data share. This method should be @@ -130,7 +132,7 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the MIME type that matches the data specified by {@code uri}. */ - getType?(uri: string): string; + getType?(uri: string, callback: AsyncCallback): void; /** * Inserts multiple data records into the database. This method should be implemented by a data share. @@ -142,7 +144,7 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the number of data records inserted. */ - batchInsert?(uri: string, valueBuckets: Array): number; + batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; /** * Converts the given {@code uri} that refer to the data share into a normalized URI. A normalized URI can be @@ -155,7 +157,7 @@ export default class DataShareExtensionAbility { * @systemapi Hide this for inner system use. * @return Returns the normalized uri if the data share supports URI normalization; */ - normalizeUri?(uri: string): string; + normalizeUri?(uri: string, callback: AsyncCallback): void; /** * Converts the given normalized {@code uri} generated by {@link #normalizeUri(uri)} into a denormalized one. @@ -169,5 +171,5 @@ export default class DataShareExtensionAbility { * {@code uri} passed to this method if there is nothing to do; returns {@code null} if the data identified by * the original {@code uri} cannot be found in the current environment. */ - denormalizeUri?(uri: string): string; + denormalizeUri?(uri: string, callback: AsyncCallback): void; } \ No newline at end of file -- Gitee