Skip to content

Commit

Permalink
new release 2.0.0
Browse files Browse the repository at this point in the history
added skyle 3 support
added skyle type change
added version and serial
fixed calibration for skyle 3
  • Loading branch information
krjw-eyev committed Sep 30, 2024
1 parent b150cb5 commit 7fba4c2
Show file tree
Hide file tree
Showing 35 changed files with 841 additions and 377 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/github-actions-release-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
java-version: '11'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.3.7'
flutter-version: '3.22.0'
channel: 'stable'
cache: true
- run: flutter build apk --release
Expand All @@ -38,6 +38,6 @@ jobs:
with:
artifacts: 'build/app/outputs/apk/release/skyle_ik-android.zip'
token: ${{ secrets.RELEASES_TOKEN }}
tag: '1.1.1'
tag: '2.0.0'
commit: main
allowUpdates: true
4 changes: 2 additions & 2 deletions .github/workflows/github-actions-release-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.3.7'
flutter-version: '3.22.0'
channel: 'stable'
architecture: x64
cache: true
Expand All @@ -35,6 +35,6 @@ jobs:
with:
artifacts: 'build/ios/iphoneos/skyle_ik-ios.zip'
token: ${{ secrets.RELEASES_TOKEN }}
tag: '1.1.1'
tag: '2.0.0'
commit: main
allowUpdates: true
4 changes: 2 additions & 2 deletions .github/workflows/github-actions-release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.3.7'
flutter-version: '3.22.0'
channel: 'stable'
cache: true
- name: Install dependencies
Expand All @@ -35,6 +35,6 @@ jobs:
with:
artifacts: 'build/linux/x64/release/bundle/skyle_ik-linux.zip'
token: ${{ secrets.RELEASES_TOKEN }}
tag: '1.1.1'
tag: '2.0.0'
commit: main
allowUpdates: true
4 changes: 2 additions & 2 deletions .github/workflows/github-actions-release-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.3.7'
flutter-version: '3.22.0'
channel: 'stable'
architecture: x64
cache: true
Expand All @@ -34,6 +34,6 @@ jobs:
with:
artifacts: 'build/macos/Build/Products/Release/skyle_ik-macos/skyle_ik-macos.zip'
token: ${{ secrets.RELEASES_TOKEN }}
tag: '1.1.1'
tag: '2.0.0'
commit: main
allowUpdates: true
4 changes: 2 additions & 2 deletions .github/workflows/github-actions-release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.3.7'
flutter-version: '3.22.0'
channel: 'stable'
cache: true
- run: flutter build windows --release
Expand All @@ -33,6 +33,6 @@ jobs:
with:
artifacts: 'build/windows/runner/Release/skyle_ik-windows.zip'
token: ${{ secrets.RELEASES_TOKEN }}
tag: '1.1.1'
tag: '2.0.0'
commit: main
allowUpdates: true
6 changes: 4 additions & 2 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class _SkyleAppState extends ConsumerState<SkyleApp> with WidgetsBindingObserver
} else if (state == AppLifecycleState.resumed) {
// Resume Skyle API
try {
await AppState().et.connect(grpcPort: Configuration.grpcPort);
final skyleType = ref.read(AppState().skyleTypeProvider);
await AppState().et.connect(grpcPort: skyleType.port);
} catch (e) {
print('Failed to connect Skyle in didChangeAppLifecycle. $e');
}
Expand All @@ -75,7 +76,8 @@ class _SkyleAppState extends ConsumerState<SkyleApp> with WidgetsBindingObserver
} else {
// Start Skyle API
try {
await AppState().et.connect(grpcPort: Configuration.grpcPort);
final skyleType = ref.read(AppState().skyleTypeProvider);
await AppState().et.connect(grpcPort: skyleType.port);
} catch (e) {
print('Failed to connect Skyle in initState. $e');
}
Expand Down
50 changes: 50 additions & 0 deletions lib/config/app_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ import '../domain/repositories/update_repository.dart';
import 'local_settings_notifiers.dart';
import 'positioning_type_notifier.dart';

enum SkyleType {
skyleIntegrationKit(50051),
skyleForIpad(50052);

final int port;
const SkyleType(this.port);
}

enum SkyleVersion {
skyle1(1),
skyle2(2),
skyle3(3);

final int version;
const SkyleVersion(this.version);
}

class AppState {
// Navigator 2.0 stuff
final parserProvider = Provider<MainRouteInformationParser>((ref) => MainRouteInformationParser());
Expand All @@ -32,6 +49,10 @@ class AppState {

final navigatorProvider = StateNotifierProvider<MainNavigatorStateNotifier, List<RouteState>>((ref) => MainNavigatorStateNotifier());

// Skyle Type stuff
final skyleTypeProvider = StateProvider((ref) => SkyleType.skyleIntegrationKit);
final skyleVersionProvider = StateProvider((ref) => SkyleVersion.skyle3);

// Skyle API oject
final skyle.ET et = skyle.ET();

Expand Down Expand Up @@ -64,6 +85,10 @@ class AppState {
return PositioningTypeNotifier();
});

late final videoStreamProvider = StreamProvider((ref) {
return videoStreamController.stream;
});

late final switchSettingsProvider = StreamProvider.autoDispose((ref) {
ref
..onDispose(et.switchSettings.stop)
Expand Down Expand Up @@ -157,14 +182,20 @@ class AppState {
StreamController<skyle.DataState<skyle.PositioningMessage>> positioningStreamController = StreamController();
StreamSubscription<skyle.DataState<skyle.PositioningMessage>>? positioningStreamSubscription;

Stream<skyle.DataState<skyle.RawImage>>? videoStream;
StreamController<skyle.DataState<skyle.RawImage>> videoStreamController = StreamController();
StreamSubscription<skyle.DataState<skyle.RawImage>>? videoStreamSubscription;

Future<void> init() async {
connectionStreamSubscription = et.connectionStream.listen((connection) {
if (connection == skyle.Connection.connected) {
_startGazeStream();
_startPositioningStream();
_startVideoStream();
} else {
_stopGazeStream();
_stopPositioningStream();
_stopVideoStream();
}
});
}
Expand All @@ -183,6 +214,11 @@ class AppState {
await et.positioning.stop();
}

Future<void> _stopVideoStream() async {
await videoStreamSubscription?.cancel();
await et.video.stop();
}

Future<void> _startGazeStream() async {
if (et.connection != skyle.Connection.connected) return;
gazeStream = et.gaze.start();
Expand Down Expand Up @@ -211,4 +247,18 @@ class AppState {
}
});
}

Future<void> _startVideoStream() async {
if (et.connection != skyle.Connection.connected) return;
videoStream = et.video.start();
videoStreamSubscription = videoStream?.listen((video) async {
if (video is skyle.DataFailed) {
await _stopVideoStream();
await Future.delayed(const Duration(milliseconds: 500));
await _startVideoStream();
} else if (video is skyle.DataSuccess) {
videoStreamController.add(video);
}
});
}
}
7 changes: 3 additions & 4 deletions lib/config/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
//

import 'package:flutter/foundation.dart';
import 'package:skyle_api/api.dart';

class Configuration {
static const String updateDestinationURL = 'http://skyle.local/api/update/';
static const String updateDestinationURL = 'http://192.168.137.2/api/update/';
static const String updateURL = 'https://update.eyev.de/check.php';
static const String isBetaDeviceURL = 'https://update.eyev.de/get_beta.php';
static const String releaseNotesURL = 'https://update.eyev.de/notes.php';
static const String updateBaseDirectory = 'updates';

static String mjpegURL = 'http://${ET.baseURL}:8080/?action=stream';
static String mjpegURL = 'http://192.168.137.2:8080/?action=stream';

static const bool simulateET = kDebugMode && false;

static const grpcPort = 50051;
// static const grpcPort = 50052;
}
2 changes: 1 addition & 1 deletion lib/config/routes/main_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum MainRoutes {
case MainRoutes.home:
return PageWrapper(
key: ValueKey(fromPath(path)),
child: const MainView(),
child: MainView(),
);
case MainRoutes.capture:
return PageWrapper(
Expand Down
10 changes: 5 additions & 5 deletions lib/config/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Routes {
currentRoute += '/dialog';
}

static bool gazeInteractionPredicate(Rect itemRect, Rect gazePointerRect, String itemRoute, String currentRoute) {
static PredicateReturnState gazeInteractionPredicate(Rect itemRect, Rect gazePointerRect, Rect gazeSnapPointerRect, String itemRoute, String currentRoute) {
// final intersection = itemRect.intersect(gazePointerRect);
// if (intersection.width.isNegative || intersection.height.isNegative) return false;
// final intersectionArea = intersection.width * intersection.height;
Expand All @@ -59,15 +59,15 @@ class Routes {
// skyleLogger?.i('$itemRoute ?== $currentRoute');
if (currentRoute.endsWith('dialog')) {
if (itemRoute == currentRoute && itemRect.contains(gazePointerRect.center)) {
return true;
return PredicateReturnState.gaze;
} else {
return false;
return PredicateReturnState.none;
}
}
// Check in case of Regular Route
if ((itemRoute == currentRoute) && itemRect.contains(gazePointerRect.center)) {
return true;
return PredicateReturnState.gaze;
}
return false;
return PredicateReturnState.none;
}
}
20 changes: 10 additions & 10 deletions lib/config/theme/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,28 @@ class AppTheme {
onSecondary: Colors.white,
onSurface: Colors.white,
),
toggleableActiveColor: Colors.teal.shade800,
// toggleableActiveColor: Colors.teal.shade800,
primaryColor: Colors.teal.shade800,
primaryTextTheme: TextTheme(
headline1: const TextStyle(
headlineLarge: const TextStyle(
color: Colors.white,
fontSize: 25,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
headline2: const TextStyle(
headlineMedium: const TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
bodyText1: const TextStyle(
bodyLarge: const TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.normal,
decoration: TextDecoration.none,
),
bodyText2: TextStyle(
bodyMedium: TextStyle(
color: Colors.white.withOpacity(0.6),
fontSize: 14,
fontWeight: FontWeight.normal,
Expand All @@ -61,7 +61,7 @@ class AppTheme {
static ThemeData of(BuildContext context) {
return data().copyWith(
primaryTextTheme: TextTheme(
headline1: TextStyle(
headlineLarge: TextStyle(
color: Colors.white,
fontSize: Responsive.getResponsiveValue(
forLargeScreen: 40,
Expand All @@ -71,7 +71,7 @@ class AppTheme {
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
headline2: TextStyle(
headlineMedium: TextStyle(
color: Colors.white,
fontSize: Responsive.getResponsiveValue(
forLargeScreen: 30,
Expand All @@ -81,7 +81,7 @@ class AppTheme {
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
headline3: TextStyle(
headlineSmall: TextStyle(
color: Colors.white,
fontSize: Responsive.getResponsiveValue(
forLargeScreen: 20,
Expand All @@ -91,7 +91,7 @@ class AppTheme {
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
),
bodyText1: TextStyle(
bodyLarge: TextStyle(
color: Colors.white,
fontSize: Responsive.getResponsiveValue(
forLargeScreen: 20,
Expand All @@ -101,7 +101,7 @@ class AppTheme {
fontWeight: FontWeight.normal,
decoration: TextDecoration.none,
),
bodyText2: TextStyle(
bodyMedium: TextStyle(
color: Colors.white.withOpacity(0.6),
fontSize: Responsive.getResponsiveValue(
forLargeScreen: 20,
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ Future<void> main() async {
setWindowMinSize(const Size(1024, 768));
}

runApp(const ProviderScope(child: SkyleApp()));
runApp(GazeContext(sharedPreferences: AppState().sharedPreferences, child: const SkyleApp()));
}
16 changes: 15 additions & 1 deletion lib/ui/calibration/calibration_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ class _CalibrationViewState extends ConsumerState<CalibrationView> with SingleTi

return AppState().et.calibration.calibrate(
calibrationPoints,
screenSizes: skyle.ScreenSizes(resolution: skyle.Size(width: mediaQuery.size.width, height: mediaQuery.size.height)),
screenSizes: skyle.ScreenSizes(
resolution: skyle.Size(
width: mediaQuery.size.width,
height: mediaQuery.size.height,
),
dimensions: const skyle.Size(
width: 1920,
height: 1080,
),
),
stepped: true,
);
});
setState(() {
Expand Down Expand Up @@ -134,6 +144,10 @@ class _CalibrationViewState extends ConsumerState<CalibrationView> with SingleTi
pointerPosition = message.data!.point!.coordinates;
pointervisible = true;
print(message.data!.point!.coordinates);
SchedulerBinding.instance.addPostFrameCallback((_) async {
await Future.delayed(const Duration(milliseconds: 400));
AppState().et.calibration.next();
});
}

return Scaffold(
Expand Down
Loading

0 comments on commit 7fba4c2

Please sign in to comment.