Skip to content

Commit

Permalink
#45 mainとのコンフリクト解消
Browse files Browse the repository at this point in the history
  • Loading branch information
RikitoNoto committed Jul 20, 2023
2 parents e4b5919 + 8d395bf commit 327a8e8
Show file tree
Hide file tree
Showing 27 changed files with 1,395 additions and 385 deletions.
1 change: 1 addition & 0 deletions packages/dart_flutter_common/lib/dart_flutter_common.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export 'src/components/_export.dart';
export 'src/date_time.dart';
export 'src/int.dart';
export 'src/pick_image.dart';
export 'src/scaffold_messenger_controller.dart';
export 'src/string.dart';
8 changes: 8 additions & 0 deletions packages/dart_flutter_common/lib/src/int.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:intl/intl.dart';

final _threeDigitsFormatter = NumberFormat('#,###');

extension IntExtension on int {
/// 3 桁区切りのコンマを付加する。
String get withComma => _threeDigitsFormatter.format(this);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
part of 'chat_message.dart';

class ReadChatMessage {
const ReadChatMessage._({
const ReadChatMessage({
required this.chatMessageId,
required this.chatMessageReference,
required this.path,
required this.senderId,
required this.chatMessageType,
required this.content,
Expand All @@ -18,20 +18,27 @@ class ReadChatMessage {
});

final String chatMessageId;
final DocumentReference<ReadChatMessage> chatMessageReference;

final String path;

final String senderId;

final ChatMessageType chatMessageType;

final String content;

final List<String> imageUrls;

final bool isDeleted;

final SealedTimestamp createdAt;

final SealedTimestamp updatedAt;

factory ReadChatMessage._fromJson(Map<String, dynamic> json) {
return ReadChatMessage._(
return ReadChatMessage(
chatMessageId: json['chatMessageId'] as String,
chatMessageReference:
json['chatMessageReference'] as DocumentReference<ReadChatMessage>,
path: json['path'] as String,
senderId: json['senderId'] as String,
chatMessageType:
_chatMessageTypeConverter.fromJson(json['chatMessageType'] as String),
Expand All @@ -56,36 +63,9 @@ class ReadChatMessage {
return ReadChatMessage._fromJson(<String, dynamic>{
...data,
'chatMessageId': ds.id,
'chatMessageReference': ds.reference.parent.doc(ds.id).withConverter(
fromFirestore: (ds, _) => ReadChatMessage.fromDocumentSnapshot(ds),
toFirestore: (obj, _) => throw UnimplementedError(),
),
'path': ds.reference.path,
});
}

ReadChatMessage copyWith({
String? chatMessageId,
DocumentReference<ReadChatMessage>? chatMessageReference,
String? senderId,
ChatMessageType? chatMessageType,
String? content,
List<String>? imageUrls,
bool? isDeleted,
SealedTimestamp? createdAt,
SealedTimestamp? updatedAt,
}) {
return ReadChatMessage._(
chatMessageId: chatMessageId ?? this.chatMessageId,
chatMessageReference: chatMessageReference ?? this.chatMessageReference,
senderId: senderId ?? this.senderId,
chatMessageType: chatMessageType ?? this.chatMessageType,
content: content ?? this.content,
imageUrls: imageUrls ?? this.imageUrls,
isDeleted: isDeleted ?? this.isDeleted,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
}
}

class CreateChatMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@
part of 'chat_room.dart';

class ReadChatRoom {
const ReadChatRoom._({
const ReadChatRoom({
required this.chatRoomId,
required this.chatRoomReference,
required this.path,
required this.workerId,
required this.hostId,
required this.createdAt,
required this.updatedAt,
});

final String chatRoomId;
final DocumentReference<ReadChatRoom> chatRoomReference;

final String path;

final String workerId;

final String hostId;

final SealedTimestamp createdAt;

final SealedTimestamp updatedAt;

factory ReadChatRoom._fromJson(Map<String, dynamic> json) {
return ReadChatRoom._(
return ReadChatRoom(
chatRoomId: json['chatRoomId'] as String,
chatRoomReference:
json['chatRoomReference'] as DocumentReference<ReadChatRoom>,
path: json['path'] as String,
workerId: json['workerId'] as String,
hostId: json['hostId'] as String,
createdAt: json['createdAt'] == null
Expand All @@ -43,30 +47,9 @@ class ReadChatRoom {
return ReadChatRoom._fromJson(<String, dynamic>{
...data,
'chatRoomId': ds.id,
'chatRoomReference': ds.reference.parent.doc(ds.id).withConverter(
fromFirestore: (ds, _) => ReadChatRoom.fromDocumentSnapshot(ds),
toFirestore: (obj, _) => throw UnimplementedError(),
),
'path': ds.reference.path,
});
}

ReadChatRoom copyWith({
String? chatRoomId,
DocumentReference<ReadChatRoom>? chatRoomReference,
String? workerId,
String? hostId,
SealedTimestamp? createdAt,
SealedTimestamp? updatedAt,
}) {
return ReadChatRoom._(
chatRoomId: chatRoomId ?? this.chatRoomId,
chatRoomReference: chatRoomReference ?? this.chatRoomReference,
workerId: workerId ?? this.workerId,
hostId: hostId ?? this.hostId,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
}
}

class CreateChatRoom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
part of 'fcm_token.dart';

class ReadFcmToken {
const ReadFcmToken._({
const ReadFcmToken({
required this.fcmTokenId,
required this.fcmTokenReference,
required this.path,
required this.tokenAndDevices,
});

final String fcmTokenId;
final DocumentReference<ReadFcmToken> fcmTokenReference;

final String path;

final List<TokenAndDevice> tokenAndDevices;

factory ReadFcmToken._fromJson(Map<String, dynamic> json) {
return ReadFcmToken._(
return ReadFcmToken(
fcmTokenId: json['fcmTokenId'] as String,
fcmTokenReference:
json['fcmTokenReference'] as DocumentReference<ReadFcmToken>,
path: json['path'] as String,
tokenAndDevices: _tokenAndDevicesConverter
.fromJson(json['tokenAndDevices'] as List<dynamic>?),
);
Expand All @@ -30,24 +31,9 @@ class ReadFcmToken {
return ReadFcmToken._fromJson(<String, dynamic>{
...data,
'fcmTokenId': ds.id,
'fcmTokenReference': ds.reference.parent.doc(ds.id).withConverter(
fromFirestore: (ds, _) => ReadFcmToken.fromDocumentSnapshot(ds),
toFirestore: (obj, _) => throw UnimplementedError(),
),
'path': ds.reference.path,
});
}

ReadFcmToken copyWith({
String? fcmTokenId,
DocumentReference<ReadFcmToken>? fcmTokenReference,
List<TokenAndDevice>? tokenAndDevices,
}) {
return ReadFcmToken._(
fcmTokenId: fcmTokenId ?? this.fcmTokenId,
fcmTokenReference: fcmTokenReference ?? this.fcmTokenReference,
tokenAndDevices: tokenAndDevices ?? this.tokenAndDevices,
);
}
}

class CreateFcmToken {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
part of 'force_update_config.dart';

class ReadForceUpdateConfig {
const ReadForceUpdateConfig._({
const ReadForceUpdateConfig({
required this.forceUpdateConfigId,
required this.forceUpdateConfigReference,
required this.path,
required this.iOSLatestVersion,
required this.iOSMinRequiredVersion,
required this.iOSForceUpdate,
Expand All @@ -17,19 +17,25 @@ class ReadForceUpdateConfig {
});

final String forceUpdateConfigId;
final DocumentReference<ReadForceUpdateConfig> forceUpdateConfigReference;

final String path;

final String iOSLatestVersion;

final String iOSMinRequiredVersion;

final bool iOSForceUpdate;

final String androidLatestVersion;

final String androidMinRequiredVersion;

final bool androidForceUpdate;

factory ReadForceUpdateConfig._fromJson(Map<String, dynamic> json) {
return ReadForceUpdateConfig._(
return ReadForceUpdateConfig(
forceUpdateConfigId: json['forceUpdateConfigId'] as String,
forceUpdateConfigReference: json['forceUpdateConfigReference']
as DocumentReference<ReadForceUpdateConfig>,
path: json['path'] as String,
iOSLatestVersion: json['iOSLatestVersion'] as String,
iOSMinRequiredVersion: json['iOSMinRequiredVersion'] as String,
iOSForceUpdate: json['iOSForceUpdate'] as bool? ?? false,
Expand All @@ -44,39 +50,9 @@ class ReadForceUpdateConfig {
return ReadForceUpdateConfig._fromJson(<String, dynamic>{
...data,
'forceUpdateConfigId': ds.id,
'forceUpdateConfigReference':
ds.reference.parent.doc(ds.id).withConverter(
fromFirestore: (ds, _) =>
ReadForceUpdateConfig.fromDocumentSnapshot(ds),
toFirestore: (obj, _) => throw UnimplementedError(),
),
'path': ds.reference.path,
});
}

ReadForceUpdateConfig copyWith({
String? forceUpdateConfigId,
DocumentReference<ReadForceUpdateConfig>? forceUpdateConfigReference,
String? iOSLatestVersion,
String? iOSMinRequiredVersion,
bool? iOSForceUpdate,
String? androidLatestVersion,
String? androidMinRequiredVersion,
bool? androidForceUpdate,
}) {
return ReadForceUpdateConfig._(
forceUpdateConfigId: forceUpdateConfigId ?? this.forceUpdateConfigId,
forceUpdateConfigReference:
forceUpdateConfigReference ?? this.forceUpdateConfigReference,
iOSLatestVersion: iOSLatestVersion ?? this.iOSLatestVersion,
iOSMinRequiredVersion:
iOSMinRequiredVersion ?? this.iOSMinRequiredVersion,
iOSForceUpdate: iOSForceUpdate ?? this.iOSForceUpdate,
androidLatestVersion: androidLatestVersion ?? this.androidLatestVersion,
androidMinRequiredVersion:
androidMinRequiredVersion ?? this.androidMinRequiredVersion,
androidForceUpdate: androidForceUpdate ?? this.androidForceUpdate,
);
}
}

class CreateForceUpdateConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
part of 'host.dart';

class ReadHost {
const ReadHost._({
const ReadHost({
required this.hostId,
required this.hostReference,
required this.path,
required this.displayName,
required this.imageUrl,
required this.hostTypes,
Expand All @@ -16,17 +16,23 @@ class ReadHost {
});

final String hostId;
final DocumentReference<ReadHost> hostReference;

final String path;

final String displayName;

final String imageUrl;

final Set<HostType> hostTypes;

final SealedTimestamp createdAt;

final SealedTimestamp updatedAt;

factory ReadHost._fromJson(Map<String, dynamic> json) {
return ReadHost._(
return ReadHost(
hostId: json['hostId'] as String,
hostReference: json['hostReference'] as DocumentReference<ReadHost>,
path: json['path'] as String,
displayName: json['displayName'] as String? ?? '',
imageUrl: json['imageUrl'] as String? ?? '',
hostTypes: json['hostTypes'] == null
Expand All @@ -47,32 +53,9 @@ class ReadHost {
return ReadHost._fromJson(<String, dynamic>{
...data,
'hostId': ds.id,
'hostReference': ds.reference.parent.doc(ds.id).withConverter(
fromFirestore: (ds, _) => ReadHost.fromDocumentSnapshot(ds),
toFirestore: (obj, _) => throw UnimplementedError(),
),
'path': ds.reference.path,
});
}

ReadHost copyWith({
String? hostId,
DocumentReference<ReadHost>? hostReference,
String? displayName,
String? imageUrl,
Set<HostType>? hostTypes,
SealedTimestamp? createdAt,
SealedTimestamp? updatedAt,
}) {
return ReadHost._(
hostId: hostId ?? this.hostId,
hostReference: hostReference ?? this.hostReference,
displayName: displayName ?? this.displayName,
imageUrl: imageUrl ?? this.imageUrl,
hostTypes: hostTypes ?? this.hostTypes,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
}
}

class CreateHost {
Expand Down
Loading

0 comments on commit 327a8e8

Please sign in to comment.