@react-native-ohos/react-native-mail 6.1.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +14 -0
- package/harmony/mail/BuildProfile.ets +17 -0
- package/harmony/mail/build-profile.json5 +31 -0
- package/harmony/mail/consumer-rules.txt +0 -0
- package/harmony/mail/hvigorfile.ts +6 -0
- package/harmony/mail/index.ets +7 -0
- package/harmony/mail/obfuscation-rules.txt +18 -0
- package/harmony/mail/oh-package.json5 +13 -0
- package/harmony/mail/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/mail/src/main/cpp/MailPackage.h +19 -0
- package/harmony/mail/src/main/cpp/generated/RNOH/generated/BaseReactNativeMailPackage.h +72 -0
- package/harmony/mail/src/main/cpp/generated/RNOH/generated/turbo_modules/RNMail.cpp +16 -0
- package/harmony/mail/src/main/cpp/generated/RNOH/generated/turbo_modules/RNMail.h +16 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/ComponentDescriptors.h +24 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/EventEmitters.cpp +16 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/EventEmitters.h +17 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/Props.cpp +19 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/Props.h +18 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/ShadowNodes.cpp +17 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/ShadowNodes.h +23 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/States.cpp +16 -0
- package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/States.h +19 -0
- package/harmony/mail/src/main/ets/Logger.ts +64 -0
- package/harmony/mail/src/main/ets/RNMailPackge.ts +47 -0
- package/harmony/mail/src/main/ets/RNMailTurboModule.ts +123 -0
- package/harmony/mail/src/main/ets/constant.ts +30 -0
- package/harmony/mail/src/main/ets/generated/components/ts.ts +5 -0
- package/harmony/mail/src/main/ets/generated/index.ets +5 -0
- package/harmony/mail/src/main/ets/generated/ts.ts +6 -0
- package/harmony/mail/src/main/ets/generated/turboModules/RNMail.ts +16 -0
- package/harmony/mail/src/main/ets/generated/turboModules/ts.ts +5 -0
- package/harmony/mail/src/main/ets/types.ts +24 -0
- package/harmony/mail/src/main/module.json5 +11 -0
- package/harmony/mail/src/main/resources/base/element/string.json +8 -0
- package/harmony/mail/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/mail/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/mail/ts.ts +8 -0
- package/harmony/mail.har +0 -0
- package/index.d.ts +23 -0
- package/index.js +5 -0
- package/package.json +46 -0
- package/src/NativeRNMail.harmonys.ts +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Chirag Jain
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "react-native-mail",
|
|
4
|
+
"License": "MIT License",
|
|
5
|
+
"License File": "https://github.com/chirag04/react-native-mail/blob/master/LICENSE",
|
|
6
|
+
"Version Number": "6.1.1-0.0.1",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/chirag04/react-native-mail",
|
|
9
|
+
"Description": "mail for react-native"
|
|
10
|
+
}
|
|
11
|
+
]
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @react-native-ohos/react-native-mail
|
|
2
|
+
|
|
3
|
+
This project is based on [react-native-mail](https://github.com/chirag04/react-native-mail)
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- [中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-mail.md)
|
|
8
|
+
|
|
9
|
+
- [English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-mail.md)
|
|
10
|
+
|
|
11
|
+
## License
|
|
12
|
+
|
|
13
|
+
This library is licensed under [The MIT License (MIT)](https://github.com/chirag04/react-native-mail/blob/master/LICENSE)
|
|
14
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use these variables when you tailor your ArkTS code. They must be of the const type.
|
|
3
|
+
*/
|
|
4
|
+
export const HAR_VERSION = '6.1.1-0.0.1';
|
|
5
|
+
export const BUILD_MODE_NAME = 'debug';
|
|
6
|
+
export const DEBUG = true;
|
|
7
|
+
export const TARGET_NAME = 'default';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* BuildProfile Class is used only for compatibility purposes.
|
|
11
|
+
*/
|
|
12
|
+
export default class BuildProfile {
|
|
13
|
+
static readonly HAR_VERSION = HAR_VERSION;
|
|
14
|
+
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
|
|
15
|
+
static readonly DEBUG = DEBUG;
|
|
16
|
+
static readonly TARGET_NAME = TARGET_NAME;
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiType": "stageMode",
|
|
3
|
+
"buildOption": {
|
|
4
|
+
},
|
|
5
|
+
"buildOptionSet": [
|
|
6
|
+
{
|
|
7
|
+
"name": "release",
|
|
8
|
+
"arkOptions": {
|
|
9
|
+
"obfuscation": {
|
|
10
|
+
"ruleOptions": {
|
|
11
|
+
"enable": true,
|
|
12
|
+
"files": [
|
|
13
|
+
"./obfuscation-rules.txt"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"consumerFiles": [
|
|
17
|
+
"./consumer-rules.txt"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
"targets": [
|
|
24
|
+
{
|
|
25
|
+
"name": "default"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "ohosTest"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Define project specific obfuscation rules here.
|
|
2
|
+
# You can include the obfuscation configuration files in the current module's build-profile.json5.
|
|
3
|
+
#
|
|
4
|
+
# For more details, see
|
|
5
|
+
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
|
|
6
|
+
|
|
7
|
+
# Obfuscation options:
|
|
8
|
+
# -disable-obfuscation: disable all obfuscations
|
|
9
|
+
# -enable-property-obfuscation: obfuscate the property names
|
|
10
|
+
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
|
|
11
|
+
# -compact: remove unnecessary blank spaces and all line feeds
|
|
12
|
+
# -remove-log: remove all console.* statements
|
|
13
|
+
# -print-namecache: print the name cache that contains the mapping from the old names to new names
|
|
14
|
+
# -apply-namecache: reuse the given cache file
|
|
15
|
+
|
|
16
|
+
# Keep options:
|
|
17
|
+
# -keep-property-name: specifies property names that you want to keep
|
|
18
|
+
# -keep-global-name: specifies names that you want to keep in the global scope
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-mail",
|
|
3
|
+
"version": "6.1.2-rc.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.ets",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@rnoh/react-native-openharmony": "file:../react_native_openharmony"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {},
|
|
12
|
+
"dynamicDependencies": {}
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.13)
|
|
2
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
|
+
|
|
4
|
+
set(rnoh_mail_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
|
|
5
|
+
file(GLOB_RECURSE rnoh_mail_generated_SRC "${rnoh_mail_generated_dir}/**/*.cpp")
|
|
6
|
+
file(GLOB rnoh_mail_SRC CONFIGURE_DEPENDS *.cpp)
|
|
7
|
+
add_library(rnoh_mail SHARED ${rnoh_mail_SRC} ${rnoh_mail_generated_SRC})
|
|
8
|
+
target_include_directories(rnoh_mail PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_mail_generated_dir} ${CMAKE_CURRENT_SOURCE_DIR}/generated/RNOH/generated)
|
|
9
|
+
target_link_libraries(rnoh_mail PUBLIC rnoh)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a MIT license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#ifndef MAILPACKAGE_H
|
|
6
|
+
#define MAILPACKAGE_H
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#include "generated/RNOH/generated/BaseReactNativeMailPackage.h"
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
namespace rnoh {
|
|
14
|
+
class MailPackage : public BaseReactNativeMailPackage {
|
|
15
|
+
using Super = BaseReactNativeMailPackage;
|
|
16
|
+
using Super::Super;
|
|
17
|
+
};
|
|
18
|
+
} // namespace rnoh
|
|
19
|
+
#endif //MAILPACKAGE_H
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "RNOH/Package.h"
|
|
8
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
9
|
+
#include "RNOH/generated/turbo_modules/RNMail.h"
|
|
10
|
+
|
|
11
|
+
namespace rnoh {
|
|
12
|
+
|
|
13
|
+
class BaseReactNativeMailPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
14
|
+
public:
|
|
15
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
16
|
+
if (name == "RNMail") {
|
|
17
|
+
return std::make_shared<RNMail>(ctx, name);
|
|
18
|
+
}
|
|
19
|
+
return nullptr;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
class BaseReactNativeMailPackageEventEmitRequestHandler : public EventEmitRequestHandler {
|
|
24
|
+
public:
|
|
25
|
+
void handleEvent(Context const &ctx) override {
|
|
26
|
+
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
27
|
+
auto componentName = ctx.shadowViewRegistry->getComponentName(ctx.tag);
|
|
28
|
+
|
|
29
|
+
if (eventEmitter == nullptr) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
std::vector<std::string> supportedComponentNames = {
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
std::vector<std::string> supportedEventNames = {
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (std::find(supportedComponentNames.begin(), supportedComponentNames.end(), componentName) != supportedComponentNames.end() &&
|
|
40
|
+
std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
41
|
+
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class BaseReactNativeMailPackage : public Package {
|
|
48
|
+
public:
|
|
49
|
+
BaseReactNativeMailPackage(Package::Context ctx) : Package(ctx){};
|
|
50
|
+
|
|
51
|
+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
|
|
52
|
+
return std::make_unique<BaseReactNativeMailPackageTurboModuleFactoryDelegate>();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
56
|
+
return {
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
|
61
|
+
return {
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
|
|
66
|
+
return {
|
|
67
|
+
std::make_shared<BaseReactNativeMailPackageEventEmitRequestHandler>(),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include "RNMail.h"
|
|
6
|
+
|
|
7
|
+
namespace rnoh {
|
|
8
|
+
using namespace facebook;
|
|
9
|
+
|
|
10
|
+
RNMail::RNMail(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
|
|
11
|
+
methodMap_ = {
|
|
12
|
+
ARK_METHOD_METADATA(mail, 2),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
8
|
+
|
|
9
|
+
namespace rnoh {
|
|
10
|
+
|
|
11
|
+
class JSI_EXPORT RNMail : public ArkTSTurboModule {
|
|
12
|
+
public:
|
|
13
|
+
RNMail(const ArkTSTurboModule::Context ctx, const std::string name);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ShadowNodes.h"
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
void react_native_mail_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/Props.cpp
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "Props.h"
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
} // namespace facebook::react
|
package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/Props.h
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "EventEmitters.h"
|
|
14
|
+
#include "Props.h"
|
|
15
|
+
#include "States.h"
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
} // namespace facebook::react
|
package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/States.cpp
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include "States.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
package/harmony/mail/src/main/cpp/generated/react/renderer/components/react_native_mail/States.h
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import hilog from '@ohos.hilog';
|
|
26
|
+
|
|
27
|
+
class Logger {
|
|
28
|
+
private domain: number;
|
|
29
|
+
private prefix: string;
|
|
30
|
+
private format: string = '%{public}s, %{public}s';
|
|
31
|
+
private isDebug: boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* constructor.
|
|
35
|
+
*
|
|
36
|
+
* @param Prefix Identifies the log tag.
|
|
37
|
+
* @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
|
|
38
|
+
*/
|
|
39
|
+
constructor(prefix: string = 'MyApp', domain: number = 0xFF00, isDebug = false) {
|
|
40
|
+
this.prefix = prefix;
|
|
41
|
+
this.domain = domain;
|
|
42
|
+
this.isDebug = isDebug;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
debug(...args: string[]): void {
|
|
46
|
+
if (this.isDebug) {
|
|
47
|
+
hilog.debug(this.domain, this.prefix, this.format, args);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
info(...args: string[]): void {
|
|
52
|
+
hilog.info(this.domain, this.prefix, this.format, args);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
warn(...args: string[]): void {
|
|
56
|
+
hilog.warn(this.domain, this.prefix, this.format, args);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
error(...args: string[]): void {
|
|
60
|
+
hilog.error(this.domain, this.prefix, this.format, args);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default new Logger('RNMail', 0xFF00, false)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
|
|
26
|
+
import type { TurboModule, TurboModuleContext, } from '@rnoh/react-native-openharmony/ts';
|
|
27
|
+
import { TM } from "./generated/ts"
|
|
28
|
+
import { RNMailTurboModule } from './RNMailTurboModule';
|
|
29
|
+
|
|
30
|
+
class RNMailTurboModulesFactory extends TurboModulesFactory {
|
|
31
|
+
createTurboModule(name: string): TurboModule | null {
|
|
32
|
+
if (name === 'RNMail' || name === TM.RNMail.NAME) {
|
|
33
|
+
return new RNMailTurboModule(this.ctx);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
hasTurboModule(name: string): boolean {
|
|
39
|
+
return name === 'RNMail' || name === TM.RNMail.NAME;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class RNMailPackage extends RNPackage {
|
|
44
|
+
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
|
|
45
|
+
return new RNMailTurboModulesFactory(ctx);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { Want } from '@kit.AbilityKit';
|
|
25
|
+
import { BusinessError } from '@kit.BasicServicesKit';
|
|
26
|
+
import fileUri from '@ohos.file.fileuri';
|
|
27
|
+
import { TurboModule } from '@rnoh/react-native-openharmony/ts';
|
|
28
|
+
import { TM } from "./generated/ts";
|
|
29
|
+
import Logger from './Logger';
|
|
30
|
+
import { mainOptions } from './types';
|
|
31
|
+
import { supportedMimeTypes } from './constant';
|
|
32
|
+
|
|
33
|
+
const TAG = 'RNMail';
|
|
34
|
+
|
|
35
|
+
export class RNMailTurboModule extends TurboModule implements TM.RNMail.Spec {
|
|
36
|
+
constructor(ctx) {
|
|
37
|
+
super(ctx);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
mail({ subject= '', recipients=[], body='', ccRecipients=[], bccRecipients=[] }: mainOptions, callback: Function) {
|
|
41
|
+
let mailUri: string = '';
|
|
42
|
+
mailUri += recipients?.join(',') || '';
|
|
43
|
+
mailUri += '?cc=' + ccRecipients?.join(',') || '';
|
|
44
|
+
mailUri += '&bcc=' + bccRecipients?.join(',') || '';
|
|
45
|
+
mailUri += '&subject=' + subject;
|
|
46
|
+
mailUri += '&body=' + encodeURIComponent(body);
|
|
47
|
+
this.startEmailApp(mailUri, callback);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 拉起应用
|
|
51
|
+
startEmailApp = (mailUri, callback) => {
|
|
52
|
+
let want: Want = {
|
|
53
|
+
bundleName: 'com.huawei.hmos.email',
|
|
54
|
+
abilityName: 'EntryAbility',
|
|
55
|
+
moduleName: 'entry',
|
|
56
|
+
uri: 'mailto:' + mailUri,
|
|
57
|
+
action: 'ohos.want.action.viewData',
|
|
58
|
+
};
|
|
59
|
+
Logger.info(TAG + 'want ', JSON.stringify(want));
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
this.ctx.uiAbilityContext.startAbility(want)
|
|
63
|
+
.then(() => {
|
|
64
|
+
Logger.info(TAG, 'startAbility success');
|
|
65
|
+
})
|
|
66
|
+
.catch((err: BusinessError) => {
|
|
67
|
+
Logger.info(TAG, 'startAbility error.', err.message);
|
|
68
|
+
callback(err.message);
|
|
69
|
+
})
|
|
70
|
+
} catch (e) {
|
|
71
|
+
callback(e);
|
|
72
|
+
Logger.info(TAG + 'error:', e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 获取附件
|
|
77
|
+
getAttachments(options, callback) {
|
|
78
|
+
if (options.attachments && options.attachments.length > 0) {
|
|
79
|
+
let attachments: {
|
|
80
|
+
addAttachmentUri: string,
|
|
81
|
+
mimeType: string,
|
|
82
|
+
name: string,
|
|
83
|
+
}[] = [];
|
|
84
|
+
let mimeType: string = '';
|
|
85
|
+
let uri: string = undefined;
|
|
86
|
+
|
|
87
|
+
for (let i = 0; i < options.attachments.length; i++) {
|
|
88
|
+
if (!options.attachments[i].name && options.attachments[i].path) {
|
|
89
|
+
options.attachments[i].name = getFileName(options.attachments[i].path);
|
|
90
|
+
}
|
|
91
|
+
if (options.attachments[i].path) {
|
|
92
|
+
// 将沙箱路径转换为uri
|
|
93
|
+
uri = fileUri.getUriFromPath(options.attachments[i].path);
|
|
94
|
+
} else if (options.attachments[i].uri) {
|
|
95
|
+
uri = options.attachments[i].uri;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (options.attachments[i].type) {
|
|
99
|
+
if (!supportedMimeTypes[options.attachments[i].type]) {
|
|
100
|
+
callback('Mime type ' + options.attachments[i].type + ' for attachment is not handled');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
mimeType = supportedMimeTypes[options.attachments[i].type];
|
|
104
|
+
} else if (options.attachments[i].mimeType) {
|
|
105
|
+
mimeType = options.attachments[i].mimeType;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
attachments.push({
|
|
109
|
+
addAttachmentUri: uri,
|
|
110
|
+
mimeType: mimeType,
|
|
111
|
+
name: options.attachments[i]?.name,
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
return attachments;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 获取文件名
|
|
120
|
+
const getFileName = (path: string): string => {
|
|
121
|
+
const index: number = path.lastIndexOf('/');
|
|
122
|
+
return path.substr(index + 1);
|
|
123
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const supportedMimeTypes = {
|
|
8
|
+
"jpeg": "image/jpeg",
|
|
9
|
+
"jpg": "image/jpeg",
|
|
10
|
+
"png": "image/png",
|
|
11
|
+
"doc": "application/msword",
|
|
12
|
+
"docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
13
|
+
"ppt": "application/vnd.ms-powerpoint",
|
|
14
|
+
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
15
|
+
"html": "text/html",
|
|
16
|
+
"csv": "text/csv",
|
|
17
|
+
"pdf": "application/pdf",
|
|
18
|
+
"vcard": "text/vcard",
|
|
19
|
+
"json": "application/json",
|
|
20
|
+
"zip": "application/zip",
|
|
21
|
+
"text": "text/*",
|
|
22
|
+
"mp3": "audio/mpeg",
|
|
23
|
+
"wav": "audio/wav",
|
|
24
|
+
"aiff": "audio/aiff",
|
|
25
|
+
"flac": "audio/flac",
|
|
26
|
+
"ogg": "audio/ogg",
|
|
27
|
+
"xls": "application/vnd.ms-excel",
|
|
28
|
+
"ics": "text/calendar",
|
|
29
|
+
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Tag } from "@rnoh/react-native-openharmony/ts"
|
|
6
|
+
|
|
7
|
+
export namespace RNMail {
|
|
8
|
+
export const NAME = 'RNMail' as const
|
|
9
|
+
|
|
10
|
+
export type options = {subject?: string, recipients?: string[], ccRecipients?: string[], bccRecipients?: string[], body?: string, customChooserTitle?: string, isHTML?: boolean, attachments?: {path?: string, uri?: string, type?: string, mimeType?: string, name?: string}[]}
|
|
11
|
+
|
|
12
|
+
export interface Spec {
|
|
13
|
+
mail(option: options, callback: (error: string, event: string) => void): void;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type attachments = {
|
|
8
|
+
path?: string; // Specify either 'path' or 'uri'
|
|
9
|
+
uri?: string; // 以协议开头路径
|
|
10
|
+
type?: string; // Specify either 'type' or 'mimeType'
|
|
11
|
+
mimeType?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type mainOptions = {
|
|
16
|
+
subject?: string | '',
|
|
17
|
+
recipients?: string[],
|
|
18
|
+
ccRecipients?: string[],
|
|
19
|
+
bccRecipients?: string[],
|
|
20
|
+
body?: string | '',
|
|
21
|
+
customChooserTitle?: string|'',
|
|
22
|
+
isHTML?: boolean,
|
|
23
|
+
attachments?: attachments[],
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export * from './src/main/ets/RNMailTurboModule';
|
|
8
|
+
export * from './src/main/ets/RNMailPackge';
|
package/harmony/mail.har
ADDED
|
Binary file
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export namespace Mailer {
|
|
2
|
+
function mail(options: {
|
|
3
|
+
subject?: string;
|
|
4
|
+
recipients?: string[];
|
|
5
|
+
ccRecipients?: string[];
|
|
6
|
+
bccRecipients?: string[];
|
|
7
|
+
body?: string;
|
|
8
|
+
customChooserTitle?: string;
|
|
9
|
+
isHTML?: boolean;
|
|
10
|
+
attachments?: {
|
|
11
|
+
path?: string; // Specify either 'path' or 'uri'
|
|
12
|
+
uri?: string;
|
|
13
|
+
type?: string; // Specify either 'type' or 'mimeType'
|
|
14
|
+
mimeType?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
}[]
|
|
17
|
+
}, callback: (
|
|
18
|
+
error: string,
|
|
19
|
+
event?: string
|
|
20
|
+
) => void): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default Mailer;
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-mail",
|
|
3
|
+
"version": "6.1.2-rc.1",
|
|
4
|
+
"description": "A wrapper on top of MFMailComposeViewController from iOS and Mail Intent on android and e-mail on harmony",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Chirag Jain",
|
|
7
|
+
"email": "jain_chirag04@yahoo.com",
|
|
8
|
+
"url": "http://chiragjain.tumblr.com"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-mail --cpp-output-path ./harmony/mail/src/main/cpp/generated --ets-output-path ./harmony/mail/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeRNMail.harmonys.ts"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/react-native-oh-library/react-native-mail.git"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"registry": "https://registry.npmjs.org/",
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"harmony",
|
|
24
|
+
"src",
|
|
25
|
+
"index.js",
|
|
26
|
+
"index.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"harmony": {
|
|
29
|
+
"alias": "react-native-mail"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"react",
|
|
33
|
+
"react-native",
|
|
34
|
+
"react-component",
|
|
35
|
+
"ios",
|
|
36
|
+
"android",
|
|
37
|
+
"email",
|
|
38
|
+
"MFMailComposeViewController"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"react-native-mail": "6.1.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
|
|
3
|
+
* Use of this source code is governed by a MIT license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
8
|
+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
9
|
+
|
|
10
|
+
interface options {
|
|
11
|
+
subject?: string,
|
|
12
|
+
recipients?: string[],
|
|
13
|
+
ccRecipients?: string[],
|
|
14
|
+
bccRecipients?: string[],
|
|
15
|
+
body?: string,
|
|
16
|
+
customChooserTitle?: string,
|
|
17
|
+
isHTML?: boolean,
|
|
18
|
+
attachments?: {
|
|
19
|
+
path?: string; // Specify either 'path' or 'uri'
|
|
20
|
+
uri?: string;
|
|
21
|
+
type?: string; // Specify either 'type' or 'mimeType'
|
|
22
|
+
mimeType?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
}[],
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Spec extends TurboModule {
|
|
28
|
+
mail(option: options, callback: (error: string, event?: string) => void): void,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default TurboModuleRegistry.get<Spec>('RNMail')!;
|