Skip to content

Commit c4891c0

Browse files
committed
chore: changelog format
# Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Sat Apr 20 14:53:36 2024 +0900 # # On branch main # Your branch is ahead of 'origin/main' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: lerna.json # # Changes not staged for commit: # modified: lerna.json #
1 parent 0b5b8b1 commit c4891c0

12 files changed

+167
-15
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ please select the package link from below.
3434

3535
| Name | Downloads | Status |
3636
|--------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------:|--------|
37+
| [Core](/packages/core) | [![badge](https://img.shields.io/npm/dm/@react-native-kakao/core.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@react-native-kakao/core) ||
3738
| [Share](/packages/share) | [![badge](https://img.shields.io/npm/dm/@react-native-kakao/share.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@react-native-kakao/share) | 🔥 |
3839
| [User](/packages/user) | [![badge](https://img.shields.io/npm/dm/@react-native-kakao/user.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@react-native-kakao/user) | 📦 |
3940
| [Map](/packages/map) | [![badge](https://img.shields.io/npm/dm/@react-native-kakao/map.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@react-native-kakao/map) | 📦 |

example/src/App.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import * as React from 'react';
22

33
import { StyleSheet, View, Text } from 'react-native';
44
import { add } from '@react-native-kakao/share';
5-
import { core } from '@react-native-kakao/core';
5+
import { initKakaoSDK } from '@react-native-kakao/core';
66

77
// console.log(M);
88
export default function App() {
99
const [result, setResult] = React.useState<number | undefined>();
1010

1111
React.useEffect(() => {
12-
core();
12+
initKakaoSDK();
1313
setResult(add(3, 7) + add(1, 222));
1414
}, []);
1515

lerna.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
"**/__fixtures__/**",
2323
"**/__tests__/**",
2424
"**/*.md",
25-
"**/example/**"
25+
"**/example/**",
26+
"**/docs/**",
27+
"**/.github/**",
28+
"**/e2e/**",
29+
"**/tests/**"
2630
]
2731
}
2832
},
@@ -83,6 +87,5 @@
8387
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
8488
"compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
8589
"userUrlFormat": "{{host}}/{{user}}"
86-
},
87-
"ignoreChanges": ["**/docs/**", "**/.github/**", "**/e2e/**", "**/tests/**"]
90+
}
8891
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
"android": "yarn example android",
3333
"ios": "yarn example ios",
3434
"dev": "yarn example start",
35-
"gen:android": "yarn example prebuild:android",
36-
"gen:ios": "yarn example prebuild:ios",
35+
"build:android": "yarn example prebuild:android",
36+
"build:ios": "yarn example prebuild:ios",
3737
"studio": "studio $(pwd)/example/android",
3838
"xcode": "open $(pwd)/example/ios/KakaoExample.xcworkspace",
3939
"pod:old": "yarn example pod:old",

packages/core/RNCKakaoCore.podspec

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
require "json"
2+
3+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4+
corePackage = JSON.parse(File.read(File.join(__dir__, "..", "core", "package.json")))
5+
sdk_version = corePackage['sdkVersions']['ios']['core']
6+
7+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
8+
9+
Pod::Spec.new do |s|
10+
s.name = "RNCKakaoCore"
11+
s.version = package["version"]
12+
s.summary = package["description"]
13+
s.homepage = package["homepage"]
14+
s.license = package["license"]
15+
s.authors = package["author"]
16+
17+
s.platforms = { :ios => min_ios_version_supported }
18+
s.source = { :git => "https://github.com/mj-studio-library/react-native-kakao.git", :tag => "#{s.version}" }
19+
20+
s.source_files = "ios/**/*.{h,m,mm}"
21+
22+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
24+
if respond_to?(:install_modules_dependencies, true)
25+
install_modules_dependencies(s)
26+
else
27+
s.dependency "React-Core"
28+
29+
# Don't install the dependencies when we run `pod install` in the old architecture.
30+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
31+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
32+
s.pod_target_xcconfig = {
33+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
34+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
35+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
36+
}
37+
s.dependency "React-Codegen"
38+
s.dependency "RCT-Folly"
39+
s.dependency "RCTRequired"
40+
s.dependency "RCTTypeSafety"
41+
s.dependency "ReactCommon/turbomodule/core"
42+
end
43+
end
44+
45+
# Override Version by User
46+
if defined?($KakaoCoreSDKVersion)
47+
Pod::UI.puts "#{s.name}: Using user specified Firebase SDK version '#{$KakaoCoreSDKVersion}'"
48+
sdk_version = $KakaoCoreSDKVersion
49+
end
50+
51+
# Kakao dependencies
52+
s.dependency 'KakaoSDKCommon', sdk_version
53+
end

packages/core/ios/RNCKakaoCore.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
#ifdef RCT_NEW_ARCH_ENABLED
3+
#import "RNCKakaoCoreSpec.h"
4+
5+
@interface RNCKakaoCore : NSObject <NativeKakaoCoreSpec>
6+
#else
7+
#import <React/RCTBridgeModule.h>
8+
9+
@interface RNCKakaoCore : NSObject <RCTBridgeModule>
10+
#endif
11+
12+
@end

packages/core/ios/RNCKakaoShare.mm

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#import "RNCKakaoCore.h"
2+
3+
@implementation RNCKakaoCore
4+
RCT_EXPORT_MODULE()
5+
6+
// Example method
7+
// See // https://reactnative.dev/docs/native-modules-ios
8+
RCT_EXPORT_METHOD(multiply
9+
: (double)a b
10+
: (double)b resolve
11+
: (RCTPromiseResolveBlock)resolve reject
12+
: (RCTPromiseRejectBlock)reject) {
13+
NSNumber* result = @(a * b);
14+
15+
resolve(result);
16+
}
17+
18+
- (NSNumber*)add:(double)a b:(double)b {
19+
return @(a + b);
20+
}
21+
22+
// Don't compile this code when we build for the old architecture.
23+
#ifdef RCT_NEW_ARCH_ENABLED
24+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
25+
(const facebook::react::ObjCTurboModule::InitParams&)params {
26+
return std::make_shared<facebook::react::NativeKakaoCoreSpecJSI>(params);
27+
}
28+
#endif
29+
30+
@end

packages/core/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,12 @@
104104
"name": "RNCKakaoCoreSpec",
105105
"type": "all",
106106
"jsSrcsDir": "src"
107+
},
108+
"sdkVersions": {
109+
"ios": {
110+
"core": "2.14.0",
111+
"share": "2.14.0"
112+
},
113+
"android": {}
107114
}
108115
}

packages/core/src/index.tsx

+28-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1-
export function core() {
2-
console.log('core');
1+
import { NativeModules, Platform } from 'react-native';
2+
3+
const LINKING_ERROR =
4+
`The package '@react-native-kakao/core' doesn't seem to be linked. Make sure: \n\n` +
5+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6+
'- You rebuilt the app after installing the package\n' +
7+
'- You are not using Expo Go\n';
8+
9+
// @ts-expect-error
10+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
11+
12+
const Module = isTurboModuleEnabled
13+
? require('./spec/NativeKakaoShare').default
14+
: NativeModules.KakaoShare;
15+
16+
const Native = Module
17+
? Module
18+
: new Proxy(
19+
{},
20+
{
21+
get() {
22+
throw new Error(LINKING_ERROR);
23+
},
24+
}
25+
);
26+
27+
export function initKakaoSDK() {
28+
Native.init();
329
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { TurboModule } from 'react-native';
2+
import { TurboModuleRegistry } from 'react-native';
3+
4+
export interface Spec extends TurboModule {
5+
init(): void;
6+
}
7+
8+
export default TurboModuleRegistry.getEnforcing<Spec>('RNCKakaoCore');

packages/share/RNCKakaoShare.podspec

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4+
corePackage = JSON.parse(File.read(File.join(__dir__, "..", "core", "package.json")))
5+
sdk_version = corePackage['sdkVersions']['ios']['share']
6+
47
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
58

69
Pod::Spec.new do |s|
@@ -37,5 +40,14 @@ Pod::Spec.new do |s|
3740
s.dependency "RCTTypeSafety"
3841
s.dependency "ReactCommon/turbomodule/core"
3942
end
40-
end
43+
end
44+
45+
# Override Version by User
46+
if defined?($KakaoShareSDKVersion)
47+
Pod::UI.puts "#{s.name}: Using user specified Firebase SDK version '#{$KakaoShareSDKVersion}'"
48+
sdk_version = $KakaoShareSDKVersion
49+
end
50+
51+
# Kakao dependencies
52+
s.dependency 'KakaoSDKShare', sdk_version
4153
end

packages/share/src/index.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const LINKING_ERROR =
99
// @ts-expect-error
1010
const isTurboModuleEnabled = global.__turboModuleProxy != null;
1111

12-
const KakaoShareModule = isTurboModuleEnabled
12+
const Module = isTurboModuleEnabled
1313
? require('./spec/NativeKakaoShare').default
1414
: NativeModules.KakaoShare;
1515

16-
const KakaoShare = KakaoShareModule
17-
? KakaoShareModule
16+
const Native = Module
17+
? Module
1818
: new Proxy(
1919
{},
2020
{
@@ -25,9 +25,9 @@ const KakaoShare = KakaoShareModule
2525
);
2626

2727
export function multiply(a: number, b: number): Promise<number> {
28-
return KakaoShare.multiply(a, b);
28+
return Native.multiply(a, b);
2929
}
3030

3131
export function add(a: number, b: number): number {
32-
return KakaoShare.add(a, b);
32+
return Native.add(a, b);
3333
}

0 commit comments

Comments
 (0)