Skip to content
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

SDK 48 'Modular Headers' Fix #16

Merged
merged 9 commits into from
May 12, 2023
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
2 changes: 1 addition & 1 deletion build/withWatermelon.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const withCocoaPods = (config) => {
slicedContent[0] += `\n
pod 'WatermelonDB', :path => '../node_modules/@nozbe/watermelondb'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
pod 'simdjson', path: '../node_modules/@nozbe/simdjson'\n\n `;
pod 'simdjson', path: '../node_modules/@nozbe/simdjson', :modular_headers => true\n\n `;
await fs.writeFile(filePath, slicedContent.join(patchKey));
}
else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@morrowdigital/watermelondb-expo-plugin",
"version": "2.1.0",
"version": "2.1.1",
"main": "build/withWatermelon.js",
"types": "build/withWatermelon.d.ts",
"license": "MIT",
Expand Down
30 changes: 1 addition & 29 deletions src/withWatermelon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,33 +102,6 @@ import java.util.ArrayList;`,
]);
}

/**
* Platform: iOS
* */
function setAppDelegate(config: ExportedConfigWithProps) {
return withDangerousMod(config, [
"ios",
async (config) => {
const filePath = getPlatformProjectFilePath(config, 'AppDelegate.h')
const contents = await fs.readFile(filePath, "utf-8");

let updated =
`#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTViewManager.h>
#import <React/RCTBridgeModule.h>

// Silence warning
#import "../../node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h"\n
` + contents;

await fs.writeFile(filePath, updated);

return config;
},
]);
}

function setWmelonBridgingHeader(config: ExportedConfigWithProps) {
return withDangerousMod(config, [
"ios",
Expand Down Expand Up @@ -172,7 +145,7 @@ const withCocoaPods = (config: ExportedConfigWithProps) => {
slicedContent[0] += `\n
pod 'WatermelonDB', :path => '../node_modules/@nozbe/watermelondb'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
pod 'simdjson', path: '../node_modules/@nozbe/simdjson'\n\n `;
pod 'simdjson', path: '../node_modules/@nozbe/simdjson', :modular_headers => true\n\n `;
await fs.writeFile(filePath, slicedContent.join(patchKey));
} else {
throw new Error("Please make sure you have watermelondb installed");
Expand Down Expand Up @@ -235,7 +208,6 @@ export default (config, options) => {
// config = setAppBuildGradle(config);
config = setAndroidMainApplication(config);
config = addFlipperDb(config, options?.databases ?? []);
config = setAppDelegate(config);
config = setWmelonBridgingHeader(config);
config = withCocoaPods(config);
if (options?.excludeSimulatorArchitectures ?? true) {
Expand Down