Skip to content

Commit 589b79f

Browse files
authored
Merge pull request #210 from AugmentOS-Community/dev_edge
Dev edge
2 parents 6a80b7b + a136607 commit 589b79f

File tree

8 files changed

+123
-5
lines changed

8 files changed

+123
-5
lines changed

SmartGlassesManager/SGM_android/SmartGlassesManager/src/main/java/com/augmentos/smartglassesmanager/speechrecognition/augmentos/WebSocketStreamManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ public void connect() {
145145
.url(serverUrl)
146146
.build();
147147

148+
if (webSocket != null) {
149+
audioQueue.clear();
150+
webSocket.close(1000, "Normal closure");
151+
webSocket = null;
152+
}
153+
148154
webSocket = client.newWebSocket(request, new WebSocketListener() {
149155
@Override
150156
public void onOpen(WebSocket webSocket, Response response) {

augmentos_core/app/src/main/java/com/augmentos/augmentos_core/AugmentosService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,8 @@ private void removeAsrStream(String packageName, AsrStreamKey key) {
304304

305305
if (subscribers.isEmpty()) {
306306
// Stop the underlying ASR
307-
updateAsrLanguages();
308-
309307
activeStreams.remove(key);
308+
updateAsrLanguages();
310309
}
311310
}
312311

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "AugmentOS Core",
33
"description": "Android app that runs in the background",
4-
"version": "1.1.2"
4+
"version": "1.1.3"
55
}

augmentos_manager/android/app/src/main/java/com/teamopensmartglasses/augmentos_manager/InstallApkModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void installApk(String packageName, Promise promise) {
5454
@ReactMethod
5555
public void downloadCoreApk(Promise promise) {
5656
DownloadManager downloadManager = (DownloadManager) getReactApplicationContext().getSystemService(Context.DOWNLOAD_SERVICE);
57-
String downloadLink = "https://api.augmentos.org/download_apk?apkName=AugmentOSCore.apk";
57+
String downloadLink = "https://api.augmentos.org/apks/AugmentOSCore.apk";
5858
String packageName = "com.augmentos.augmentos_core";
5959
String appName = "AugmentOS Core";
6060
String version = "latest";
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "AugmentOS Manager",
33
"description": "Frontend app",
4-
"version": "1.1.2"
4+
"version": "1.1.3"
55
}

augmentos_manager/package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

augmentos_manager/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070

7171
"react-native-screens": "^3.34.0",
7272

73+
"react-native-slider": "^0.11.0",
74+
7375
"react-native-svg": "^15.11.1",
7476

7577
"react-native-svg-transformer": "^1.5.0",
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import React, { useRef, useState, useEffect } from 'react';
2+
import { View, StyleSheet, PanResponder, LayoutChangeEvent } from 'react-native';
3+
4+
interface BrightnessSliderComponentProps {
5+
value: number;
6+
onValueChange: (value: number) => void;
7+
minimumValue?: number;
8+
maximumValue?: number;
9+
}
10+
11+
const BrightnessSliderComponent: React.FC<BrightnessSliderComponentProps> = ({
12+
value,
13+
onValueChange,
14+
minimumValue = 0,
15+
maximumValue = 100,
16+
}) => {
17+
const [sliderWidth, setSliderWidth] = useState(0);
18+
19+
// Use a ref to always hold the latest onValueChange callback.
20+
const onValueChangeRef = useRef(onValueChange);
21+
useEffect(() => {
22+
onValueChangeRef.current = onValueChange;
23+
}, [onValueChange]);
24+
25+
const computeValueFromTouch = (touchX: number) => {
26+
// If the slider width is not set yet, do nothing.
27+
if (sliderWidth === 0) {
28+
return value;
29+
}
30+
// Clamp ratio between 0 and 1.
31+
const ratio = Math.max(0, Math.min(1, touchX / sliderWidth));
32+
return Math.round(minimumValue + ratio * (maximumValue - minimumValue));
33+
};
34+
35+
const panResponder = PanResponder.create({
36+
onStartShouldSetPanResponder: () => true,
37+
onPanResponderGrant: (evt) => {
38+
const newValue = computeValueFromTouch(evt.nativeEvent.locationX);
39+
onValueChange(newValue);
40+
},
41+
onPanResponderMove: (evt) => {
42+
const newValue = computeValueFromTouch(evt.nativeEvent.locationX);
43+
onValueChange(newValue);
44+
},
45+
});
46+
47+
const handleLayout = (e: LayoutChangeEvent) => {
48+
setSliderWidth(e.nativeEvent.layout.width);
49+
};
50+
51+
// Calculate thumb's horizontal position based on the current value.
52+
const thumbPosition =
53+
sliderWidth * ((value - minimumValue) / (maximumValue - minimumValue));
54+
55+
return (
56+
<View style={styles.container} onLayout={handleLayout} {...panResponder.panHandlers}>
57+
{/* Full track */}
58+
<View style={styles.track} />
59+
{/* Filled portion of the track */}
60+
<View style={[styles.filledTrack, { width: thumbPosition }]} />
61+
{/* Draggable thumb */}
62+
<View style={[styles.thumb, { left: thumbPosition - styles.thumb.width / 2 }]} />
63+
</View>
64+
);
65+
};
66+
67+
const styles = StyleSheet.create({
68+
container: {
69+
height: 40,
70+
justifyContent: 'center',
71+
},
72+
track: {
73+
height: 4,
74+
backgroundColor: '#D1D1D6',
75+
borderRadius: 2,
76+
},
77+
filledTrack: {
78+
position: 'absolute',
79+
height: 4,
80+
backgroundColor: '#2196F3',
81+
borderRadius: 2,
82+
},
83+
thumb: {
84+
position: 'absolute',
85+
width: 20,
86+
height: 20,
87+
backgroundColor: '#2196F3',
88+
borderRadius: 10,
89+
top: 10, // centers the thumb vertically (40 - 20)/2
90+
},
91+
});
92+
93+
export default BrightnessSliderComponent;

0 commit comments

Comments
 (0)