Compare commits

...

4 Commits

Author SHA1 Message Date
Brandon Presley a9acc6f216 Undo NaN filtering for graphs - 2.24 🚀
We published these changes, yet the error was still
occurring. Leaving this in just lowers performance
for no value.
2024-02-15 13:12:45 +13:00
Brandon Presley fd09758ccf Make SettingsModule.ignoringBattery async 2024-02-14 11:14:43 +13:00
Brandon Presley 5f2327de31 Upgrade react-native-svg 2024-02-13 11:25:37 +13:00
Brandon Presley f9fb190f80 Validate database file imported 2024-02-12 18:48:02 +13:00
9 changed files with 21 additions and 21 deletions

View File

@ -19,8 +19,6 @@ export default function AppLineChart({ labels, data }: ChartProps) {
color: () => colors.primary,
};
const validData = useMemo(() => data.map(d => isNaN(d) ? 0 : d), [data])
const pruned = useMemo(() => {
if (labels.length < 3) return labels;
const newPruned = [labels[0]];
@ -41,7 +39,7 @@ export default function AppLineChart({ labels, data }: ChartProps) {
labels: pruned,
datasets: [
{
data: validData,
data,
},
],
}}

View File

@ -23,7 +23,7 @@ export default function AppPieChart({ options }: { options: Option[] }) {
const data = options.map((option, index) => ({
name: option.label,
value: isNaN(option.value) ? 0 : option.value,
value: option.value,
color: pieChartColors[index],
legendFontColor: colors.onSurface,
legendFontSize: 15,

View File

@ -28,6 +28,7 @@ export default function EditWeight() {
const { params } = useRoute<RouteProp<StackParams, "EditWeight">>();
const { weight } = params;
const { navigate } = useNavigation<NavigationProp<DrawerParams>>();
const { navigate: stackNavigate, goBack } = useNavigation<NavigationProp<StackParams>>();
const [settings, setSettings] = useState<Settings>({} as Settings);
const [value, setValue] = useState(weight.value?.toString());
const [unit, setUnit] = useState(weight.unit);
@ -58,7 +59,8 @@ export default function EditWeight() {
await weightRepo.save(newWeight);
if (settings.notify) await checkWeekly();
navigate("Weight");
goBack();
stackNavigate("ViewWeightGraph");
};
const checkWeekly = async () => {

View File

@ -71,7 +71,7 @@ export default function SettingsPage() {
} = useAppTheme();
useEffect(() => {
NativeModules.SettingsModule.ignoringBattery(setIgnoring);
NativeModules.SettingsModule.ignoringBattery().then(setIgnoring);
NativeModules.SettingsModule.is24().then((is24: boolean) => {
console.log(`${SettingsPage.name}.focus:`, { is24 });
if (is24) setFormatOptions(twentyFours);
@ -107,6 +107,8 @@ export default function SettingsPage() {
);
await AppDataSource.destroy();
const file = await DocumentPicker.pickSingle();
if (!file.uri.endsWith('.db'))
return toast("File name must end with .db")
await FileSystem.cp(file.uri, Dirs.DatabaseDir + "/massive.db");
try {

View File

@ -36,11 +36,9 @@ export default function ViewGraph() {
}, []))
const convertWeight = (weight: number, unitFrom: string, unitTo: string) => {
let result = weight;
if (unitFrom === unitTo) result = weight;
if (unitFrom === 'lb' && unitTo === 'kg') result = weight * 0.453592;
if (unitFrom === 'kg' && unitTo === 'lb') result = weight * 2.20462;
return isNaN(result) ? 0 : result;
if (unitFrom === unitTo) return weight
if (unitFrom === 'lb' && unitTo === 'kg') return weight * 0.453592;
if (unitFrom === 'kg' && unitTo === 'lb') return weight * 2.20462;
};
useEffect(() => {

View File

@ -85,8 +85,8 @@ android {
applicationId "com.massive"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 36238
versionName "2.23"
versionCode 36239
versionName "2.24"
}
signingConfigs {
release {

View File

@ -21,13 +21,13 @@ class SettingsModule constructor(context: ReactApplicationContext?) :
@RequiresApi(Build.VERSION_CODES.M)
@ReactMethod
fun ignoringBattery(callback: Callback) {
fun ignoringBattery(promise: Promise) {
val packageName = reactApplicationContext.packageName
val pm = reactApplicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
callback.invoke(pm.isIgnoringBatteryOptimizations(packageName))
promise.resolve(pm.isIgnoringBatteryOptimizations(packageName))
} else {
callback.invoke(true)
promise.resolve(true)
}
}

6
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "massive",
"version": "2.18",
"version": "2.23",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "massive",
"version": "2.18",
"version": "2.23",
"license": "GPL-3.0-only",
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
@ -42,7 +42,7 @@
"react-native-screens": "^3.22.1",
"react-native-share": "^9.2.3",
"react-native-sqlite-storage": "^6.0.1",
"react-native-svg": "^13.10.10",
"react-native-svg": "^13.14.0",
"react-native-vector-icons": "^9.2.0",
"react-native-view-shot": "^3.7.0",
"typeorm": "^0.3.17"

View File

@ -1,6 +1,6 @@
{
"name": "massive",
"version": "2.23",
"version": "2.24",
"private": true,
"license": "GPL-3.0-only",
"scripts": {
@ -45,7 +45,7 @@
"react-native-screens": "^3.22.1",
"react-native-share": "^9.2.3",
"react-native-sqlite-storage": "^6.0.1",
"react-native-svg": "^13.10.10",
"react-native-svg": "^13.14.0",
"react-native-vector-icons": "^9.2.0",
"react-native-view-shot": "^3.7.0",
"typeorm": "^0.3.17"