Fakultas Ilmu Komputer UI

Commit a13566f6 authored by Usman Sidiq's avatar Usman Sidiq
Browse files

[REFACTOR] Fix conflict and remove debug print

parents 791cb72f ffbc33fd
Pipeline #49775 passed with stages
in 6 minutes and 44 seconds
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_sign_in","dependencies":["google_sign_in_web"]},{"name":"google_sign_in_web","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]}]}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.3.1\\\\","dependencies":["location_permissions"]},{"name":"google_maps_flutter","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":[]},{"name":"google_sign_in","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in-4.5.1\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.6.7\\\\","dependencies":[]},{"name":"location","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.5\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"share","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\share-0.6.4\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.6+3\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-1.0.6\\\\","dependencies":[]},{"name":"geolocator","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\geolocator-5.3.1\\\\","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_api_availability-2.0.4\\\\","dependencies":[]},{"name":"google_maps_flutter","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.24+1\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_sign_in","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in-4.5.1\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.6.7\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.3\\\\","dependencies":[]},{"name":"location_permissions","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location_permissions-2.0.5\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"share","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\share-0.6.4\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.6+3\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+6\\\\","dependencies":[]},{"name":"sqflite","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-1.3.0\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"google_sign_in_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in_web-0.9.1+1\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+4\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_sign_in","dependencies":["google_sign_in_web"]},{"name":"google_sign_in_web","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2020-06-05 14:01:23.450410","version":"1.17.3"}
\ No newline at end of file
import 'package:bisaGo/config/styles.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:bisaGo/flavor/flavor.dart';
class ImageHolder extends StatelessWidget {
final String url;
......@@ -8,7 +9,7 @@ class ImageHolder extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CachedNetworkImage(
imageUrl: url == null? 'https://via.placeholder.com/30' : 'https://poipole-staging.herokuapp.com$url',
imageUrl: url == null? 'https://via.placeholder.com/30' : '${ApiFlavor.getBaseUrl()}$url',
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
......@@ -17,7 +18,7 @@ class ImageHolder extends StatelessWidget {
placeholder: (context, _) =>
const Center(child: CircularProgressIndicator(valueColor: AlwaysStoppedAnimation<Color>(greenPrimary),)),
errorWidget: (context, url, error) => Container(
child: Center(child: Text('Failed to load images'),),
child: Center(child: Icon(Icons.broken_image, color: Colors.black38)),
),
);
}
......
......@@ -3,7 +3,8 @@ import 'package:bisaGo/config/styles.dart';
class BisaGoAppBar extends StatelessWidget implements PreferredSizeWidget {
final String title;
BisaGoAppBar({this.title = 'bisaGo', Key key}) : super(key: key);
final List<Widget> actions;
BisaGoAppBar({this.title = 'bisaGo', this.actions = const [], Key key}) : super(key: key);
@override
final Size preferredSize = const Size.fromHeight(55);
@override
......@@ -28,6 +29,7 @@ class BisaGoAppBar extends StatelessWidget implements PreferredSizeWidget {
)
],
),
actions: actions
);
}
}
// Frequently used strings are stored here
// No hardcoding string view files. Store here.
const String devBaseURL = 'poipole-staging.herokuapp.com';
const String baseURL = 'poipole.herokuapp.com';
const String devBaseURL = 'https://poipole-staging.herokuapp.com';
const String baseURL = 'https://ppl2020c1.cs.ui.ac.id';
final tags = {
'KR': 'kursiroda',
......
import 'package:flutter/material.dart';
import 'package:bisaGo/app.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'flavor/flavor.dart';
import 'globalnetwork.dart';
void main() {
Future main() async {
await DotEnv().load('.env');
getDioInstance('build');
await initializeDateFormatting('id_ID', null);
Intl.defaultLocale = 'id_ID';
dio.options.receiveTimeout = 15000;
ApiFlavor.flavor = BuildFlavor.development.toString();
runApp(BisaGo());
}
\ No newline at end of file
......@@ -2,8 +2,8 @@ import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:bisaGo/globalnetwork.dart';
import 'package:bisaGo/network/CustomException.dart';
import 'package:bisaGo/flavor/flavor.dart';
import 'dart:io';
import 'package:shared_preferences/shared_preferences.dart';
class NetworkInterface {
......@@ -19,9 +19,8 @@ class NetworkInterface {
dio.options.headers['Authorization'] =
'Token ${sharedPreferences.getString('token')}';
dio.options.headers['content-type'] = 'application/json';
final response = await dio.post(
'$url',
'${ApiFlavor.getBaseUrl()}$url',
data: formData ? FormData.fromMap(bodyParams) : json.encode(bodyParams),
);
responseJson = _response(response);
......@@ -41,7 +40,7 @@ class NetworkInterface {
dio.options.headers['Authorization'] =
'Token ${sharedPreferences.getString('token')}';
final response = await dio.put(
url,
'${ApiFlavor.getBaseUrl()}$url',
);
responseJson = response.data;
} on SocketException {
......@@ -59,10 +58,11 @@ class NetworkInterface {
bool isLogin,
}) async {
var responseJson;
print('${ApiFlavor.getBaseUrl()}$url');
try {
dio.options.headers['content-type'] = 'application/json';
final response = await dio.get(
'$url',
'${ApiFlavor.getBaseUrl()}$url',
);
responseJson = _response(response);
} on SocketException {
......
......@@ -4,6 +4,7 @@ import 'dart:async';
import 'package:bisaGo/network/network_interface.dart';
import 'package:bisaGo/page/login/login.dart';
import 'package:dio/dio.dart';
import 'package:bisaGo/flavor/flavor.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bisaGo/utils/customDeskripsiField.dart';
......@@ -269,7 +270,7 @@ class AddInformasiState extends State<AddInformasi> {
print('data $data');
String namaTempat = widget.nama.replaceAll(' ', '%20');
final post = await NetworkInterface().post(
url: 'http://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/add-fasilitas/$namaTempat/',
url: '${ApiFlavor.getBaseUrl()}/informasi-fasilitas/lokasi/add-fasilitas/$namaTempat/',
formData: true,
bodyParams: data,
);
......
......@@ -14,7 +14,6 @@ import 'package:bisaGo/component/bisago_appbar.dart';
import 'package:bisaGo/config/styles.dart';
import 'package:bisaGo/network/network_interface.dart';
import 'package:shared_preferences/shared_preferences.dart';
class AddLokasi extends StatefulWidget {
@override
_AddLokasiState createState() => _AddLokasiState();
......@@ -327,7 +326,7 @@ class _AddLokasiState extends State<AddLokasi> {
print('data $data');
final post = await NetworkInterface().post(
url:
'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/add/',
'/informasi-fasilitas/lokasi/add/',
formData: true,
bodyParams: data,
);
......
......@@ -8,7 +8,6 @@ import 'package:bisaGo/page/filter_fasilitas/postingan/detailpost.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:bisaGo/network/network_interface.dart';
import 'package:bisaGo/page/login/login.dart';
class Komentar extends StatefulWidget {
final Lokasi lokasi;
final KomentarModel komentar;
......@@ -185,7 +184,7 @@ class _KomentarState extends State<Komentar> {
final idString = widget.komentar.id.toString();
var response = await NetworkInterface().put(
url:
'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/like-fasilitas/$namaTempat/$idString/$operation/',
'/informasi-fasilitas/lokasi/like-fasilitas/$namaTempat/$idString/$operation/',
);
if (response['response'] == 'You have successfuly liked this facility') {
likeSuccess(context);
......
......@@ -122,7 +122,7 @@ class AddKomentarState extends State<AddKomentar> {
var idString = widget.komentar.id.toString();
var response = await NetworkInterface().post(
url:
'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/add-komentar/$namaTempat/$idString/',
'/informasi-fasilitas/lokasi/add-komentar/$namaTempat/$idString/',
bodyParams: data, formData: true);
if (response['response'] == 'komentar added') {
inputData(context);
......
......@@ -14,6 +14,7 @@ import 'package:bisaGo/network/network_interface.dart';
import 'package:bisaGo/page/filter_fasilitas/postingan/addKomentar.dart';
import 'package:bisaGo/page/login/login.dart';
import 'package:bisaGo/page/updateInformasi/updateInformasi.dart';
import 'package:share/share.dart';
import 'package:shared_preferences/shared_preferences.dart';
class DetailPostPage extends StatefulWidget {
......@@ -46,6 +47,12 @@ class _DetailPostPageState extends State<DetailPostPage> {
appBar: BisaGoAppBar(
title: widget.komentar.nama_lokasi,
key: Key('appbar-text-${widget.komentar.nama_lokasi}'),
actions: <Widget>[
InkWell(
child: Icon(Icons.share),
onTap: () => Share.share(
'Review fasilitas disabilitas di ${widget.lokasi.name}, oleh: ${widget.komentar.creator}\n\"${widget.komentar.deskripsi}\"\n\nDapatkan info fasilitas ramah disabilitas dari aplikasi bisaGo!\nDownload bisaGo sekarang'))
],
),
body: Container(
margin: EdgeInsets.all(doubleSpace),
......@@ -310,10 +317,11 @@ class _DetailPostPageState extends State<DetailPostPage> {
),
),
),
onWillPop: () => Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => Fasilitas(
lokasi: widget.lokasi,
))));
onWillPop: () =>
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (BuildContext context) => Fasilitas(
lokasi: widget.lokasi,
))));
}
Widget _createTagContainer(String tag) {
......@@ -390,7 +398,7 @@ class _DetailPostPageState extends State<DetailPostPage> {
var idString = widget.komentar.id.toString();
var response = await NetworkInterface().put(
url:
'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/like-fasilitas/$namaTempat/$idString/$operation/',
'/informasi-fasilitas/lokasi/like-fasilitas/$namaTempat/$idString/$operation/',
);
if (response['response'] == 'You have successfuly liked this facility') {
likeSuccess(context);
......
......@@ -10,6 +10,8 @@ import 'package:bisaGo/utils/customTextField.dart';
import 'package:bisaGo/utils/validator.dart';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import 'package:bisaGo/flavor/flavor.dart';
import 'package:google_sign_in/google_sign_in.dart';
GoogleSignIn _googleSignIn = GoogleSignIn(
......@@ -154,7 +156,7 @@ class LoginState extends State<Login> {
data = {'username': email, 'password': password};
}
sharedPreferences = await SharedPreferences.getInstance();
var response = await http.post('https://poipole-staging.herokuapp.com/api-token-auth/', body: data);
var response = await http.post('${ApiFlavor.getBaseUrl()}/api-token-auth/', body: data);
if(response.statusCode == 200) {
Map<String, dynamic> tokenMap = jsonDecode(response.body);
setState(() {
......@@ -165,9 +167,6 @@ class LoginState extends State<Login> {
Navigator.of(context, rootNavigator: true).pop();
});
successDialog(context);
}
else {
failedDialog(context);
......
......@@ -10,6 +10,7 @@ import 'package:bisaGo/utils/customTextField.dart';
import 'package:bisaGo/utils/validator.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:http/http.dart' as http;
import 'package:bisaGo/flavor/flavor.dart';
GoogleSignIn _googleSignIn = GoogleSignIn(
scopes:
......@@ -31,7 +32,6 @@ class RegistrasiState extends State<Registrasi> {
super.initState();
_googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account){
setState(() {
print(_currentUser);
_currentUser = account;
nameController.text = _currentUser.displayName;
emailController.text = _currentUser.email;
......@@ -180,11 +180,10 @@ class RegistrasiState extends State<Registrasi> {
'password' : password,
};
final response = await http.post(
'https://poipole-staging.herokuapp.com/api/register/',
'${ApiFlavor.getBaseUrl()}/api/register/',
// headers: {'Content-Type': 'application/json'},
body: data,
);
print(response.statusCode);
if (response.statusCode == 201) {
successDialog(context);
Timer(Duration(seconds: 2), () {
......@@ -229,7 +228,6 @@ class RegistrasiState extends State<Registrasi> {
Future<void> _handleSignUp() async {
try{
await _handleSignOut();
print(_currentUser);
await _googleSignIn.signIn();
}
catch(error){
......
......@@ -519,7 +519,7 @@ class _RegistrasiInformasiLayananDisabilitasState
data['telp_wali'] = phoneNumbOrtuController.text;
print('data $data');
final response = await NetworkInterface().post(
url: 'https://poipole-staging.herokuapp.com/layanan-khusus/penyandang/register/',
url: '/layanan-khusus/penyandang/register/',
bodyParams: data,
);
if (response != null) {
......
......@@ -10,6 +10,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:smooth_star_rating/smooth_star_rating.dart';
import 'package:image_picker/image_picker.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:bisaGo/flavor/flavor.dart';
class UpdateInformasi extends StatefulWidget{
......@@ -257,9 +258,8 @@ class UpdateInformasiState extends State<UpdateInformasi> {
String namaTempat = widget.komentar.nama_lokasi.replaceAll(' ', '%20');
int idFasilitas = widget.komentar.id;
print('http://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/update-fasilitas/$namaTempat/$idFasilitas/');
var response = await http.put(
'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/update-fasilitas/$namaTempat/$idFasilitas/',
'${ApiFlavor.getBaseUrl()}/informasi-fasilitas/lokasi/update-fasilitas/$namaTempat/$idFasilitas/',
headers: {'Authorization' : 'token ' + sharedPreferences.getString('token')},
body: data);
if (response.statusCode == 201 || response.statusCode == 202) {
......
......@@ -5,7 +5,7 @@ class KomentarPostingRepository {
Future<KomentarPostingList> fetchKomentarPosting(String namaLokasi, int id) async {
var nama = namaLokasi.replaceAll(' ', '%20');
var url = 'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/list-komentar/' + nama + '/' + id.toString();
var url = '/informasi-fasilitas/lokasi/list-komentar/' + nama + '/' + id.toString();
final response = await _network.get(
url: url,
isLogin: false);
......
......@@ -7,7 +7,7 @@ class KomentarRepository {
Future<KomentarList> fetchKomentar(String namaLokasi) async {
var nama = namaLokasi.replaceAll(' ', '%20');
var url =
'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/list-fasilitas/' +
'/informasi-fasilitas/lokasi/list-fasilitas/' +
nama;
final response = await _network.get(url: url, isLogin: false);
final data = response.values.toList().reversed.toList();
......
......@@ -8,7 +8,7 @@ class LokasiRepository {
Future<LokasiListResponse> fetchLokasi() async {
final response = await _network.get(
url:
'https://poipole-staging.herokuapp.com/informasi-fasilitas/lokasi/list/',
'/informasi-fasilitas/lokasi/list/',
isLogin: false);
return LokasiListResponse(
......
......@@ -6,7 +6,7 @@ class SekolahRepository {
Future<SekolahList> fetchSekolah() async {
final response = await _network.get(
url: 'https://poipole-staging.herokuapp.com/layanan-khusus/sekolah/list/',
url: '/layanan-khusus/sekolah/list/',
isLogin: false);
return SekolahList(
response.map<SekolahModel>((sekolah) => SekolahModel.fromJson(sekolah)).toList());
......
Markdown is supported
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