-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed operatorIds bugs when updating channel
- Loading branch information
1 parent
7539831
commit cdd3544
Showing
22 changed files
with
495 additions
and
73 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
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
import 'package:sendbird_sdk/constant/enums.dart'; | ||
import 'package:sendbird_sdk/core/models/user.dart'; | ||
import 'package:sendbird_sdk/utils/json_from_parser.dart'; | ||
|
||
part 'restricted_user.g.dart'; | ||
|
||
/// An object represents a sender of a message. | ||
@JsonSerializable() | ||
class RestrictedUser extends User { | ||
/// Information about restriction | ||
RestrictionInfo? get restrictionInfo => _info; | ||
RestrictionInfo? _info; | ||
|
||
RestrictedUser({ | ||
required String userId, | ||
required String nickname, | ||
String? profileUrl, | ||
UserConnectionStatus connectionStatus = UserConnectionStatus.notAvailable, | ||
int? lastSeenAt, | ||
List<String>? preferredLanguages, | ||
String? friendDiscoveryKey, | ||
String? friendName, | ||
List<String>? discoveryKeys, | ||
Map<String, String> metaData = const {}, | ||
bool requireAuth = false, | ||
}) : super( | ||
userId: userId, | ||
nickname: nickname, | ||
profileUrl: profileUrl, | ||
connectionStatus: connectionStatus, | ||
lastSeenAt: lastSeenAt, | ||
preferredLanguages: preferredLanguages, | ||
friendDiscoveryKey: friendDiscoveryKey, | ||
friendName: friendName, | ||
discoveryKeys: discoveryKeys, | ||
metaData: metaData, | ||
requireAuth: requireAuth, | ||
); | ||
|
||
factory RestrictedUser.fromJson(Map<String, dynamic> json) { | ||
final user = _$RestrictedUserFromJson(json); | ||
user._info = RestrictionInfo.fromJson(json); | ||
return user; | ||
} | ||
|
||
@override | ||
Map<String, dynamic> toJson() => _$RestrictedUserToJson(this); | ||
} | ||
|
||
@JsonSerializable() | ||
class RestrictionInfo { | ||
// description of restriction | ||
final String? description; | ||
|
||
// timestamp when restriction will end | ||
final int? endAt; | ||
|
||
// timestamp when restriction started | ||
final int? startAt; | ||
|
||
// restriction type | ||
final RestrictionType type; | ||
|
||
RestrictionInfo({ | ||
this.description, | ||
this.endAt, | ||
this.startAt, | ||
this.type = RestrictionType.muted, | ||
}); | ||
|
||
factory RestrictionInfo.fromJson(Map<String, dynamic> json) { | ||
json['end_at'] = json['end_at'] ?? json['muted_end_at']; | ||
json['start_at'] = json['start_at'] ?? json['muted_start_at']; | ||
json['description'] = json['description'] ?? json['muted_description']; | ||
if (json['type'] == null) json['type'] = 'muted'; | ||
return _$RestrictionInfoFromJson(json); | ||
} | ||
|
||
Map<String, dynamic> toJson() => _$RestrictionInfoToJson(this); | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.