Skip to content

Commit

Permalink
Merge pull request #16 from TheLonelyAstronaut/main
Browse files Browse the repository at this point in the history
SDK 48 'Modular Headers' Fix
brunokiafuka authored May 12, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 6abcc70 + f9b8a57 commit c46c975
Showing 3 changed files with 3 additions and 31 deletions.
2 changes: 1 addition & 1 deletion build/withWatermelon.js
Original file line number Diff line number Diff line change
@@ -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 {
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",
30 changes: 1 addition & 29 deletions src/withWatermelon.ts
Original file line number Diff line number Diff line change
@@ -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",
@@ -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");
@@ -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) {

0 comments on commit c46c975

Please sign in to comment.