update to add resume app from sleep
This commit is contained in:
@ -5,14 +5,14 @@ import 'package:rogapp/utils/const.dart';
|
||||
|
||||
class ActionService{
|
||||
|
||||
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async {
|
||||
print("----- action is ---- ${like}-- ${wanttogo}-- ${checkin}");
|
||||
static Future<Map<String, dynamic>> makeAction(int userId, int locationId, bool wanttogo, bool like, bool checkin) async {
|
||||
print("----- action is ---- $like-- $wanttogo-- $checkin");
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/makeaction/?user_id=$userId&location_id=$locationId&wanttogo=$wanttogo&like=$like&checkin=$checkin";
|
||||
//String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||
print('++++++++${url}');
|
||||
print("url is ------ ${url}");
|
||||
print('++++++++$url');
|
||||
print("url is ------ $url");
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -27,11 +27,11 @@ class ActionService{
|
||||
}
|
||||
|
||||
|
||||
static Future<List<dynamic>?> userAction(int user_id, int location_id) async {
|
||||
static Future<List<dynamic>?> userAction(int userId, int locationId) async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/useraction/?user_id=$userId&location_id=$locationId';
|
||||
print('++++++++$url');
|
||||
//String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -8,14 +8,14 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> changePassword(String oldpassword, String newpassword, String token) async {
|
||||
Map<String, dynamic> changePassword = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/change-password/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/change-password/';
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.put(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token ${token}'
|
||||
'Authorization': 'Token $token'
|
||||
},
|
||||
body: jsonEncode(<String, String>{
|
||||
'old_password': oldpassword,
|
||||
@ -31,11 +31,11 @@ class AuthService{
|
||||
|
||||
|
||||
static Future<Map<String, dynamic>> login(String email, String password) async {
|
||||
print("------- in logged email ${email} pwd ${password} ###### --------");
|
||||
print("------- in logged email $email pwd $password ###### --------");
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/login/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/login/';
|
||||
print('++++++++$url');
|
||||
//String url = 'http://localhost:8100/api/login/';
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
@ -57,9 +57,9 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> register(String email, String password) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/register/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/register/';
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -79,14 +79,14 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> deleteUser(String token) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/delete-account/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/delete-account/';
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token ${token}'
|
||||
'Authorization': 'Token $token'
|
||||
}
|
||||
);
|
||||
|
||||
@ -99,10 +99,10 @@ class AuthService{
|
||||
|
||||
static Future<List<dynamic>?> UserDetails(int userid) async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/userdetials?user_id=${userid}';
|
||||
print('++++++++${url}');
|
||||
print("---- UserDetails url is ${url}");
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/userdetials?user_id=$userid';
|
||||
print('++++++++$url');
|
||||
print("---- UserDetails url is $url");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../utils/const.dart';
|
||||
@ -9,9 +8,9 @@ class CatService{
|
||||
|
||||
static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/cats/?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -28,9 +27,9 @@ class CatService{
|
||||
|
||||
static Future<List<dynamic>?> loadCatByCity(String cityname)async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/catbycity/?${cityname}';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/catbycity/?$cityname';
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -11,11 +11,11 @@ import '../utils/const.dart';
|
||||
|
||||
class DestinationService{
|
||||
|
||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||
static Future<List<dynamic>> getDestinations(int userId) async {
|
||||
List<dynamic> cats = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/destinations/?user_id=${user_id}";
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/destinations/?user_id=$userId";
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -29,11 +29,11 @@ class DestinationService{
|
||||
return cats;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
||||
static Future<Map<String, dynamic>> deleteDestination(int destId) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/delete_destination/?dest_id=$destId";
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -44,15 +44,15 @@ class DestinationService{
|
||||
if (response.statusCode == 200) {
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
print("####### ---- ${cats}");
|
||||
print("####### ---- $cats");
|
||||
return cats;
|
||||
}
|
||||
|
||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||
static Future<int> updateOrder(int actionId, int order, String dir) async {
|
||||
int cats = 0;
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/updateorder/?user_action_id=$actionId&order=$order&dir=$dir";
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -69,7 +69,7 @@ class DestinationService{
|
||||
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations, Map<String, dynamic> mtx) async{
|
||||
PolylinePoints polylinePoints = PolylinePoints();
|
||||
|
||||
if(destinations.length <= 0){
|
||||
if(destinations.isEmpty){
|
||||
return [];
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ class DestinationService{
|
||||
|
||||
int j = 0;
|
||||
|
||||
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: false);
|
||||
PolylineWayPoint pwp = PolylineWayPoint(location: "$la,$ln", stopOver: false);
|
||||
|
||||
|
||||
//print("----- UUUUUU ${pwp}");
|
||||
@ -101,13 +101,13 @@ class DestinationService{
|
||||
}
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
int trav_mode = destinationController.travelMode.value;
|
||||
int travMode = destinationController.travelMode.value;
|
||||
String _mode = "WALKING";
|
||||
if(trav_mode == 1){
|
||||
if(travMode == 1){
|
||||
//_mode = TravelMode.driving;
|
||||
_mode = "DRIVING";
|
||||
}
|
||||
else if(trav_mode == 2) {
|
||||
else if(travMode == 2) {
|
||||
//_mode = TravelMode.transit;
|
||||
_mode = "TRANSIT";
|
||||
}
|
||||
|
||||
@ -2,12 +2,10 @@ import 'dart:io';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/model/rog.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:sqflite/sqlite_api.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import '../utils/const.dart';
|
||||
@ -35,7 +33,7 @@ class ExternalService {
|
||||
|
||||
Map<String, dynamic> _res = {};
|
||||
|
||||
int user_id = indexController.currentUser[0]["user"]["id"];
|
||||
int userId = indexController.currentUser[0]["user"]["id"];
|
||||
//print("--- Pressed -----");
|
||||
String _team = indexController.currentUser[0]["user"]['team_name'];
|
||||
//print("--- _team : ${_team}-----");
|
||||
@ -47,7 +45,7 @@ class ExternalService {
|
||||
id:1,
|
||||
team_name: _team,
|
||||
event_code : _event_code,
|
||||
user_id: user_id,
|
||||
user_id: userId,
|
||||
cp_number: -1,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: null,
|
||||
@ -57,7 +55,7 @@ class ExternalService {
|
||||
}
|
||||
else {
|
||||
String url = 'https://rogaining.sumasen.net/gifuroge/start_from_rogapp';
|
||||
print('++++++++${url}');
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -73,17 +71,17 @@ class ExternalService {
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
||||
print('----_res : ${_res} ----');
|
||||
print('----_res : $_res ----');
|
||||
}
|
||||
}
|
||||
return _res;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async {
|
||||
Future<Map<String, dynamic>> makeCheckpoint(int userId, String token, String checkinTime, String teamname, int cp, String eventcode, String imageurl) async {
|
||||
//print("--cpcp-- ${cp}");
|
||||
Map<String, dynamic> _res = {};
|
||||
String url = 'https://rogaining.sumasen.net/gifuroge/checkin_from_rogapp';
|
||||
print('++++++++${url}');
|
||||
print('++++++++$url');
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
if(imageurl != null){
|
||||
@ -94,7 +92,7 @@ class ExternalService {
|
||||
id:1,
|
||||
team_name: teamname,
|
||||
event_code : eventcode,
|
||||
user_id: user_id,
|
||||
user_id: userId,
|
||||
cp_number: cp,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: imageurl,
|
||||
@ -103,31 +101,31 @@ class ExternalService {
|
||||
db.insertRogaining(_rog);
|
||||
}
|
||||
else {
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url1 = "${server_url}/api/checkinimage/";
|
||||
final im1Bytes = File(imageurl!).readAsBytesSync();
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url1 = "$serverUrl/api/checkinimage/";
|
||||
final im1Bytes = File(imageurl).readAsBytesSync();
|
||||
String im1_64 = base64Encode(im1Bytes);
|
||||
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url1),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token ${token}'
|
||||
'Authorization': 'Token $token'
|
||||
},
|
||||
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
||||
body: jsonEncode(<String, String>{
|
||||
'user' : user_id.toString(),
|
||||
'user' : userId.toString(),
|
||||
'team_name': teamname,
|
||||
'event_code': eventcode,
|
||||
'checkinimage' : im1_64,
|
||||
'checkintime' : checkin_time,
|
||||
'checkintime' : checkinTime,
|
||||
'cp_number' : cp.toString()
|
||||
}),
|
||||
);
|
||||
|
||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
||||
|
||||
print("-----@@@@@ ${_res} -----");
|
||||
print("-----@@@@@ $_res -----");
|
||||
|
||||
if(response.statusCode == 201){
|
||||
//print('---- toekn is ${token} -----');
|
||||
@ -149,11 +147,11 @@ class ExternalService {
|
||||
'event_code': eventcode,
|
||||
'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||
});
|
||||
print("--json-- ${vv}");
|
||||
print("--json-- $vv");
|
||||
print("--- checnin response ${response2.statusCode}----");
|
||||
if (response2.statusCode == 200) {
|
||||
_res = json.decode(utf8.decode(response2.bodyBytes));
|
||||
print('----checkin res _res : ${_res} ----');
|
||||
print('----checkin res _res : $_res ----');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +163,7 @@ class ExternalService {
|
||||
id:1,
|
||||
team_name: teamname,
|
||||
event_code : eventcode,
|
||||
user_id: user_id,
|
||||
user_id: userId,
|
||||
cp_number: cp,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: null,
|
||||
@ -192,11 +190,11 @@ class ExternalService {
|
||||
'event_code': eventcode,
|
||||
'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||
});
|
||||
print("--json-- ${vvv}");
|
||||
print("--json-- $vvv");
|
||||
print("--- checnin response ${response3.statusCode}----");
|
||||
if (response3.statusCode == 200) {
|
||||
_res = json.decode(utf8.decode(response3.bodyBytes));
|
||||
print('----checkin res _res : ${_res} ----');
|
||||
print('----checkin res _res : $_res ----');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,7 +202,7 @@ class ExternalService {
|
||||
}
|
||||
|
||||
|
||||
Future<Map<String, dynamic>> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async {
|
||||
Future<Map<String, dynamic>> makeGoal(int userId, String token, String teamname, String image, String goalTime, String eventcode) async {
|
||||
Map<String, dynamic> _res2 = {};
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
@ -216,7 +214,7 @@ class ExternalService {
|
||||
id:1,
|
||||
team_name: teamname,
|
||||
event_code : eventcode,
|
||||
user_id: user_id,
|
||||
user_id: userId,
|
||||
cp_number: -1,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: image,
|
||||
@ -225,33 +223,33 @@ class ExternalService {
|
||||
db.insertRogaining(_rog);
|
||||
// }
|
||||
// else{
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url1 = "${server_url}/api/goalimage/";
|
||||
final im1Bytes = File(image!).readAsBytesSync();
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url1 = "$serverUrl/api/goalimage/";
|
||||
final im1Bytes = File(image).readAsBytesSync();
|
||||
String im1_64 = base64Encode(im1Bytes);
|
||||
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url1),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token ${token}'
|
||||
'Authorization': 'Token $token'
|
||||
},
|
||||
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
||||
body: jsonEncode(<String, String>{
|
||||
'user' : user_id.toString(),
|
||||
'user' : userId.toString(),
|
||||
'team_name': teamname,
|
||||
'event_code': eventcode,
|
||||
'goaltime' : goal_time,
|
||||
'goaltime' : goalTime,
|
||||
'goalimage' : im1_64,
|
||||
'cp_number' : "-1"
|
||||
}),
|
||||
);
|
||||
|
||||
String url = 'https://rogaining.sumasen.net/gifuroge/goal_from_rogapp';
|
||||
print('++++++++${url}');
|
||||
print('++++++++$url');
|
||||
if (response.statusCode == 201) {
|
||||
Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes));
|
||||
print('----_res : ${_res} ----');
|
||||
print('----_res : $_res ----');
|
||||
print('---- image url ${_res["goalimage"]} ----');
|
||||
final http.Response response2 = await http.post(
|
||||
Uri.parse(url),
|
||||
@ -261,7 +259,7 @@ class ExternalService {
|
||||
body: jsonEncode(<String, String>{
|
||||
'team_name': teamname,
|
||||
'event_code': eventcode,
|
||||
'goal_time' : goal_time,
|
||||
'goal_time' : goalTime,
|
||||
'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||
}
|
||||
),
|
||||
@ -269,12 +267,12 @@ class ExternalService {
|
||||
String rec = jsonEncode(<String, String>{
|
||||
'team_name': teamname,
|
||||
'event_code': eventcode,
|
||||
'goal_time' : goal_time,
|
||||
'goal_time' : goalTime,
|
||||
'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||
}
|
||||
);
|
||||
print("-- json -- ${rec}");
|
||||
print('----- response2 is ${response2} --------');
|
||||
print("-- json -- $rec");
|
||||
print('----- response2 is $response2 --------');
|
||||
if (response2.statusCode == 200) {
|
||||
_res2 = json.decode(utf8.decode(response2.bodyBytes));
|
||||
}
|
||||
@ -287,8 +285,8 @@ class ExternalService {
|
||||
|
||||
static Future<Map<String, dynamic>> usersEventCode(String teamcode, String password) async {
|
||||
Map<String, dynamic> _res = {};
|
||||
String url = "https://rogaining.sumasen.net/gifuroge/check_event_code?zekken_number=${teamcode}&password=${password}";
|
||||
print('++++++++${url}');
|
||||
String url = "https://rogaining.sumasen.net/gifuroge/check_event_code?zekken_number=$teamcode&password=$password";
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -8,9 +8,9 @@ class LocationLineService{
|
||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location_line/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/location_line/';
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -9,9 +9,9 @@ class LocationPolygonervice{
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location_polygon/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/location_polygon/';
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -37,17 +37,17 @@ class LocationService{
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
|
||||
if(cat.isNotEmpty){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture + '&cat=' + cat;
|
||||
url = '$serverUrl/api/inperf/?rog=$r&perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
else {
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
url = '$serverUrl/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -55,13 +55,13 @@ class LocationService{
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture;
|
||||
url = '$serverUrl/api/inperf/?rog=$r&perf=' + perfecture;
|
||||
}
|
||||
else {
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
||||
url = '$serverUrl/api/inperf/?perf=' + perfecture;
|
||||
}
|
||||
}
|
||||
print('++++++++${url}');
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -78,13 +78,13 @@ class LocationService{
|
||||
|
||||
static Future<List<dynamic>?> getLocationsExt(String token) async {
|
||||
List<dynamic> ext = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/locsext/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/locsext/';
|
||||
print('++++++++$url');
|
||||
final response = await http.post(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token ${token}'
|
||||
'Authorization': 'Token $token'
|
||||
},
|
||||
body: jsonEncode(<String, String>{
|
||||
'token': token,
|
||||
@ -102,16 +102,16 @@ class LocationService{
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
if(cat.isNotEmpty){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture + '&cat=' + cat;
|
||||
url = '$serverUrl/api/insubperf?rog=$r&subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
url = '$serverUrl/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -119,13 +119,13 @@ class LocationService{
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture;
|
||||
url = '$serverUrl/api/insubperf?rog=$r&subperf=' + subperfecture;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||
url = '$serverUrl/api/insubperf?subperf=' + subperfecture;
|
||||
}
|
||||
}
|
||||
print('++++++++${url}');
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -145,16 +145,16 @@ class LocationService{
|
||||
print("-------- in location for bound -------------");
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
if(cat.isNotEmpty){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '${server_url}/api/inbound?rog=${r}&grp=$grp&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4' '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4' '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -162,14 +162,14 @@ class LocationService{
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
print("-------- requested user group ${grp} -------------");
|
||||
url = '${server_url}/api/inbound?rog=${r}&grp=$grp&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
print("-------- requested user group $grp -------------");
|
||||
url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||
}
|
||||
}
|
||||
print('++++++++${url}');
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -200,17 +200,17 @@ class LocationService{
|
||||
if(cat == "-all-"){
|
||||
cat = "";
|
||||
}
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("loadCustomLocations url is ----- ${cat}");
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
print("loadCustomLocations url is ----- $cat");
|
||||
if(cat.isNotEmpty){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '${server_url}/api/custom_area/?rog=${r}&&cat=' + cat;
|
||||
url = '$serverUrl/api/custom_area/?rog=$r&&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/custom_area/?&cat=' + cat;
|
||||
url = '$serverUrl/api/custom_area/?&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -218,13 +218,13 @@ class LocationService{
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '${server_url}/api/customarea?rog=${r}&name=${name}';
|
||||
url = '$serverUrl/api/customarea?rog=$r&name=$name';
|
||||
}
|
||||
else{
|
||||
url = '${server_url}/api/customarea?name=${name}';
|
||||
url = '$serverUrl/api/customarea?name=$name';
|
||||
}
|
||||
}
|
||||
print('++++++++${url}');
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -18,7 +18,7 @@ class MatrixService{
|
||||
int i = 0;
|
||||
for(Destination d in destinations){
|
||||
|
||||
print("---- getting matrix for ${d} ------------");
|
||||
print("---- getting matrix for $d ------------");
|
||||
|
||||
if(i==0){
|
||||
origin = "${d.lat}, ${d.lon}";
|
||||
@ -37,7 +37,7 @@ class MatrixService{
|
||||
i++;
|
||||
}
|
||||
|
||||
locs = "optimize:false|${locs}";
|
||||
locs = "optimize:false|$locs";
|
||||
|
||||
String _mode = "walking";
|
||||
switch (destinationController.travelMode.value) {
|
||||
@ -53,8 +53,8 @@ class MatrixService{
|
||||
}
|
||||
|
||||
Map<String, dynamic> cats = {};
|
||||
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=${destination}&mode=${_mode}&waypoints=${locs}&origin=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
print('++++++++${url}');
|
||||
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=$destination&mode=$_mode&waypoints=$locs&origin=$origin&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
print('++++++++$url');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -7,9 +7,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadPerfectures() async {
|
||||
List<dynamic> perfs = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/perf_main/';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/perf_main/';
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -25,9 +25,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
|
||||
List<dynamic> perfs = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/subperfinmain/?area=' + area;
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/subperfinmain/?area=' + area;
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -44,9 +44,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
||||
List<dynamic> perfs = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/mainperfext/?perf=' + id;
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/mainperfext/?perf=' + id;
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -62,9 +62,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
|
||||
List<dynamic> perfs = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/allgifuareas/?perf=' + perf;
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/allgifuareas/?perf=' + perf;
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -80,9 +80,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadCustomAreas() async {
|
||||
List<dynamic> perfs = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/customareanames';
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/customareanames';
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -99,9 +99,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> getSubExt(String id) async {
|
||||
List<dynamic> perfs = [];
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/perfext/?sub_perf=' + id;
|
||||
print('++++++++${url}');
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/perfext/?sub_perf=' + id;
|
||||
print('++++++++$url');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -1,26 +1,25 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
|
||||
|
||||
class TrackingService {
|
||||
|
||||
static Future<Map<String, dynamic>> addTrack(String user_id, double lat, double lon) async {
|
||||
static Future<Map<String, dynamic>> addTrack(String userId, double lat, double lon) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/track/';
|
||||
print('++++++++${url}');
|
||||
final geom = '{"type": "MULTIPOINT", "coordinates": [[${lon}, ${lat}]]}';
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/track/';
|
||||
print('++++++++$url');
|
||||
final geom = '{"type": "MULTIPOINT", "coordinates": [[$lon, $lat]]}';
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
body: jsonEncode(<String, String>{
|
||||
'user_id': user_id,
|
||||
'user_id': userId,
|
||||
'geom': geom
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user