Compare commits
4 Commits
b24cb85a70
...
a9acc6f216
Author | SHA1 | Date |
---|---|---|
Brandon Presley | a9acc6f216 | |
Brandon Presley | fd09758ccf | |
Brandon Presley | 5f2327de31 | |
Brandon Presley | f9fb190f80 |
|
@ -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,
|
||||
},
|
||||
],
|
||||
}}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue