Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Clon1998 committed Mar 31, 2022
2 parents 587ede4 + c62b3a1 commit 872b81e
Show file tree
Hide file tree
Showing 60 changed files with 2,058 additions and 1,043 deletions.
34 changes: 22 additions & 12 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mobileraker">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BILLING" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>

<application
android:name="${applicationName}"
android:label="mobileraker"
Expand Down Expand Up @@ -38,12 +56,4 @@
android:name="flutterEmbedding"
android:value="2" />
</application>

<queries>
<!-- If your app opens https URLs -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>
</manifest>
40 changes: 28 additions & 12 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"add": "Add",
"remove": "Remove",
"set": "Set",
"use": "Use",
"restart": "Restart",
"shutdown": "Shutdown",
"close": "Close",
Expand All @@ -16,7 +17,7 @@
"unknown": "Unknown"
},
"pages": {
"overview": {
"dashboard": {
"title": "Dashboard",
"ems_btn": "Emergency-Stop",
"server_status": {
Expand Down Expand Up @@ -48,8 +49,8 @@
},
"temp_preset_card": {
"cooloff": "Cooloff",
"h_temp": "@:pages.overview.general.temp_card.hotend {}°C",
"b_temp": "@:pages.overview.general.temp_card.bed {}°C"
"h_temp": "@:pages.dashboard.general.temp_card.hotend {}°C",
"b_temp": "@:pages.dashboard.general.temp_card.bed {}°C"
},
"move_card": {
"title": "Move Axis",
Expand Down Expand Up @@ -85,7 +86,7 @@
"title": "Extruder",
"extrude": "Extrude",
"retract": "Retract",
"extrude_len": "@:pages.overview.control.extrude_card.extrude length"
"extrude_len": "@:pages.dashboard.control.extrude_card.extrude length"
},
"macro_card": {
"title": "Gcode - Macros"
Expand Down Expand Up @@ -131,7 +132,7 @@
"first_layer": "First Layer",
"others": "Others",
"first_layer_temps": "@:pages.files.details.meta_card.first_layer - Temperatures",
"first_layer_temps_value": "@:pages.overview.general.temp_card.hotend: {}°C\n@:pages.overview.general.temp_card.bed: {}°C"
"first_layer_temps_value": "@:pages.dashboard.general.temp_card.hotend: {}°C\n@:pages.dashboard.general.temp_card.bed: {}°C"
},
"stat_card": {
"title": "Statistics"
Expand All @@ -145,6 +146,7 @@
"ems_confirm": "Confirm Emergency-Stop",
"always_baby": "Always show Babystepping Card",
"num_edit": "Use keyboard for number input",
"start_with_overview": "Show @:pages.overview.title by default",
"language": "Language",
"companion": "Learn how to setup Mobileraker's Companion on its "
},
Expand Down Expand Up @@ -179,6 +181,7 @@
"steps_extrude": "Extrude steps"
},
"cams": {
"new_cam": "New Webcam",
"no_webcams": "No Webcams added!",
"webcam_addr": "Webcam - Address",
"default_addr": "Default Address",
Expand All @@ -197,8 +200,8 @@
},
"presets": {
"no_presets": "No Presets added!",
"hotend_temp": "@:pages.overview.general.temp_card.hotend Temperature",
"bed_temp": "@:pages.overview.general.temp_card.bed Temperature",
"hotend_temp": "@:pages.dashboard.general.temp_card.hotend Temperature",
"bed_temp": "@:pages.dashboard.general.temp_card.bed Temperature",
"new_preset": "New Preset"
}
},
Expand All @@ -218,13 +221,26 @@
"command_input" : {
"hint":"Enter console command"
}
},
"overview": {
"title": "Overview",
"fetching_machines": "@:general.fetching machines...",
"no_entries": "No machines found",
"add_machine": "Add Machine"
}
},
"nav_drawer": {
"printer_settings": "Printer Settings",
"manage_printers": "Manager Printers",
"fetching_printers": "@:general.fetching printers...",
"footer": "Made with ❤️ by Patrick Schmidt\nCheckout the project's"
"components": {
"nav_drawer": {
"printer_settings": "Printer Settings",
"manage_printers": "Manage Printers",
"fetching_printers": "@:general.fetching printers...",
"footer": "Made with ❤️ by Patrick Schmidt\nCheckout the project's"
},
"connection_watcher": {
"reconnect": "Reconnect",
"trying_connect": "Trying to connect ...",
"server_starting": "Server is starting..."
}
},
"klipper_state": {
"ready": "Ready",
Expand Down
26 changes: 23 additions & 3 deletions lib/app/app_setup.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:mobileraker/domain/gcode_macro.dart';
import 'package:mobileraker/domain/macro_group.dart';
Expand All @@ -7,6 +10,7 @@ import 'package:mobileraker/domain/webcam_setting.dart';
import 'package:mobileraker/repository/printer_setting_hive_repository.dart';
import 'package:mobileraker/service/machine_service.dart';
import 'package:mobileraker/service/notification_service.dart';
import 'package:mobileraker/service/purchases_service.dart';
import 'package:mobileraker/service/setting_service.dart';
import 'package:mobileraker/ui/components/connection/connection_state_viewmodel.dart';
import 'package:mobileraker/ui/views/console/console_view.dart';
Expand All @@ -15,18 +19,21 @@ import 'package:mobileraker/ui/views/files/details/file_details_view.dart';
import 'package:mobileraker/ui/views/files/files_view.dart';
import 'package:mobileraker/ui/views/fullcam/full_cam_view.dart';
import 'package:mobileraker/ui/views/overview/overview_view.dart';
import 'package:mobileraker/ui/views/overview/tabs/control_tab_viewmodel.dart';
import 'package:mobileraker/ui/views/overview/tabs/general_tab_viewmodel.dart';
import 'package:mobileraker/ui/views/dashboard/dashboard_view.dart';
import 'package:mobileraker/ui/views/dashboard/tabs/control_tab_viewmodel.dart';
import 'package:mobileraker/ui/views/dashboard/tabs/general_tab_viewmodel.dart';
import 'package:mobileraker/ui/views/paywall/paywall_view.dart';
import 'package:mobileraker/ui/views/printers/add/printers_add_view.dart';
import 'package:mobileraker/ui/views/printers/edit/printers_edit_view.dart';
import 'package:mobileraker/ui/views/printers/qr_scanner/qr_scanner_view.dart';
import 'package:mobileraker/ui/views/setting/imprint/imprint_view.dart';
import 'package:mobileraker/ui/views/setting/setting_view.dart';
import 'package:stacked/stacked_annotations.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:purchases_flutter/purchases_flutter.dart';

@StackedApp(routes: [
MaterialRoute(page: OverView, initial: true),
MaterialRoute(page: DashboardView, initial: true),
MaterialRoute(page: FullCamView),
MaterialRoute(page: PrintersAdd),
MaterialRoute(page: PrintersEdit),
Expand All @@ -36,6 +43,8 @@ import 'package:stacked_services/stacked_services.dart';
MaterialRoute(page: ImprintView),
MaterialRoute(page: QrScannerView),
MaterialRoute(page: ConsoleView),
MaterialRoute(page: PaywallView),
MaterialRoute(page: OverViewView),
], dependencies: [
LazySingleton(classType: NavigationService),
LazySingleton(classType: SnackbarService),
Expand All @@ -46,6 +55,7 @@ import 'package:stacked_services/stacked_services.dart';
LazySingleton(classType: ControlTabViewModel),
LazySingleton(classType: ConnectionStateViewModel),
LazySingleton(classType: ConsoleViewModel),
LazySingleton(classType: PurchasesService),
Singleton(classType: PrinterSettingHiveRepository),
Singleton(classType: MachineService),
Singleton(classType: SettingService),
Expand Down Expand Up @@ -88,3 +98,13 @@ Future<List<Box>> openBoxes() {
Hive.openBox('settingsbox'),
]);
}

Future<void> setupCat() async {
if (kReleaseMode)
return;
if (kDebugMode)
await Purchases.setDebugLogsEnabled(true);
if (Platform.isAndroid){
return Purchases.setup('goog_uzbmaMIthLRzhDyQpPsmvOXbaCK');
}
}
14 changes: 14 additions & 0 deletions lib/app/exceptions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class MobilerakerException implements Exception {
final String message;
const MobilerakerException(this.message);
}

class FileFetchException extends MobilerakerException {
final String? reqPath;
const FileFetchException(String message,{this.reqPath}): super(message);

@override
String toString() {
return 'FileFetchException{path: $reqPath, error: $message}';
}
}
1 change: 1 addition & 0 deletions lib/datasource/websocket_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class WebSocketWrapper {
bool ensureConnection() {
if (_state != WebSocketState.connected &&
_state != WebSocketState.connecting) {
_logger.i('WS not connected! connecting...');
initCommunication();
return false;
}
Expand Down
27 changes: 27 additions & 0 deletions lib/domain/webcam_setting.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import 'dart:math';

import 'package:flutter/widgets.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:uuid/uuid.dart';

Expand All @@ -18,6 +21,30 @@ class WebcamSetting {

WebcamSetting(this.name, this.url);

double get yTransformation {
var vertical = flipVertical;

if (flipVertical)
return pi;
else
return 0;
}

double get xTransformation {

if (flipHorizontal)
return pi;
else
return 0;
}

Matrix4 get transformMatrix => Matrix4.identity()
..rotateX(xTransformation)
..rotateY(yTransformation);




@override
String toString() {
return 'WebcamSetting{name: $name, uuid: $uuid, url: $url, flipHorizontal: $flipHorizontal, flipVertical: $flipVertical}';
Expand Down
45 changes: 45 additions & 0 deletions lib/dto/files/gcode_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,49 @@ class GCodeFile {
String toString() {
return 'GCodeFile{name: $name, modified: $modified, size: $size, printStartTime: $printStartTime, jobID: $jobID, slicer: $slicer, slicerVersion: $slicerVersion, layerHeight: $layerHeight, firstLayerHeight: $firstLayerHeight, objectHeight: $objectHeight, filamentTotal: $filamentTotal, estimatedTime: $estimatedTime, firstLayerTempBed: $firstLayerTempBed, firstLayerTempExtruder: $firstLayerTempExtruder, gcodeStartByte: $gcodeStartByte, gcodeEndByte: $gcodeEndByte, thumbnails: $thumbnails}';
}

@override
bool operator ==(Object other) =>
identical(this, other) ||
other is GCodeFile &&
runtimeType == other.runtimeType &&
name == other.name &&
modified == other.modified &&
size == other.size &&
printStartTime == other.printStartTime &&
jobID == other.jobID &&
slicer == other.slicer &&
slicerVersion == other.slicerVersion &&
layerHeight == other.layerHeight &&
firstLayerHeight == other.firstLayerHeight &&
objectHeight == other.objectHeight &&
filamentTotal == other.filamentTotal &&
estimatedTime == other.estimatedTime &&
firstLayerTempBed == other.firstLayerTempBed &&
firstLayerTempExtruder == other.firstLayerTempExtruder &&
gcodeStartByte == other.gcodeStartByte &&
gcodeEndByte == other.gcodeEndByte &&
thumbnails == other.thumbnails &&
parentPath == other.parentPath;

@override
int get hashCode =>
name.hashCode ^
modified.hashCode ^
size.hashCode ^
printStartTime.hashCode ^
jobID.hashCode ^
slicer.hashCode ^
slicerVersion.hashCode ^
layerHeight.hashCode ^
firstLayerHeight.hashCode ^
objectHeight.hashCode ^
filamentTotal.hashCode ^
estimatedTime.hashCode ^
firstLayerTempBed.hashCode ^
firstLayerTempExtruder.hashCode ^
gcodeStartByte.hashCode ^
gcodeEndByte.hashCode ^
thumbnails.hashCode ^
parentPath.hashCode;
}
Loading

0 comments on commit 872b81e

Please sign in to comment.