Skip to content

refactor:由android codegen版本转为harmony新codegen版本 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
*/

#include "RNOH/Package.h"
#include "RNAsyncStorageTurboModule.h"
#include "RNCAsyncStorage.h"

using namespace rnoh;
using namespace facebook;
class NativeRNAsyncStorageFactoryDelegate : public TurboModuleFactoryDelegate {
public:
SharedTurboModule createTurboModule(Context ctx,const std::string &name) const override {
if (name == "RNCAsyncStorage") {
return std::make_shared<RNAsyncStorageTurboModule>(ctx, name);
return std::make_shared<RNCAsyncStorage>(ctx, name);
}
return nullptr;
};
Expand All @@ -45,4 +45,4 @@ class AsyncStoragePackage : public Package {
return std::make_unique<NativeRNAsyncStorageFactoryDelegate>();
}
};
} // namespace rnoh
} // namespace rnoh

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

/**
* This code was generated by "react-native codegen-harmony"
*
* Do not edit this file as changes may cause incorrect behavior and will be
* lost once the code is regenerated.
*
* @generatorVersion: 2
*/
#include "RNCAsyncStorage.h"

namespace rnoh {
using namespace facebook;

RNCAsyncStorage::RNCAsyncStorage(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
methodMap_ = {
ARK_METHOD_METADATA(multiGet, 2),
ARK_METHOD_METADATA(multiSet, 2),
ARK_METHOD_METADATA(multiRemove, 2),
ARK_METHOD_METADATA(multiMerge, 2),
ARK_METHOD_METADATA(getAllKeys, 1),
ARK_METHOD_METADATA(clear, 1),
};
}

} // namespace rnoh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

/**
* This code was generated by "react-native codegen-harmony"
*
* Do not edit this file as changes may cause incorrect behavior and will be
* lost once the code is regenerated.
*
* @generatorVersion: 2
*/
#pragma once

#include "RNOH/ArkTSTurboModule.h"

namespace rnoh {

class JSI_EXPORT RNCAsyncStorage : public ArkTSTurboModule {
public:
RNCAsyncStorage(const ArkTSTurboModule::Context ctx, const std::string name);
};

} // namespace rnoh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* This code was generated by "react-native codegen-harmony"
*
* Do not edit this file as changes may cause incorrect behavior and will be
* lost once the code is regenerated.
*
* @generatorVersion: 2
*/

export namespace RNCAsyncStorage {
export const NAME = 'RNCAsyncStorage' as const

export interface Spec {
multiGet(keys: string[], callback: (error: unknown[], result: unknown[]) => void): void;

multiSet(kvPairs: unknown[], callback: (error: unknown[]) => void): void;

multiRemove(keys: string[], callback: (error: unknown[]) => void): void;

multiMerge(kvPairs: unknown[], callback: (error: unknown[]) => void): void;

getAllKeys(callback: (error: unknown[], result: unknown[]) => void): void;

clear(callback: (error: unknown[]) => void): void;

}
}
8 changes: 7 additions & 1 deletion packages/default-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
"registry": "https://npm.pkg.github.com"
},
"harmony": {
"alias": "@react-native-async-storage/async-storage"
"alias": "@react-native-async-storage/async-storage",
"codegenConfig": {
"version": 2,
"specPaths": [
"./src"
]
}
},
"files": [
"harmony/",
Expand Down
Loading