-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #265 from bobs4462/main
Bug fixes and new workspace creation features
- Loading branch information
Showing
63 changed files
with
1,595 additions
and
342 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
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,53 @@ | ||
import 'package:bloc/bloc.dart'; | ||
import 'package:meta/meta.dart'; | ||
import 'package:twake/repositories/add_workspace_repository.dart'; | ||
import 'add_workspace_state.dart'; | ||
|
||
class AddWorkspaceCubit extends Cubit<AddWorkspaceState> { | ||
final AddWorkspaceRepository repository; | ||
|
||
AddWorkspaceCubit(this.repository) : super(AddWorkspaceInitial()); | ||
|
||
void create() async { | ||
final result = await repository.create(); | ||
if (result.isNotEmpty) { | ||
emit(Created(result)); | ||
} else { | ||
emit(Error('Workspace creation failure!')); | ||
} | ||
} | ||
|
||
// void updateMembers({ | ||
// @required String workspaceId, | ||
// @required List<String> members, | ||
// }) async { | ||
// final result = await repository.updateMembers( | ||
// members: members, | ||
// workspaceId: workspaceId, | ||
// ); | ||
// if (result) { | ||
// emit(MembersUpdated(workspaceId: workspaceId, members: members)); | ||
// } else { | ||
// emit(Error('Members update failure!')); | ||
// } | ||
// } | ||
|
||
void clear() { | ||
repository.clear(); | ||
} | ||
|
||
void update({String name, List<String> members}) { | ||
repository.name = name ?? repository.name; | ||
repository.members = members ?? repository.members ?? []; | ||
|
||
var newRepo = AddWorkspaceRepository( | ||
name: repository.name, | ||
members: repository.members, | ||
); | ||
emit(Updated(newRepo)); | ||
} | ||
|
||
void setFlowStage(FlowStage stage) { | ||
emit(StageUpdated(stage)); | ||
} | ||
} |
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,66 @@ | ||
import 'package:meta/meta.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:twake/repositories/add_workspace_repository.dart'; | ||
|
||
abstract class AddWorkspaceState extends Equatable { | ||
const AddWorkspaceState(); | ||
} | ||
|
||
class AddWorkspaceInitial extends AddWorkspaceState { | ||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
class Updated extends AddWorkspaceState { | ||
final AddWorkspaceRepository repository; | ||
|
||
Updated(this.repository); | ||
|
||
@override | ||
List<Object> get props => [repository]; | ||
} | ||
|
||
class Creation extends AddWorkspaceState { | ||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
class Created extends AddWorkspaceState { | ||
final String workspaceId; | ||
|
||
Created(this.workspaceId); | ||
|
||
@override | ||
List<Object> get props => [workspaceId]; | ||
} | ||
|
||
class Error extends AddWorkspaceState { | ||
final String message; | ||
|
||
Error(this.message); | ||
|
||
@override | ||
List<Object> get props => [message]; | ||
} | ||
|
||
class StageUpdated extends AddWorkspaceState { | ||
final FlowStage stage; | ||
|
||
StageUpdated(this.stage); | ||
|
||
@override | ||
List<Object> get props => [stage]; | ||
} | ||
|
||
class MembersUpdated extends AddWorkspaceState { | ||
final String workspaceId; | ||
final List<String> members; | ||
|
||
MembersUpdated({ | ||
@required this.workspaceId, | ||
@required this.members, | ||
}); | ||
|
||
@override | ||
List<Object> get props => [workspaceId, members]; | ||
} |
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
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
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
Oops, something went wrong.