Compare commits
17 Commits
build-51c5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| bc070aae8b | |||
|
|
39e494a69a | ||
|
|
4cf5b6041d | ||
| 172d061e15 | |||
| 2e8f4ff29a | |||
| b01f3d2dab | |||
| 0640144e6b | |||
|
|
5f2c63ac05 | ||
|
|
2d5677cd0f | ||
|
|
53d7e0dcb7 | ||
|
|
898bb59149 | ||
|
|
7308635cee | ||
|
|
f8ecc30a69 | ||
|
|
1d99c729dd | ||
|
|
bb543182b7 | ||
| 5393910b4c | |||
|
|
f67bcdaddf |
28
.gitea/workflows/dev.yml
Normal file
28
.gitea/workflows/dev.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Dev Branch Check
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: 🏗 Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: 🧪 Check for linting/type errors
|
||||
run: npx expo export --platform web
|
||||
57
.gitea/workflows/manual-build.yml
Normal file
57
.gitea/workflows/manual-build.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Manual APK Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: 🏗 Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: 🏗 Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
|
||||
- name: 🏗 Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: 🏗 Setup Expo and EAS
|
||||
uses: expo/expo-github-action@v8
|
||||
with:
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
eas-version: latest
|
||||
packager: pnpm
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: 👷 Build app
|
||||
run: |
|
||||
eas build --local \
|
||||
--non-interactive \
|
||||
--output=./app-build \
|
||||
--platform=android \
|
||||
--profile=preview
|
||||
|
||||
- name: 📝 Rename build to APK
|
||||
run: mv app-build time-until-manual.apk
|
||||
|
||||
- name: 📤 Upload build artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: manual-apk-build
|
||||
path: time-until-manual.apk
|
||||
if-no-files-found: error
|
||||
55
App.js
55
App.js
@@ -1,7 +1,9 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { BackHandler, Platform, StatusBar } from 'react-native';
|
||||
import { BackHandler, Platform, StatusBar, Modal, View, Image, StyleSheet, Button } from 'react-native';
|
||||
import * as ScreenOrientation from 'expo-screen-orientation';
|
||||
import * as SplashScreen from 'expo-splash-screen';
|
||||
import { Accelerometer } from 'expo-sensors';
|
||||
import { Audio } from 'expo-av';
|
||||
import FocusScreen from './src/screens/FocusScreen';
|
||||
import HomeScreen from './src/screens/HomeScreen';
|
||||
import TimeUntilScreen from './src/screens/TimeUntilScreen';
|
||||
@@ -23,6 +25,8 @@ export default function App() {
|
||||
const [pinkMode, setPinkMode] = useState(false);
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
const [now, setNow] = useState(new Date());
|
||||
|
||||
const [showMinion, setShowMinion] = useState(false);
|
||||
|
||||
const [targetTime, setTargetTime] = useState(null);
|
||||
const [tuHour, setTuHour] = useState('');
|
||||
@@ -50,6 +54,20 @@ export default function App() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (Platform.OS === 'android' || Platform.OS === 'ios') {
|
||||
Accelerometer.setUpdateInterval(500);
|
||||
const subscription = Accelerometer.addListener(({ x, y, z }) => {
|
||||
const acceleration = Math.sqrt(x * x + y * y + z * z);
|
||||
if (acceleration > 2.5) {
|
||||
setShowMinion(true);
|
||||
setTimeout(() => setShowMinion(false), 3000);
|
||||
}
|
||||
});
|
||||
return () => subscription.remove();
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => setNow(new Date()), 1000);
|
||||
return () => clearInterval(interval);
|
||||
@@ -177,6 +195,29 @@ export default function App() {
|
||||
const timerSec = timerRemaining % 60;
|
||||
const tuCountdown = getTuCountdown();
|
||||
|
||||
const playSound = async () => {
|
||||
try {
|
||||
const { sound } = await Audio.Sound.createAsync(
|
||||
require('./assets/alert.mp3'),
|
||||
{ shouldPlay: true, volume: 1.0 }
|
||||
);
|
||||
|
||||
sound.setOnPlaybackStatusUpdate((status) => {
|
||||
if (status.didJustFinish) {
|
||||
sound.unloadAsync();
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('Error playing sound:', error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (timerDone || tuIsOver) {
|
||||
playSound();
|
||||
}
|
||||
}, [timerDone, tuIsOver]);
|
||||
|
||||
if (focusMode) {
|
||||
return (
|
||||
<FocusScreen
|
||||
@@ -251,6 +292,18 @@ export default function App() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal visible={showMinion} transparent={true} animationType="fade">
|
||||
<View style={StyleSheet.absoluteFill}>
|
||||
<Image
|
||||
source={{ uri: 'https://shx.reversed.dev/u/XHuDcA.jpg' }}
|
||||
style={{ flex: 1 }}
|
||||
resizeMode="contain"
|
||||
/>
|
||||
<View style={{ position: 'absolute', top: 50, right: 20 }}>
|
||||
<Button title="Dismiss" onPress={() => setShowMinion(false)} />
|
||||
</View>
|
||||
</View>
|
||||
</Modal>
|
||||
<StatusBar barStyle={barStyle} backgroundColor={theme.bg} />
|
||||
<TimerScreen
|
||||
styles={styles}
|
||||
|
||||
12
README.md
12
README.md
@@ -20,6 +20,18 @@ https://gitea.reversed.dev/space/time-until/releases
|
||||
- Shared UI components are in `src/components`.
|
||||
- Theme + styling are managed via `src/theme.js` and `src/styles.js`.
|
||||
|
||||
## Development
|
||||
|
||||
1. Install dependencies:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Start the development server:
|
||||
```bash
|
||||
npx expo start
|
||||
```
|
||||
|
||||
### Time Until Mode
|
||||
|
||||
- Enter hour/minute in 24-hour format.
|
||||
|
||||
BIN
assets/alert.mp3
Normal file
BIN
assets/alert.mp3
Normal file
Binary file not shown.
41
package-lock.json
generated
41
package-lock.json
generated
@@ -9,7 +9,9 @@
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"expo": "~54.0.33",
|
||||
"expo-av": "^16.0.8",
|
||||
"expo-screen-orientation": "~9.0.8",
|
||||
"expo-sensors": "^55.0.8",
|
||||
"expo-splash-screen": "^55.0.10",
|
||||
"expo-status-bar": "~3.0.9",
|
||||
"react": "19.1.0",
|
||||
@@ -55,7 +57,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz",
|
||||
"integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.29.0",
|
||||
"@babel/generator": "^7.29.0",
|
||||
@@ -3822,7 +3823,6 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.9.0",
|
||||
"caniuse-lite": "^1.0.30001759",
|
||||
@@ -4430,7 +4430,6 @@
|
||||
"resolved": "https://registry.npmjs.org/expo/-/expo-54.0.33.tgz",
|
||||
"integrity": "sha512-3yOEfAKqo+gqHcV8vKcnq0uA5zxlohnhA3fu4G43likN8ct5ZZ3LjAh9wDdKteEkoad3tFPvwxmXW711S5OHUw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.0",
|
||||
"@expo/cli": "54.0.23",
|
||||
@@ -4478,6 +4477,23 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/expo-av": {
|
||||
"version": "16.0.8",
|
||||
"resolved": "https://registry.npmjs.org/expo-av/-/expo-av-16.0.8.tgz",
|
||||
"integrity": "sha512-cmVPftGR/ca7XBgs7R6ky36lF3OC0/MM/lpgX/yXqfv0jASTsh7AYX9JxHCwFmF+Z6JEB1vne9FDx4GiLcGreQ==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"expo": "*",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-web": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"react-native-web": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/expo-modules-autolinking": {
|
||||
"version": "3.0.24",
|
||||
"resolved": "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-3.0.24.tgz",
|
||||
@@ -4587,6 +4603,19 @@
|
||||
"react-native": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/expo-sensors": {
|
||||
"version": "55.0.8",
|
||||
"resolved": "https://registry.npmjs.org/expo-sensors/-/expo-sensors-55.0.8.tgz",
|
||||
"integrity": "sha512-aYDw/IBqJtWQgCIJh12oyj5N4ldT88Aa0V/Vag88xG8K2hOQuM2SLGeNlxGRFRtgLJ4m7pzXhQW7CJRj6p1uHQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"invariant": "^2.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"expo": "*",
|
||||
"react-native": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/expo-server": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/expo-server/-/expo-server-1.0.5.tgz",
|
||||
@@ -4942,7 +4971,6 @@
|
||||
"resolved": "https://registry.npmjs.org/expo-font/-/expo-font-14.0.11.tgz",
|
||||
"integrity": "sha512-ga0q61ny4s/kr4k8JX9hVH69exVSIfcIc19+qZ7gt71Mqtm7xy2c6kwsPTCyhBW2Ro5yXTT8EaZOpuRi35rHbg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fontfaceobserver": "^2.1.0"
|
||||
},
|
||||
@@ -7492,7 +7520,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz",
|
||||
"integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -7512,7 +7539,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz",
|
||||
"integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.26.0"
|
||||
},
|
||||
@@ -7531,7 +7557,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-native/-/react-native-0.81.5.tgz",
|
||||
"integrity": "sha512-1w+/oSjEXZjMqsIvmkCRsOc8UBYv163bTWKTI8+1mxztvQPhCRYGTvZ/PL1w16xXHneIj/SLGfxWg2GWN2uexw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jest/create-cache-key-function": "^29.7.0",
|
||||
"@react-native/assets-registry": "0.81.5",
|
||||
@@ -7715,7 +7740,6 @@
|
||||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz",
|
||||
"integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -8593,7 +8617,6 @@
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"expo": "~54.0.33",
|
||||
"expo-av": "^16.0.8",
|
||||
"expo-screen-orientation": "~9.0.8",
|
||||
"expo-sensors": "^55.0.8",
|
||||
"expo-splash-screen": "^55.0.10",
|
||||
"expo-status-bar": "~3.0.9",
|
||||
"react": "19.1.0",
|
||||
|
||||
Reference in New Issue
Block a user