diff --git a/android/app/build.gradle b/android/app/build.gradle
index 6b0c467..d6a163e 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -79,8 +79,8 @@ android {
applicationId "com.micahlindley.offsides"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
- versionCode 21
- versionName "0.5.4"
+ versionCode 22
+ versionName "0.5.5"
}
signingConfigs {
debug {
diff --git a/android/app/release/app-release.apk b/android/app/release/app-release.apk
index 877d9e7..efed438 100644
Binary files a/android/app/release/app-release.apk and b/android/app/release/app-release.apk differ
diff --git a/android/app/release/output-metadata.json b/android/app/release/output-metadata.json
index 6b46425..55e5746 100644
--- a/android/app/release/output-metadata.json
+++ b/android/app/release/output-metadata.json
@@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
- "versionCode": 21,
- "versionName": "0.5.4",
+ "versionCode": 22,
+ "versionName": "0.5.5",
"outputFile": "app-release.apk"
}
],
diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index 7353dbd..ef49c99 100644
--- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -2,4 +2,5 @@
+
\ No newline at end of file
diff --git a/docs/latest.json b/docs/latest.json
index d7b0e5b..60935f5 100644
--- a/docs/latest.json
+++ b/docs/latest.json
@@ -1,3 +1,3 @@
{
- "latestVersion": "0.5.4"
+ "latestVersion": "0.5.5"
}
diff --git a/package-lock.json b/package-lock.json
index 7161c58..5f8365f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "offsides",
- "version": "0.5.4",
+ "version": "0.5.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "offsides",
- "version": "0.5.4",
+ "version": "0.5.5",
"dependencies": {
"@devvie/bottom-sheet": "^0.3.0",
"@pchmn/expo-material3-theme": "^1.3.2",
@@ -31,7 +31,7 @@
"reanimated-color-picker": "^3.0.3",
"rn-emoji-keyboard": "^1.6.1",
"semver": "^7.6.0",
- "sidechat.js": "^2.3.7",
+ "sidechat.js": "^2.3.8",
"timesago": "^1.0.1"
},
"devDependencies": {
@@ -14678,9 +14678,9 @@
}
},
"node_modules/sidechat.js": {
- "version": "2.3.7",
- "resolved": "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.3.7.tgz",
- "integrity": "sha512-2RlEbZesQ7eOC6LKL5STiIR0TLTuUPY58ZzOB77C4RQYthf8mxXAybA7jgWCnCAS75BKhpN5EDBrxvn7icLRUQ==",
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.3.8.tgz",
+ "integrity": "sha512-yKlxK3fZOyA4RXLdVlmGcXUBRmquKlIXuztjRp85Hu+8oOO3d+Zp71Jm5eTS9nygM1WhcwH+2OsfY3sUQkNh/g==",
"engines": {
"node": ">=18.0.0"
}
diff --git a/package.json b/package.json
index e63f703..f111f6a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "offsides",
- "version": "0.5.4",
+ "version": "0.5.5",
"private": true,
"scripts": {
"android": "react-native run-android",
@@ -33,7 +33,7 @@
"reanimated-color-picker": "^3.0.3",
"rn-emoji-keyboard": "^1.6.1",
"semver": "^7.6.0",
- "sidechat.js": "^2.3.7",
+ "sidechat.js": "^2.3.8",
"timesago": "^1.0.1"
},
"devDependencies": {
diff --git a/src/components/Group.jsx b/src/components/Group.jsx
index 8f9f52c..05060c1 100644
--- a/src/components/Group.jsx
+++ b/src/components/Group.jsx
@@ -8,6 +8,7 @@ import {
TouchableRipple,
IconButton,
useTheme,
+ Button,
} from 'react-native-paper';
import GroupAvatar from './GroupAvatar';
@@ -40,13 +41,13 @@ function Group({
{group.name}
{removeMode ? (
- onRemove(group.id)}
iconColor={colors.error}
- />
+ mode="outlined">
+ Leave
+
) : (
<>
{group.membership_type == 'member' && (
diff --git a/src/components/GroupPicker.jsx b/src/components/GroupPicker.jsx
index 77c2327..063c064 100644
--- a/src/components/GroupPicker.jsx
+++ b/src/components/GroupPicker.jsx
@@ -5,6 +5,7 @@ import {
ActivityIndicator,
Button,
Card,
+ Chip,
IconButton,
Text,
useTheme,
@@ -18,16 +19,22 @@ function GroupPicker({ sheetRef }) {
const { appState } = React.useContext(AppContext);
const API = appState.API;
const [groups, setGroups] = React.useState(false);
+ const [currentGroup, setCurrentGroup] = React.useState(false);
const [removeMode, setRemoveMode] = React.useState(false);
React.useEffect(() => {
if (API) {
loadGroups();
+ getCurrentGroup();
}
}, [API]);
const loadGroups = async () => {
const updates = await API.getUpdates(appState.schoolGroupID);
setGroups(updates.groups);
};
+ const getCurrentGroup = async () => {
+ const g = await API.getGroupMetadata(appState.groupID);
+ setCurrentGroup(g);
+ };
const selectGroup = group => {
sheetRef?.current?.close();
nav.navigate('Home', {
@@ -43,9 +50,26 @@ function GroupPicker({ sheetRef }) {
sheetRef?.current?.close();
setRemoveMode(false);
};
+
+ const changeCurrentMembership = async () => {
+ const isCurrentlyMember = currentGroup.membership_type == 'member';
+ const a = await API.setGroupMembership(currentGroup.id, !isCurrentlyMember);
+ await a;
+ setCurrentGroup({
+ ...currentGroup,
+ membership_type: isCurrentlyMember ? 'non_member' : 'member',
+ });
+ };
+
+ const leaveGroup = async id => {
+ const leaveReq = await API.setGroupMembership(id);
+ await leaveReq;
+ setGroups(groups.filter(g => g.id != id));
+ };
+
return (
- {groups ? (
+ {groups && currentGroup ? (
-
+
(
+
+ {appState.groupName != 'Home' &&
+ appState.groupID != appState.schoolGroupID ? (
+
+ {currentGroup.membership_type == 'member'
+ ? 'Leave'
+ : 'Join'}
+
+ ) : (
+ appState.groupID == appState.schoolGroupID && (
+
+ School
+
+ )
+ )}
+
+ Current
+
+
+ )}
titleVariant="titleMedium"
titleStyle={{
color: colors.primary,
marginBottom: 0,
}}
- style={{ paddingBottom: 0, marginBottom: -10 }}
+ style={{ paddingBottom: 0, marginBottom: -2 }}
/>
-
-
- In future releases of Offsides, this modal will only appear when
- you long press the group's icon.
-
-
+ {currentGroup.description && (
+
+ {currentGroup.description}
+
+ )}
- {groups.map(group => (
- selectGroup(group)}
- removeMode={removeMode}
- onRemove={() => alert('This feature is coming soon!')}
- />
- ))}
+ {groups
+ .filter(g => g.id != currentGroup.id)
+ .map(group => (
+ selectGroup(group)}
+ removeMode={removeMode}
+ onRemove={() => leaveGroup(group.id)}
+ />
+ ))}
) : (
sheetRef.current?.open()}
- onLongPress={() => sheetRef.current?.open()}
borderRadius={BORDER_RADIUS}
style={{ marginRight: 15 }}
/>
@@ -257,7 +256,7 @@ function HomeScreen({ navigation, route }) {
backdropMaskColor={colors.backdrop}
dragHandleStyle={{ backgroundColor: colors.outline }}
openDuration={550}
- closeDuration={200}
+ closeDuration={250}
height="80%"
style={{
backgroundColor: colors.surface,
diff --git a/yarn.lock b/yarn.lock
index 2bdf54b..e74192c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8123,10 +8123,10 @@ side-channel@^1.0.4:
get-intrinsic "^1.2.4"
object-inspect "^1.13.1"
-sidechat.js@^2.3.7:
- version "2.3.7"
- resolved "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.3.7.tgz"
- integrity sha512-2RlEbZesQ7eOC6LKL5STiIR0TLTuUPY58ZzOB77C4RQYthf8mxXAybA7jgWCnCAS75BKhpN5EDBrxvn7icLRUQ==
+sidechat.js@^2.3.8:
+ version "2.3.8"
+ resolved "https://registry.npmjs.org/sidechat.js/-/sidechat.js-2.3.8.tgz"
+ integrity sha512-yKlxK3fZOyA4RXLdVlmGcXUBRmquKlIXuztjRp85Hu+8oOO3d+Zp71Jm5eTS9nygM1WhcwH+2OsfY3sUQkNh/g==
signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
version "3.0.7"