Fakultas Ilmu Komputer UI

Commit c67d8fc4 authored by Muhammad Ariq Basyar's avatar Muhammad Ariq Basyar
Browse files

Merge branch 'dev-yoga-3' into 'PBI-13-notifikasi'

Fix strange navigator behavior

See merge request !53
parents d31b0f09 11e4bde3
Pipeline #80413 passed with stages
in 12 minutes and 53 seconds
3.4.0:
- Notification when new komentar is posted
- Notifikasi pengguna untuk komentar baru
3.3.0:
- New feature for add kegiatan
- Fix bugs
- Kegiatan disabilitas di suatu lokasi
- Perbaikan bugs
3.2.1:
- Fix cant update fasilitas
- Perbaikan masalah update fasilitas
3.2.0:
- New feature share fasilitas as a link
- Tersedia fitur membagikan informasi fasilitas/kegiatan disabilitas kepada orang lain
3.1.2:
- Fix google oauth
- Perbaikan masuk dengan Google
3.1.1:
- Add dialog to turn on Location services upon starting the app
- New feature for layanan search
- Add feature to upload image for a fasilitas straight from the camera
- Add default image for facilities
- Add search history feature
- Now all fields are required in edit profile
- Tersedia fitur pencarian layanan
- Tersedia pilihan kamera ketika menambahkan gambar fasilitas
- Tersedia fitur riwayat pencarian
import 'package:dropdown_banner/dropdown_banner.dart';
import 'package:flutter/material.dart';
import 'package:bisaGo/config/styles.dart';
import 'package:bisaGo/page/dashboard/dashboard.dart';
......@@ -8,8 +7,6 @@ class BisaGo extends StatelessWidget {
@override
Widget build(BuildContext context) {
final navigatorKey = GlobalKey<NavigatorState>();
return MaterialApp(
title: 'bisaGo',
theme: ThemeData(
......@@ -17,10 +14,7 @@ class BisaGo extends StatelessWidget {
primaryColor: greenPrimary,
backgroundColor: Colors.white,
),
home: DropdownBanner(
navigatorKey: navigatorKey,
child: Dashboard(),
),
home: Dashboard(),
);
}
}
......@@ -2,6 +2,6 @@ import 'package:intl/intl.dart';
class CustomSerializer {
static DateTime stringToDateTime(String date) {
return DateFormat('yyyy-MM-dd hh:mm').parse(date);
return DateFormat('dd-MM-yyyy hh:mm').parse(date);
}
}
......@@ -14,10 +14,15 @@ class KomentarPostingModel {
final int id;
final String deskripsi;
final String creator;
@JsonKey(name: 'date_time', fromJson: CustomSerializer.stringToDateTime)
final DateTime dateTime;
@JsonKey(fromJson: CustomSerializer.stringToDateTime)
final DateTime created;
KomentarPostingModel({this.id, this.deskripsi, this.creator, this.dateTime});
KomentarPostingModel({
this.id,
this.deskripsi,
this.creator,
this.created,
});
factory KomentarPostingModel.fromJson(Map<String, dynamic> json) =>
_$KomentarPostingModelFromJson(json);
......
......@@ -27,7 +27,7 @@ KomentarPostingModel _$KomentarPostingModelFromJson(Map<String, dynamic> json) {
id: json['id'] as int,
deskripsi: json['deskripsi'] as String,
creator: json['creator'] as String,
dateTime: CustomSerializer.stringToDateTime(json['date_time'] as String),
created: CustomSerializer.stringToDateTime(json['created'] as String),
);
}
......@@ -37,5 +37,5 @@ Map<String, dynamic> _$KomentarPostingModelToJson(
'id': instance.id,
'deskripsi': instance.deskripsi,
'creator': instance.creator,
'date_time': instance.dateTime?.toIso8601String(),
'created': instance.created?.toIso8601String(),
};
import 'package:intl/intl.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:bisaGo/config/custom_serializer.dart';
part 'komentar_posting_kegiatan.g.dart';
......@@ -14,18 +14,18 @@ class KomentarPostingKegiatanModel {
final int id;
final String creator;
final String deskripsi;
@JsonKey(name: 'created', fromJson: CustomSerializer.stringToDateTime)
@JsonKey(name: 'created', fromJson: _stringToDateTime)
final DateTime created;
KomentarPostingKegiatanModel(
{this.id,
this.creator,
this.deskripsi,
this.created}
);
{this.id, this.creator, this.deskripsi, this.created});
factory KomentarPostingKegiatanModel.fromJson(Map<String, dynamic> json) =>
_$KomentarPostingKegiatanModelFromJson(json);
Map<String, dynamic> toJson() => _$KomentarPostingKegiatanModelToJson(this);
}
DateTime _stringToDateTime(String date) {
return DateFormat('yyy-MM-dd hh:mm').parse(date);
}
......@@ -29,7 +29,7 @@ KomentarPostingKegiatanModel _$KomentarPostingKegiatanModelFromJson(
id: json['id'] as int,
creator: json['creator'] as String,
deskripsi: json['deskripsi'] as String,
created: CustomSerializer.stringToDateTime(json['created'] as String),
created: _stringToDateTime(json['created'] as String),
);
}
......
......@@ -12,10 +12,10 @@ import 'package:bisaGo/page/filter_fasilitas/postingan/detail_post.dart';
import 'package:bisaGo/repository/komentar_repository.dart';
import 'package:bisaGo/utils/custom_dashboard_location_button.dart';
import 'package:bisaGo/utils/location_turn_on_dialog.dart';
import 'package:dropdown_banner/dropdown_banner.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:geolocator/geolocator.dart';
......@@ -79,25 +79,26 @@ class DashboardState extends State<Dashboard> {
_lastNotification = now;
final data = message.data;
final String msg = data['message'];
DropdownBanner.showBanner(
text: msg,
color: Color(0xFF003566),
textStyle: TextStyle(
color: Colors.white,
height: 2.1,
),
duration: Duration(seconds: 8),
tapCallback: () {
if (data['type'] == 'fasilitas') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailFasilitasPage(context, placeId, id);
} else if (data['type'] == 'kegiatan') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailKegiatanPage(context, placeId, id);
}
});
final String title = data['title'];
Flushbar(
title: title,
message: msg,
duration: Duration(seconds: 8),
backgroundColor: Color(0xFF003566),
onTap: (_) {
if (data['type'] == 'fasilitas') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailFasilitasPage(context, placeId, id);
} else if (data['type'] == 'kegiatan') {
final String placeId = data['place_id'];
final id = int.parse(data['id']);
_navigateToDetailKegiatanPage(context, placeId, id);
}
},
flushbarStyle: FlushbarStyle.GROUNDED,
flushbarPosition: FlushbarPosition.TOP,
).show(context);
});
FirebaseMessaging.onMessageOpenedApp.listen((message) {
......
......@@ -296,7 +296,7 @@ class _DetailPostPageState extends State<DetailPostPage> {
return Column(
children: allKomentarPostingFromApi
.map<Widget>((k) => komentarPlaceHolder(
k.creator, k.dateTime, k.deskripsi))
k.creator, k.created, k.deskripsi))
.toList());
}
break;
......@@ -482,7 +482,7 @@ class _DetailPostPageState extends State<DetailPostPage> {
name,
style: const TextStyle(fontSize: 18),
),
Text('${DateFormat('dd MMMM yyy hh:mm').format(date)}',
Text('${DateFormat('dd MMMM yyyy hh:mm').format(date)}',
style: const TextStyle(color: grayPrimary, fontSize: 14))
],
),
......
......@@ -293,7 +293,6 @@ class LoginState extends State<Login> {
final response = await http
.post('${ApiFlavor.getBaseUrl()}/api-token-auth/', body: data);
if (response.statusCode == 200) {
print('here');
final tokenMap = jsonDecode(response.body);
setState(() {
sharedPreferences
......@@ -382,7 +381,6 @@ class LoginState extends State<Login> {
await googleSignInAccount.authentication;
final token = googleSignInAuthentication.accessToken;
print(token);
await login(
_currentUser.email, '', 'true', token, _currentUser.displayName);
sharedPreferences = await SharedPreferences.getInstance();
......
......@@ -55,10 +55,12 @@ class KegiatanRepository implements BaseKegiatanRepository {
);
return response;
}
@override
Future<KegiatanModel> fetchDetailKegiatan(String placeId, int kegiatanId) async {
final url = '/informasi-fasilitas/lokasi/detail-kegiatan/$placeId/$kegiatanId/';
Future<KegiatanModel> fetchDetailKegiatan(
String placeId, int kegiatanId) async {
final url =
'/informasi-fasilitas/lokasi/detail-kegiatan/$placeId/$kegiatanId/';
final response = await _network.get(url: url, isLogin: false);
var kegiatan = KegiatanModel.fromJson(response);
kegiatan.image = await fetchImages(kegiatan.placeId, kegiatan.id);
......
......@@ -57,7 +57,7 @@ dependencies:
firebase_dynamic_links: ^0.7.0+1
firebase_messaging: ^8.0.0-dev.15
carousel_slider: ^3.0.0
dropdown_banner: ^1.4.0
flushbar: ^1.10.4
dev_dependencies:
flutter_test:
......
......@@ -9,13 +9,13 @@ void main() {
'id': 1,
'deskripsi': 'This is a test',
'creator': 'Test',
'date_time': '2020-11-18 00:13:52.939668'
'created': '18-11-2020 00:13:52'
};
final returnKomentarPostingData = {
'id': 1,
'deskripsi': 'This is a test',
'creator': 'Test',
'date_time': '2020-11-18T00:13:00.000'
'created': '2020-11-18T00:13:00.000'
};
final userData = {
'is_login': true,
......@@ -36,7 +36,7 @@ void main() {
'deskripsi':
'Ada toilet khusus disabilitas terletak di lantai 2 dekat kintan',
'creator': '',
'date_time': '2020-11-18 00:13:52.939668',
'date_time': '18-11-2020 00:13:52',
'rating': 3,
'tag': 'KR',
'disabilitas': ['DF'],
......@@ -77,7 +77,7 @@ void main() {
id: 2,
deskripsi: 'This is a test',
creator: 'Test',
dateTime: DateTime.now());
created: DateTime.now());
expect(komentarPostingModel, isInstanceOf<KomentarPostingModel>());
expect(
komentarPostingWithConstructor, isInstanceOf<KomentarPostingModel>());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment