Skip to content

Commit

Permalink
fix: lib crashing when proguard is enabled (#93)
Browse files Browse the repository at this point in the history
* fix: lib crashing when proguard is enabled

* chore: update example to test proguard
  • Loading branch information
matinzd authored May 16, 2024
1 parent 5d13f58 commit b296bd5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ android {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
consumerProguardFiles "proguard-rules.pro"
}
buildTypes {
release {
Expand Down
1 change: 1 addition & 0 deletions android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-keep class dev.matinzd.healthconnect.records.** { *; }
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ react {
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
def enableProguardInReleaseBuilds = false
def enableProguardInReleaseBuilds = true

/**
* The preferred build flavor of JavaScriptCore (JSC)
Expand Down
30 changes: 20 additions & 10 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ export default function App() {
startTime: getLastWeekDate().toISOString(),
endTime: getTodayDate().toISOString(),
},
]).then((ids) => {
console.log('Records inserted ', { ids });
});
])
.then((ids) => {
console.log('Records inserted ', { ids });
})
.catch((err) => {
console.error('Error inserting records ', { err });
});
};

const readSampleData = () => {
Expand All @@ -71,17 +75,23 @@ export default function App() {
startTime: getLastTwoWeeksDate().toISOString(),
endTime: getTodayDate().toISOString(),
},
}).then((result) => {
console.log('Retrieved records: ', JSON.stringify({ result }, null, 2));
});
})
.then((result) => {
console.log('Retrieved records: ', JSON.stringify({ result }, null, 2));
})
.catch((err) => {
console.error('Error reading records ', { err });
});
};

const readSampleDataSingle = () => {
readRecord('Steps', 'a7bdea65-86ce-4eb2-a9ef-a87e6a7d9df2').then(
(result) => {
readRecord('Steps', 'a7bdea65-86ce-4eb2-a9ef-a87e6a7d9df2')
.then((result) => {
console.log('Retrieved record: ', JSON.stringify({ result }, null, 2));
}
);
})
.catch((err) => {
console.error('Error reading record ', { err });
});
};

const aggregateSampleData = () => {
Expand Down

0 comments on commit b296bd5

Please sign in to comment.