Skip to content

Commit c108479

Browse files
authored
Merge pull request #59 from codingpot/feat-use-timestamp-proto
fix: use Timestamp type instead of string for datetime
2 parents 081fdd8 + 2d4e9fb commit c108479

File tree

13 files changed

+430
-142
lines changed

13 files changed

+430
-142
lines changed

Makefile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
PROTOC_VERSION := 3.17.2
44
PROTOC_RELEASE := https://github.com/protocolbuffers/protobuf/releases
55
PROTOC_URL := $(PROTOC_RELEASE)/download/v$(PROTOC_VERSION)/
6-
PROTO_FILES := $(shell find . -name "*.proto" -type f)
6+
PROTO_FILES := $(shell find server -name "*.proto" -type f)
7+
PROTO_THIRDPARTY_FILES := $(shell find thirdparty -name "*.proto" -type f)
78
UNAME := $(shell uname)
89

910
PROTOC_ZIP_MACOS := protoc-$(PROTOC_VERSION)-osx-x86_64.zip
1011
PROTOC_ZIP_LINUX := protoc-$(PROTOC_VERSION)-linux-x86_64.zip
1112
PROTOC_ZIP_WINDOWS := protoc-$(PROTOC_VERSION)-win64.zip
12-
1313
ifeq ($(UNAME),Darwin)
1414
PROTOC_FULL_URL := $(PROTOC_URL)/$(PROTOC_ZIP_MACOS)
1515
PROTOC_FILE := $(PROTOC_ZIP_MACOS)
@@ -21,6 +21,8 @@ else ifeq ($(UNAME), Windows)
2121
PROTOC_FILE := $(PROTOC_ZIP_WINDOWS)
2222
endif
2323

24+
DART_MOCK_FILES := $(shell find client -name "*.mocks.dart" -type f)
25+
2426
.PHONY: install
2527
install:
2628
curl -OL $(PROTOC_FULL_URL)
@@ -38,6 +40,7 @@ gen.go:
3840
mkdir -p ./server/pkg/protos/
3941
protoc \
4042
--proto_path=server \
43+
--proto_path=thirdparty \
4144
--go_out=server \
4245
--go_opt=paths=source_relative \
4346
--go-grpc_out=server \
@@ -46,18 +49,22 @@ gen.go:
4649

4750
.PHONY: gen.dart
4851
gen.dart:
49-
mkdir -p ./client/lib/protos/ && \
50-
protoc \
51-
--proto_path=server \
52-
--dart_out=grpc:./client/lib/protos \
53-
$(PROTO_FILES)
52+
mkdir -p ./client/lib/protos/
53+
protoc \
54+
--proto_path=server \
55+
--proto_path=thirdparty \
56+
--dart_out=grpc:./client/lib/protos \
57+
$(PROTO_FILES) $(PROTO_THIRDPARTY_FILES)
5458

5559
.PHONY: test
5660
test: test.go test.dart
5761

5862
.PHONY: test.dart
59-
test.dart:
60-
cd client && flutter pub run build_runner build && flutter analyze && flutter test
63+
test.dart: $(DART_MOCK_FILES)
64+
cd client && flutter analyze && flutter test
65+
66+
$(DART_MOCK_FILES): $(DART_MOCK_FILES:.mocks.dart=.dart)
67+
cd client && flutter pub run build_runner build
6168

6269
.PHONY: test.dart-e2e
6370
test.dart-e2e:

client/lib/protos/google/protobuf/timestamp.pb.dart

Lines changed: 83 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/lib/protos/google/protobuf/timestamp.pbenum.dart

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/lib/protos/google/protobuf/timestamp.pbjson.dart

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/lib/protos/pkg/pr12er/messages.pb.dart

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/lib/protos/pkg/pr12er/messages.pbjson.dart

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/lib/protos/pkg/pr12er/service.pb.dart

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/lib/widgets/detail/header.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:intl/intl.dart';
23
import 'package:pr12er/protos/pkg/pr12er/messages.pb.dart';
34

45
// ignore: must_be_immutable
@@ -62,7 +63,8 @@ class HeaderWidget extends StatelessWidget {
6263
return [
6364
const Icon(Icons.today),
6465
const SizedBox(width: 8),
65-
Text(video.publishedDate, style: const TextStyle(fontSize: 18))
66+
Text(DateFormat.yMd().format(video.publishedDate.toDateTime()),
67+
style: const TextStyle(fontSize: 18))
6668
];
6769
}
6870
}

client/pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,13 @@ packages:
301301
url: "https://pub.dartlang.org"
302302
source: hosted
303303
version: "4.0.0"
304+
intl:
305+
dependency: "direct main"
306+
description:
307+
name: intl
308+
url: "https://pub.dartlang.org"
309+
source: hosted
310+
version: "0.17.0"
304311
io:
305312
dependency: transitive
306313
description:

client/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dependencies:
2626
flutter:
2727
sdk: flutter
2828
grpc: ^3.0.0
29+
intl: ^0.17.0
2930
protobuf: ^2.0.0
3031
provider: ^5.0.0
3132
youtube_player_flutter: ^8.0.0

0 commit comments

Comments
 (0)