Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues related to creating apk #89

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ npm-debug.*
yarn-debug.*
yarn-error.*

# Android
android/

# macOS
.DS_Store
*.pem
Expand Down
31 changes: 28 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,32 @@
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.CoShare.CoShare"
"bundleIdentifier": "com.CoShare.CoShare",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff",
"dark": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#404040"
}
}
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
"backgroundColor": "#404040"
},
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff",
"dark": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#404040"
}
},
"package": "com.CoShare.CoShare"
},
Expand All @@ -33,7 +53,12 @@
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router"
"expo-router",
["expo-build-properties", {
"android": {
"usesCleartextTraffic": true
}
}]
],
"experiments": {
"typedRoutes": true
Expand Down
3 changes: 0 additions & 3 deletions app/(login)/(groupScreen)/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ export default function GroupScreen() {
function getButtonsComponent() {
return (
<>
<Pressable style={styles.button}>
<Text style={styles.buttonText} onPress={() => {setCurrentState(State.bluetooth)}}> Join with bluetooth </Text>
</Pressable>
<Pressable style={styles.button} onPress={() => {setCurrentState(State.id)}}>
<Text style={styles.buttonText}> Join with group id </Text>
</Pressable>
Expand Down
52 changes: 30 additions & 22 deletions app/(tabs)/expenses/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
import { TopTabs } from "@bacons/expo-router-top-tabs";
import { useColorScheme } from "react-native";
import Colors from "../../../constants/Colors";
import { useState } from 'react';
import { TabView, SceneMap, TabBar } from 'react-native-tab-view';
import BalanceScreen from "./balance";
import SettleScreen from ".";

const renderScene = SceneMap({
index: SettleScreen,
balance: BalanceScreen,
});

export default function ExpensesTabLayout() {
const colorScheme = useColorScheme() ?? 'light';

const [index, setIndex] = useState(0);
const [routes] = useState([
{ key: 'index', title: 'Settle' },
{ key: 'balance', title: 'Balance' },
]);

const renderTabBar = (props: any) => (
<TabBar {...props}
style={{backgroundColor: Colors[colorScheme].topNavBarBackgroundColor}}
activeColor={Colors[colorScheme].text}
inactiveColor="gray"
pressColor={Colors[colorScheme].topNavBarIndicatorColorTurquoise}
indicatorStyle={{backgroundColor: Colors[colorScheme].topNavBarIndicatorColorTurquoise}} />
);

return (
<TopTabs
options={{swipeEnabled: false}}
screenOptions={{
tabBarPressColor: Colors[colorScheme].topNavBarIndicatorColorTurquoise,
tabBarIndicatorStyle: {backgroundColor: Colors[colorScheme].topNavBarIndicatorColorTurquoise},
}}>
<TopTabs.Header>
</TopTabs.Header>
<TopTabs.Screen
name="index"
options={{
title: 'Settle'
}}
/>
<TopTabs.Screen
name="balance"
options={{
title: 'Balance'
}}
/>
</TopTabs>
<TabView
swipeEnabled={false}
renderTabBar={renderTabBar}
navigationState={{ index, routes }}
renderScene={renderScene}
onIndexChange={setIndex} />
);
}
5 changes: 2 additions & 3 deletions app/(tabs)/expenses/balance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function BalanceScreen() {
<View style={[styles.container, { backgroundColor: index % 2 == 0 ? Colors[colorScheme].listBackgroundColor1 : Colors[colorScheme].listBackgroundColor2 }]}>
<View style={styles.item}>
<Text style={styles.itemText}>{item.user}</Text>
<Text style={[styles.itemAmount, { color: item.amount >= 0 ? (item.amount == 0 ? 'black' : '#5CBCA9') : '#E35F52' }]}>
<Text style={[styles.itemAmount, { color: item.amount >= 0 ? (item.amount == 0 ? Colors[colorScheme].text : '#5CBCA9') : '#E35F52' }]}>
{item.amount > 0 ? "+" + item.amount : item.amount} kr.
</Text>
</View>
Expand All @@ -62,9 +62,8 @@ export default function BalanceScreen() {
};

return (
<View>
<View style={{flex: 1}}>
<FlatList
style={{marginTop: 48}}
data={previousBalance = calculateBalance(data, members, previousBalance)}
renderItem={renderItem}
/>
Expand Down
3 changes: 1 addition & 2 deletions app/(tabs)/expenses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ export default function SettleScreen() {
};

return (
<View>
<View style={{flex: 1}}>
<FlatList
style={{marginTop: 48}}
data={calculateExpenses(previousBalance = calculateBalance(data, members, previousBalance))}
renderItem={renderItem}
/>
Expand Down
52 changes: 30 additions & 22 deletions app/(tabs)/shoppingList/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
import { TopTabs } from "@bacons/expo-router-top-tabs";
import { useColorScheme } from "react-native";
import Colors from "../../../constants/Colors";
import BoughtScreen from './bought';
import ToBeBoughtScreen from '.';
import { useState } from 'react';
import { TabView, SceneMap, TabBar } from 'react-native-tab-view';

const renderScene = SceneMap({
index: ToBeBoughtScreen,
bought: BoughtScreen,
});

export default function ListTabLayout() {
const colorScheme = useColorScheme() ?? 'light';

const [index, setIndex] = useState(0);
const [routes] = useState([
{ key: 'index', title: 'To Be Bought' },
{ key: 'bought', title: 'Bought' },
]);

const renderTabBar = (props: any) => (
<TabBar {...props}
style={{backgroundColor: Colors[colorScheme].topNavBarBackgroundColor}}
activeColor={Colors[colorScheme].text}
inactiveColor="gray"
pressColor={Colors[colorScheme].topNavBarIndicatorColorTurquoise}
indicatorStyle={{backgroundColor: Colors[colorScheme].topNavBarIndicatorColorTurquoise}} />
);

return (
<TopTabs
options={{swipeEnabled: false}}
screenOptions={{
tabBarPressColor: Colors[colorScheme].topNavBarIndicatorColorTurquoise,
tabBarIndicatorStyle: {backgroundColor: Colors[colorScheme].topNavBarIndicatorColorTurquoise},
}}>
<TopTabs.Header>
</TopTabs.Header>
<TopTabs.Screen
name="index"
options={{
title: 'To Be Bought'
}}
/>
<TopTabs.Screen
name="bought"
options={{
title: 'Bought'
}}
/>
</TopTabs>
<TabView
swipeEnabled={false}
renderTabBar={renderTabBar}
navigationState={{ index, routes }}
renderScene={renderScene}
onIndexChange={setIndex} />
);
}
1 change: 0 additions & 1 deletion app/(tabs)/shoppingList/bought.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export default function BoughtScreen() {
return (
<View style={{flex: 1}}>
<FlatList
style={{marginTop: 48}}
data={products}
renderItem={renderItem}
/>
Expand Down
1 change: 0 additions & 1 deletion app/(tabs)/shoppingList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ export default function ToBeBoughtScreen() {
return (
<View style={{flex: 1}}>
<FlatList
style={{marginTop: 48}}
data={products}
renderItem={renderItem}
/>
Expand Down
Binary file modified assets/images/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion components/LogoAndName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function LogoAndName(
return (
<View style={styles.container}>
<Image style={styles.logo} source={require("../assets/images/coshareLogo.png")} />
<Text style={styles.title}> Co-Living </Text>
<Text style={styles.title}> CoShare </Text>
</View>
);
}
Expand Down
2 changes: 2 additions & 0 deletions constants/Colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default {
tabIconSelected: tintColorLight,
tabIconSelectedBackground: tintColorTurquoise,
accentColor: accentColorTurquoise,
topNavBarBackgroundColor: '#fff',
topNavBarIndicatorColorTurquoise: topNavBarIndicatorColorTurquoise,
listBackgroundColor1: '#eeeeee',
listBackgroundColor2: '#D3D3D3',
Expand All @@ -24,6 +25,7 @@ export default {
tabIconDefault: '#ccc',
tabIconSelected: tintColorDark,
tabIconSelectedBackground: tintColorTurquoise,
topNavBarBackgroundColor: '#121212',
topNavBarIndicatorColorTurquoise: topNavBarIndicatorColorTurquoise,
listBackgroundColor1: '#282828',
listBackgroundColor2: '#404040',
Expand Down
6 changes: 4 additions & 2 deletions handlers/expenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class ExpensesHandle implements IExpenses{
if(data[key].members != undefined)
{
this.gun.user(data[key].members).get('fullName').once((name: string) => {
callback(name)
if (name != null)
{
callback(name)
}
})
}
}
Expand All @@ -58,7 +61,6 @@ class ExpensesHandle implements IExpenses{
expense.user != undefined &&
expense.amount != undefined;
}

}

export function expensesHandle(gun: Gun): IExpenses{
Expand Down
6 changes: 4 additions & 2 deletions handlers/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ class ShoppingListHandler implements IShoppingList {
if(data[key].members != undefined)
{
this.gun.user(data[key].members).get('fullName').once((name: string) => {
callback(name)
if (name != null)
{
callback(name)
}
})
}
}
Expand Down Expand Up @@ -137,7 +140,6 @@ class ShoppingListHandler implements IShoppingList {
item.data.users != null &&
item.data.bought != null;
}

}

export function shoppingListHandler(gun: Gun): IShoppingList {
Expand Down
Loading