Skip to content

Commit 85f30e0

Browse files
committed
feat: initial release version
1 parent 2e6c7a6 commit 85f30e0

82 files changed

Lines changed: 162928 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ node_modules/
4141
npm-debug.log
4242
yarn-error.log
4343

44+
# monicon
45+
.monicon
46+
4447
# fastlane
4548
#
4649
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the

App.tsx

Lines changed: 76 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -5,126 +5,99 @@
55
* @format
66
*/
77

8-
import React from 'react';
9-
import type {PropsWithChildren} from 'react';
8+
import React, {useState, useEffect, useCallback} from 'react';
9+
1010
import {
11-
ScrollView,
1211
StatusBar,
1312
StyleSheet,
14-
Text,
1513
useColorScheme,
1614
View,
15+
Platform,
1716
} from 'react-native';
1817

19-
import {
20-
Colors,
21-
DebugInstructions,
22-
Header,
23-
LearnMoreLinks,
24-
ReloadInstructions,
25-
} from 'react-native/Libraries/NewAppScreen';
18+
import {NavigationContainer} from '@react-navigation/native';
19+
import {createNativeStackNavigator} from '@react-navigation/native-stack';
20+
import {Provider} from 'react-redux';
2621

27-
type SectionProps = PropsWithChildren<{
28-
title: string;
29-
}>;
22+
import store from './redux/store';
23+
import HomeScreen from './components/HomeScreen';
24+
import Settings from './components/Settings';
25+
import Notifications from './components/Notifications';
26+
import Goals from './components/Goals';
27+
import Themes from './components/Themes';
28+
import {themes} from './helpers/colors';
29+
import ImportExport from './components/ImportExport';
30+
import Synchronization from './components/Synchronization';
31+
import PeriodicStats from './components/PeriodicStats';
3032

31-
function Section({children, title}: SectionProps): React.JSX.Element {
32-
const isDarkMode = useColorScheme() === 'dark';
33-
return (
34-
<View style={styles.sectionContainer}>
35-
<Text
36-
style={[
37-
styles.sectionTitle,
38-
{
39-
color: isDarkMode ? Colors.white : Colors.black,
40-
},
41-
]}>
42-
{title}
43-
</Text>
44-
<Text
45-
style={[
46-
styles.sectionDescription,
47-
{
48-
color: isDarkMode ? Colors.light : Colors.dark,
49-
},
50-
]}>
51-
{children}
52-
</Text>
53-
</View>
54-
);
55-
}
33+
const Stack = createNativeStackNavigator();
5634

57-
function App(): React.JSX.Element {
35+
const App: React.FC = () => {
5836
const isDarkMode = useColorScheme() === 'dark';
5937

60-
const backgroundStyle = {
61-
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
62-
};
63-
64-
/*
65-
* To keep the template simple and small we're adding padding to prevent view
66-
* from rendering under the System UI.
67-
* For bigger apps the reccomendation is to use `react-native-safe-area-context`:
68-
* https://github.com/AppAndFlow/react-native-safe-area-context
69-
*
70-
* You can read more about it here:
71-
* https://github.com/react-native-community/discussions-and-proposals/discussions/827
72-
*/
73-
const safePadding = '5%';
38+
const theme = isDarkMode ? themes.dark : themes.light;
7439

7540
return (
76-
<View style={backgroundStyle}>
77-
<StatusBar
78-
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
79-
backgroundColor={backgroundStyle.backgroundColor}
80-
/>
81-
<ScrollView
82-
style={backgroundStyle}>
83-
<View style={{paddingRight: safePadding}}>
84-
<Header/>
85-
</View>
86-
<View
87-
style={{
88-
backgroundColor: isDarkMode ? Colors.black : Colors.white,
89-
paddingHorizontal: safePadding,
90-
paddingBottom: safePadding,
91-
}}>
92-
<Section title="Step One">
93-
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
94-
screen and then come back to see your edits.
95-
</Section>
96-
<Section title="See Your Changes">
97-
<ReloadInstructions />
98-
</Section>
99-
<Section title="Debug">
100-
<DebugInstructions />
101-
</Section>
102-
<Section title="Learn More">
103-
Read the docs to discover what to do next:
104-
</Section>
105-
<LearnMoreLinks />
106-
</View>
107-
</ScrollView>
108-
</View>
41+
<Provider store={store}>
42+
<View style={[theme.basic, styles.app]}>
43+
<StatusBar {...theme.status} />
44+
<NavigationContainer>
45+
<Stack.Navigator initialRouteName="HomeScreen">
46+
<Stack.Screen
47+
name="HomeScreen"
48+
component={HomeScreen}
49+
options={{headerShown: false}}
50+
/>
51+
<Stack.Screen
52+
name="PeriodicStats"
53+
component={PeriodicStats}
54+
options={{headerShown: false}}
55+
/>
56+
<Stack.Screen
57+
name="Settings"
58+
component={Settings}
59+
options={{headerShown: false}}
60+
/>
61+
<Stack.Screen
62+
name="Notifications"
63+
component={Notifications}
64+
options={{headerShown: false}}
65+
/>
66+
<Stack.Screen
67+
name="Goals"
68+
component={Goals}
69+
options={{headerShown: false}}
70+
/>
71+
<Stack.Screen
72+
name="ImportExport"
73+
component={ImportExport}
74+
options={{headerShown: false}}
75+
/>
76+
<Stack.Screen
77+
name="Synchronization"
78+
component={Synchronization}
79+
options={{headerShown: false}}
80+
/>
81+
<Stack.Screen
82+
name="Themes"
83+
component={Themes}
84+
options={{headerShown: false}}
85+
/>
86+
</Stack.Navigator>
87+
</NavigationContainer>
88+
</View>
89+
</Provider>
10990
);
110-
}
91+
};
11192

11293
const styles = StyleSheet.create({
113-
sectionContainer: {
114-
marginTop: 32,
115-
paddingHorizontal: 24,
116-
},
117-
sectionTitle: {
118-
fontSize: 24,
119-
fontWeight: '600',
120-
},
121-
sectionDescription: {
122-
marginTop: 8,
123-
fontSize: 18,
124-
fontWeight: '400',
125-
},
126-
highlight: {
127-
fontWeight: '700',
94+
app: {
95+
...Platform.select({
96+
android: {
97+
paddingTop: Number(Platform.Version) > 34 ? StatusBar.currentHeight : 0,
98+
flex: 1,
99+
},
100+
}),
128101
},
129102
});
130103

android/app/build.gradle

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ react {
5757
/**
5858
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
5959
*/
60-
def enableProguardInReleaseBuilds = false
60+
def enableProguardInReleaseBuilds = true
6161

6262
/**
6363
* The preferred build flavor of JavaScriptCore (JSC)
@@ -83,7 +83,7 @@ android {
8383
minSdkVersion rootProject.ext.minSdkVersion
8484
targetSdkVersion rootProject.ext.targetSdkVersion
8585
versionCode 1
86-
versionName "1.0"
86+
versionName "1.0.0"
8787
}
8888
signingConfigs {
8989
debug {
@@ -92,6 +92,12 @@ android {
9292
keyAlias 'androiddebugkey'
9393
keyPassword 'android'
9494
}
95+
release {
96+
storeFile file(System.getenv("KEYSTORE_PATH"))
97+
storePassword System.getenv("STORE_PASSWORD")
98+
keyAlias System.getenv("KEY_ALIAS")
99+
keyPassword System.getenv("KEY_PASSWORD")
100+
}
95101
}
96102
buildTypes {
97103
debug {
@@ -105,11 +111,19 @@ android {
105111
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
106112
}
107113
}
114+
android.applicationVariants.configureEach { variant ->
115+
variant.outputs.each { output ->
116+
def outputFileName = "Screen Time Tracker - ${variant.buildType.name} - ${variant.versionName}.apk"
117+
output.outputFileName = outputFileName
118+
}
119+
}
108120
}
109121

110122
dependencies {
111123
// The version of react-native is set by the React Native Gradle Plugin
112124
implementation("com.facebook.react:react-android")
125+
implementation 'androidx.documentfile:documentfile:1.0.1'
126+
implementation 'androidx.work:work-runtime:2.10.1'
113127

114128
if (hermesEnabled.toBoolean()) {
115129
implementation("com.facebook.react:hermes-android")
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
22

3+
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
4+
tools:ignore="ProtectedPermissions" />
5+
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
6+
tools:ignore="QueryAllPackagesPermission" />
7+
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
8+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
9+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
10+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
311
<uses-permission android:name="android.permission.INTERNET" />
412

513
<application
614
android:name=".MainApplication"
715
android:label="@string/app_name"
8-
android:icon="@mipmap/ic_launcher"
9-
android:roundIcon="@mipmap/ic_launcher_round"
16+
android:icon="@mipmap/screen_time_tracker_icon"
17+
android:roundIcon="@mipmap/screen_time_tracker_icon_round"
1018
android:allowBackup="false"
1119
android:theme="@style/AppTheme"
1220
android:supportsRtl="true">
1321
<activity
1422
android:name=".MainActivity"
15-
android:label="@string/app_name"
1623
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
1724
android:launchMode="singleTask"
1825
android:windowSoftInputMode="adjustResize"
@@ -22,5 +29,9 @@
2229
<category android:name="android.intent.category.LAUNCHER" />
2330
</intent-filter>
2431
</activity>
32+
<service android:name=".NotificationService"
33+
android:foregroundServiceType="dataSync"
34+
android:enabled="true"
35+
android:exported="false" />
2536
</application>
2637
</manifest>

0 commit comments

Comments
 (0)