-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
1,311 additions
and
1,941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:localsend_rs/core/rust/bridge.dart'; | ||
|
||
import '../rust/actor/mission.dart'; | ||
|
||
class MissionListener { | ||
static MissionListener? _instance; | ||
MissionListener._(); | ||
|
||
static MissionListener instance() { | ||
_instance ??= MissionListener._(); | ||
return _instance!; | ||
} | ||
|
||
Stream<MissionInfo?> stream = listenMission(); | ||
} |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import 'package:localsend_rs/core/rust/actor/mission/pending.dart'; | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
import '../listeners/pending_mission_listener.dart'; | ||
import '../rust/actor/model.dart'; | ||
import '../listeners/mission_listener.dart'; | ||
import '../rust/actor/mission.dart'; | ||
|
||
part 'mission_provider.g.dart'; | ||
|
||
@riverpod | ||
class PendingMission extends _$PendingMission { | ||
class CoreMission extends _$CoreMission { | ||
@override | ||
PendingMissionDto build() { | ||
final subPendingMission = PendingMissionListener.instance().stream.listen( | ||
MissionInfo? build() { | ||
final subMission = MissionListener.instance().stream.listen( | ||
(event) { | ||
state = event; | ||
}, | ||
); | ||
ref.onDispose(() { | ||
subPendingMission.cancel(); | ||
subMission.cancel(); | ||
}); | ||
return const PendingMissionDto(state: MissionState.idle); | ||
return null; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// This file is automatically generated, so please do not edit it. | ||
// Generated by `flutter_rust_bridge`@ 2.1.0. | ||
|
||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import | ||
|
||
import '../api/model.dart'; | ||
import '../frb_generated.dart'; | ||
import 'model.dart'; | ||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart' hide protected; | ||
part 'mission.freezed.dart'; | ||
|
||
@freezed | ||
sealed class FileState with _$FileState { | ||
const FileState._(); | ||
|
||
const factory FileState.pending() = FileState_Pending; | ||
const factory FileState.transfer() = FileState_Transfer; | ||
const factory FileState.finish() = FileState_Finish; | ||
const factory FileState.skip() = FileState_Skip; | ||
const factory FileState.fail({ | ||
required String msg, | ||
}) = FileState_Fail; | ||
} | ||
|
||
class MissionFileInfo { | ||
final FileInfo info; | ||
final FileState state; | ||
|
||
const MissionFileInfo({ | ||
required this.info, | ||
required this.state, | ||
}); | ||
|
||
@override | ||
int get hashCode => info.hashCode ^ state.hashCode; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is MissionFileInfo && | ||
runtimeType == other.runtimeType && | ||
info == other.info && | ||
state == other.state; | ||
} | ||
|
||
class MissionInfo { | ||
final String id; | ||
final NodeDevice sender; | ||
final List<MissionFileInfo> files; | ||
final MissionState state; | ||
|
||
const MissionInfo({ | ||
required this.id, | ||
required this.sender, | ||
required this.files, | ||
required this.state, | ||
}); | ||
|
||
@override | ||
int get hashCode => | ||
id.hashCode ^ sender.hashCode ^ files.hashCode ^ state.hashCode; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is MissionInfo && | ||
runtimeType == other.runtimeType && | ||
id == other.id && | ||
sender == other.sender && | ||
files == other.files && | ||
state == other.state; | ||
} |
Oops, something went wrong.