Skip to content

Commit

Permalink
Merge pull request #4 from wdiasjunior/dev
Browse files Browse the repository at this point in the history
Release 0.6.0
  • Loading branch information
wdiasjunior authored Aug 2, 2024
2 parents 165b1c5 + ce12855 commit 9823925
Show file tree
Hide file tree
Showing 75 changed files with 5,678 additions and 1,233 deletions.
15 changes: 8 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
module.exports = {
root: true,
extends: '@react-native-community',
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: "@react-native-community",
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
overrides: [
{
files: ['*.ts', '*.tsx'],
files: ["*.ts", "*.tsx"],
rules: {
'@typescript-eslint/no-shadow': ['error'],
'no-shadow': 'off',
'no-undef': 'off',
"@typescript-eslint/no-shadow": ["error"],
"no-shadow": "off",
"no-undef": "off",
"quotes": ["error", "double"],
},
},
],
Expand Down
7 changes: 3 additions & 4 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'react-native-gesture-handler';
import "react-native-gesture-handler";
import React, { Suspense } from "react";
import { View, Text, ActivityIndicator, StatusBar } from 'react-native';
import { View, Text, ActivityIndicator, StatusBar } from "react-native";

import AppWrapper from './src/pages/AppWrapper';
import AppWrapper from "./src/pages/AppWrapper";

export default function App() {

return (
<Suspense
fallback={
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Before submitting a PR make sure that your Prettier configs did not format any o

Use 2 space tabs.

Use double quotes for strings, and single quotes for chars.
Use double quotes for strings and chars.

Use semicolons at the end of the lines.

Expand Down
13 changes: 13 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:windowSoftInputMode="adjustResize"
android:theme="@style/SplashTheme"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -34,6 +35,18 @@
android:scheme="file"
android:mimeType="application/vnd.android.package-archive" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>

</activity>
<provider
android:name="androidx.core.content.FileProvider"
Expand Down
618 changes: 310 additions & 308 deletions android/app/src/main/assets/index.android.bundle

Large diffs are not rendered by default.

80 changes: 79 additions & 1 deletion android/app/src/main/java/com/barbellwhip/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
package com.barbellwhip;

import android.os.Bundle;
import android.content.Intent;
import android.util.Log;
import androidx.annotation.Nullable;
import android.net.Uri;
import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.OpenableColumns;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;

import java.util.ArrayList;

public class MainActivity extends ReactActivity {

Expand All @@ -27,10 +39,76 @@ protected ReactActivityDelegate createReactActivityDelegate() {
return new MainActivityDelegate(this, getMainComponentName());
}

// react native navigation config
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
handleIntent(getIntent());
}

@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
handleIntent(intent);
}

private void handleIntent(Intent intent) {
if(intent != null) {
String action = intent.getAction();
String type = intent.getType();

if (Intent.ACTION_SEND.equals(action) && type != null) {
handleSendFile(intent);
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
handleSendMultipleFiles(intent);
}
}
}

void handleSendFile(Intent intent) {
Uri fileUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
if(fileUri != null) {
String fileName = getFileName(fileUri);
sendToReactNative("file", fileUri.toString(), fileName);
}
}

void handleSendMultipleFiles(Intent intent) {
ArrayList<Uri> fileUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if(fileUris != null) {
ArrayList<String> filePaths = new ArrayList<>();
ArrayList<String> fileNames = new ArrayList<>();
for(Uri uri : fileUris) {
filePaths.add(uri.toString());
fileNames.add(getFileName(uri));
}
sendToReactNative("files", filePaths.toString(), fileNames.toString());
}
}

private String getFileName(Uri uri) {
String result = null;
if(uri.getScheme().equals("content")) {
try(Cursor cursor = getContentResolver().query(uri, null, null, null, null)) {
if(cursor != null && cursor.moveToFirst()) {
result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
}
}
}
if(result == null) {
result = uri.getLastPathSegment();
}
return result;
}

private void sendToReactNative(String type, String data, @Nullable String fileName) {
WritableMap params = Arguments.createMap();
params.putString("type", type);
params.putString("data", data);
if(fileName != null) {
params.putString("fileName", fileName);
}
getReactInstanceManager().getCurrentReactContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("ShareIntent", params);
}

public static class MainActivityDelegate extends ReactActivityDelegate {
Expand Down
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['react-native-reanimated/plugin'],
presets: ["module:metro-react-native-babel-preset"],
plugins: ["react-native-reanimated/plugin"],
};
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @format
*/

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import { AppRegistry } from "react-native";
import App from "./App";
import { name as appName } from "./app.json";

AppRegistry.registerComponent(appName, () => App);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "barbellwhip",
"version": "0.5.1",
"version": "0.6.0",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down
110 changes: 36 additions & 74 deletions src/TODO.md
Original file line number Diff line number Diff line change
@@ -1,101 +1,63 @@
# TODO

- [ ] change splash screen based on the selected theme (?)

## calculator page
- add settings screen (?)
- kg - lbs switch
- checkboxes to choose which formulas to calculate 1rm from (?)
- implement rpe calculator (?)
- add rpe math block
- [ ] add settings screen (?)
- [ ] kg - lbs switch
- [ ] implement rpe calculator (?)
- [ ] add rpe math block
- https://www.rpecalculator.com/
- https://articles.reactivetrainingsystems.com/2015/11/29/beginning-rts/
- get inspiration from the juggernaut app
- calculator tab screen - add topTabBar to switch between RPE and RM (?) (example on juggernaut app)
- [ ] get inspiration from the juggernaut app
- [ ] calculator tab screen - add topTabBar to switch between RPE and RM (?) (example on juggernaut app)

## plate math page
- import and export file for plate rack and bar configs (?)
- switch to toggle colors depending on plate weight (?)
- get inspiration from the juggernaut app
- [ ] import and export file for plate rack and bar configs (?)
- [ ] get inspiration from the juggernaut app

## program page
- exercise item page
- add checkboxes to track how many sets were done (?)
- header - add weight unit toggle for weight conversion (?)
- add estimated rpe weight (?)
- add switch to turn it on and off
- setSelected next day workout on dateNow change (compare with atomsWithStorage lastDay?) (?)
- rm review page
- oneRMs atom with storage object for semi persistent data that takes priority over the object in the json file for the percentage math (?)

## program management / program editor page
- add warning on rm/week/exercise items delete attempt
- share api - share json from other apps and import programs
- replace `navigation.replace("ProgramEditorStack");` with navigation reset? and prevent android back button on program editor stack from exiting and losing progress
- change program editor program data to atom with storage in both web and native (?) to prevent accidental discard of progress (kinda redundant if there's a warning on go back)
- add spinner overlay on save
- [-] use flex wrap instead of a bunch of rows (?)
- [ ] add checkboxes to track how many sets were done (?)
- [ ] header - add weight unit toggle for quick weight conversion (?)
- [ ] add estimated rpe weight (?) - add switch to turn it on and off

## program editor page
- [ ] add warning on rm/week/exercise items delete attempt
- [ ] add spinner overlay on save
- *StepOne*
- 1rm input group. add field for reps and math for estimated rm depending on the amount of reps
- [ ] 1rm input group. add field for reps and math for estimated rm depending on the amount of reps
- *StepThree*
- copy and paste function? - similar to how whatsapp lets you forward a message to multiple chats, do this for exercise items in day section (?)
- [ ] copy and paste function? - similar to how whatsapp lets you forward a message to multiple chats, do this for exercise items in day section (?)
- *StepFour* (?)
- create 4th step on program editor (screen / modal options) (?)
- another page or modal to display per week total volume of 1rm exercise
- separate values for accessories and total
- button - show screen for weekly (input amount of weeks(block)) volume / intensity
- [ ] create 4th step on program editor (screen / modal options) (?)
- [ ] another page or modal to display per week total volume of 1rm exercise
- [ ] separate values for accessories and total
- [ ] button - show screen for weekly (input amount of weeks(block)) volume / intensity

## PR Tracker page
- lift/movement/exercise selector
- display some fancy graphs/charts
- show graph with x axis for the passage of time and the y axis for the weight lifted
- percentage math for lastest entry of exercise below the graph (kinda like 1rm calculator page)

## program downloader page (?)
- fetch from a git repo (?)
- [ ] integrate OpenBarbell data (?)
- [ ] lift/movement/exercise selector
- [ ] display some fancy graphs/charts

## settings page
- about? - separate page for this (?)
- link to User Guide
- "To report bugs, suggest new features, or if want to contribute to the project, access the link below"
- link to GitHub Repository
- "This app is ad free. If you feel like it, please support the developer"
- link to buy me a coffee
- Created by Wellington Junior
- "Weights are rounded to 2.5kg and 5lbs so that it's easier on the head and load the bar mid training session, and it's applied in every screen. In the future, it will be added a toggle so that you can disable this behavior."
- add switch to disable rounding and show actual weight after percentage calculation

## misc
- excel conversion to json? - spreadsheet template? (sort of done for a few programs)
- json program validator on import (?)
- notes input for days/exercises on the program page ? (where/how would I save/load this ?)
- write documentation for the code, program .json schema, and how to use the app.
- make text responsive everywhere (?)
- `<Text adjustsFontSizeToFit style={styles(activeTheme).text}>teste</Text>`
- think of a way to extend the program schema to allow for auto regulation logic with reps and weight 1rm estimation - like what happens in the PH3 spreadsheet
- add spinner on heavy computational actions
- [ ] switch to SQLite and stop using file system directly (?)
- [ ] excel conversion to json? - spreadsheet template? (sort of done for a few programs)
- [ ] json program validator on import
- [ ] notes input for days/exercises on the program page ? (where/how would I save/load this ?)
- [ ] write documentation for the code, program .json schema, and how to use the app.
- [ ] think of a way to extend the program schema to allow for auto regulation logic with reps and weight, 1rm estimation - like what happens in the PH3 spreadsheet

---

# BUGS

- program page glitch on first load
- remake week menu list without animations?

- when saving and importing training programs
- check if file with the same name already exists
- add as a duplicate

---

- https://tamagui.dev/
- try this and have only one codebase for web and native?

---

- build release apk instead of debug
- https://gist.github.com/wdiasjunior/26c7f0b701c9fd8c184c1ebd92a5d986
- https://reactnative.dev/docs/signed-apk-android.html
- https://instamobile.io/android-development/generate-react-native-release-build-android/
- program page
- [ ] "content shift" glitch on first load

- https://www.obytes.com/blog/react-native-ci-cd-github-action
- https://github.com/marketplace/actions/react-native-android-build-apk
- [ ] File system alerts using hard coded messages

---
Loading

0 comments on commit 9823925

Please sign in to comment.