-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-1400: refactor power level to a PowerLevelManager class
- Loading branch information
1 parent
e318fbf
commit dca5943
Showing
2 changed files
with
29 additions
and
16 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,26 @@ | ||
import 'package:fluffychat/config/default_power_level_member.dart'; | ||
import 'package:matrix/matrix.dart'; | ||
|
||
class PowerLevelManager { | ||
static final PowerLevelManager _instance = PowerLevelManager._internal(); | ||
|
||
PowerLevelManager._internal(); | ||
|
||
factory PowerLevelManager() { | ||
return _instance; | ||
} | ||
|
||
int getUserPowerLevel() { | ||
return DefaultPowerLevelMember.user.powerLevel; | ||
} | ||
|
||
Map<String, dynamic> getDefaultPowerLevelEventForMember() { | ||
return { | ||
EventTypes.RoomPinnedEvents: getUserPowerLevel(), | ||
EventTypes.RoomName: getUserPowerLevel(), | ||
EventTypes.RoomAvatar: getUserPowerLevel(), | ||
EventTypes.RoomMember: getUserPowerLevel(), | ||
EventTypes.RoomTopic: getUserPowerLevel(), | ||
}; | ||
} | ||
} |