no message
parent
92ba977fca
commit
8457972fda
@ -1 +1 @@
|
|||||||
4592a16118bc51c556d89309892cf794
|
3f3d14a0ae775b56806906c2cb14a1f0
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// GeoZoneModel.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by ZiKambrani on 13/12/2020.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class GeoZoneModel{
|
||||||
|
var geofenceId:Int = -1
|
||||||
|
var description:String = ""
|
||||||
|
var descriptionN:String?
|
||||||
|
var latitude:String?
|
||||||
|
var longitude:String?
|
||||||
|
var radius:Int?
|
||||||
|
var type:Int?
|
||||||
|
var projectID:Int?
|
||||||
|
var imageURL:String?
|
||||||
|
var isCity:String?
|
||||||
|
|
||||||
|
func identifier() -> String{
|
||||||
|
return "\(geofenceId)_\(description)"
|
||||||
|
}
|
||||||
|
|
||||||
|
class func from(json:[String:Any]) -> GeoZoneModel{
|
||||||
|
let model = GeoZoneModel()
|
||||||
|
model.geofenceId = json["GEOF_ID"] as? Int ?? 0
|
||||||
|
model.radius = json["Radius"] as? Int
|
||||||
|
model.projectID = json["ProjectID"] as? Int
|
||||||
|
model.type = json["Type"] as? Int
|
||||||
|
model.description = json["Description"] as? String ?? ""
|
||||||
|
model.descriptionN = json["DescriptionN"] as? String
|
||||||
|
model.latitude = json["Latitude"] as? String
|
||||||
|
model.longitude = json["Longitude"] as? String
|
||||||
|
model.imageURL = json["ImageURL"] as? String
|
||||||
|
model.isCity = json["IsCity"] as? String
|
||||||
|
|
||||||
|
return model
|
||||||
|
}
|
||||||
|
|
||||||
|
class func list(from jsonString:String) -> [GeoZoneModel]{
|
||||||
|
let value = dictionaryArray(from: jsonString)
|
||||||
|
let geoZones = value.map { GeoZoneModel.from(json: $0) }
|
||||||
|
return geoZones
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,155 @@
|
|||||||
|
//
|
||||||
|
// HMG_Geofence.swift
|
||||||
|
// Runner
|
||||||
|
//
|
||||||
|
// Created by ZiKambrani on 13/12/2020.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
import CoreLocation
|
||||||
|
|
||||||
|
fileprivate var df = DateFormatter()
|
||||||
|
fileprivate var transition = ""
|
||||||
|
|
||||||
|
enum Transition:Int {
|
||||||
|
case entry = 1
|
||||||
|
case exit = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
class HMG_Geofence:NSObject{
|
||||||
|
var geoZones:[GeoZoneModel]?
|
||||||
|
var locationManager = CLLocationManager()
|
||||||
|
|
||||||
|
func initLocationManager(){
|
||||||
|
locationManager.delegate = self
|
||||||
|
locationManager.allowsBackgroundLocationUpdates = true
|
||||||
|
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
|
||||||
|
locationManager.activityType = .other
|
||||||
|
locationManager.requestAlwaysAuthorization()
|
||||||
|
}
|
||||||
|
|
||||||
|
func register(geoZones:[GeoZoneModel]){
|
||||||
|
self.geoZones = geoZones
|
||||||
|
|
||||||
|
self.geoZones?.forEach({ (zone) in
|
||||||
|
startMonitoring(zone: zone)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func wakeup(){
|
||||||
|
initLocationManager()
|
||||||
|
}
|
||||||
|
|
||||||
|
func monitoredRegions() -> Set<CLRegion>{
|
||||||
|
return locationManager.monitoredRegions
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// CLLocationManager Delegates
|
||||||
|
extension HMG_Geofence : CLLocationManagerDelegate{
|
||||||
|
|
||||||
|
func startMonitoring(zone: GeoZoneModel) {
|
||||||
|
if !CLLocationManager.isMonitoringAvailable(for: CLCircularRegion.self) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if CLLocationManager.authorizationStatus() != .authorizedAlways {
|
||||||
|
let message = """
|
||||||
|
Your geotification is saved but will only be activated once you grant
|
||||||
|
HMG permission to access the device location.
|
||||||
|
"""
|
||||||
|
debugPrint(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let fenceRegion = region(with: zone){
|
||||||
|
locationManager.startMonitoring(for: fenceRegion)
|
||||||
|
locationManager.requestState(for: fenceRegion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {
|
||||||
|
if region is CLCircularRegion {
|
||||||
|
handleEvent(for: region,transition: .entry, location: manager.location)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {
|
||||||
|
if region is CLCircularRegion {
|
||||||
|
handleEvent(for: region,transition: .exit, location: manager.location)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helpers
|
||||||
|
extension HMG_Geofence{
|
||||||
|
|
||||||
|
func handleEvent(for region: CLRegion!, transition:Transition, location:CLLocation?) {
|
||||||
|
if let zone = geoZone(by: region.identifier){
|
||||||
|
notifyUser(forZone: zone, transiotion: transition, location: locationManager.location)
|
||||||
|
notifyServer(forZone: zone, transiotion: transition, location: locationManager.location)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func region(with geoZone: GeoZoneModel) -> CLCircularRegion? {
|
||||||
|
|
||||||
|
if !geoZone.identifier().isEmpty,
|
||||||
|
let radius = geoZone.radius, let lat = geoZone.latitude, let long = geoZone.longitude,
|
||||||
|
let radius_d = Double("\(radius)"), let lat_d = Double(lat), let long_d = Double(long){
|
||||||
|
|
||||||
|
let coordinate = CLLocationCoordinate2D(latitude: lat_d, longitude: long_d)
|
||||||
|
let region = CLCircularRegion(center: coordinate, radius: radius_d, identifier: geoZone.identifier())
|
||||||
|
|
||||||
|
region.notifyOnEntry = true
|
||||||
|
region.notifyOnExit = true
|
||||||
|
return region
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func geoZone(by id: String) -> GeoZoneModel? {
|
||||||
|
return geoZones?.first(where: { $0.identifier() == id})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func notifyUser(forZone:GeoZoneModel, transiotion:Transition, location:CLLocation?){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func notifyServer(forZone:GeoZoneModel, transiotion:Transition, location:CLLocation?){
|
||||||
|
flutterMethodChannel?.invokeMethod("getLogGeofenceFullUrl", arguments: nil){ fullUrlString in
|
||||||
|
if let url = fullUrlString as? String{
|
||||||
|
let body:[String : Any?] = [
|
||||||
|
"PointsID":forZone.geofenceId,
|
||||||
|
"GeoType":transiotion.rawValue,
|
||||||
|
"PatientID":"1231755",
|
||||||
|
"ZipCode": "966",
|
||||||
|
"VersionID": 5.6,
|
||||||
|
"Channel": 3,
|
||||||
|
"LanguageID": UserDefaults.standard.string(forKey: "language") ?? "ar",
|
||||||
|
"IPAdress": "10.20.10.20",
|
||||||
|
"generalid": "Cs2020@2016$2958",
|
||||||
|
"PatientOutSA": 0,
|
||||||
|
"isDentalAllowedBackend": false,
|
||||||
|
"TokenID": "27v/qqXC/UGS2bgJfRBHYw==",
|
||||||
|
"DeviceTypeID": 2
|
||||||
|
]
|
||||||
|
httpPostRequest(urlString: url, jsonBody: body){ (status,json) in
|
||||||
|
if let json_ = json , status{
|
||||||
|
|
||||||
|
}else{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,189 +1,189 @@
|
|||||||
import 'dart:convert';
|
// import 'dart:convert';
|
||||||
import 'dart:core';
|
// import 'dart:core';
|
||||||
import 'dart:io';
|
// import 'dart:io';
|
||||||
import 'dart:isolate';
|
// import 'dart:isolate';
|
||||||
import 'dart:math';
|
// import 'dart:math';
|
||||||
import 'dart:ui';
|
// import 'dart:ui';
|
||||||
|
//
|
||||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
// import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart';
|
// import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart';
|
||||||
import 'package:diplomaticquarterapp/core/model/geofencing/requests/LogGeoZoneRequestModel.dart';
|
// import 'package:diplomaticquarterapp/core/model/geofencing/requests/LogGeoZoneRequestModel.dart';
|
||||||
import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart';
|
// import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart';
|
||||||
import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart';
|
// import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart';
|
||||||
import 'package:diplomaticquarterapp/locator.dart';
|
// import 'package:diplomaticquarterapp/locator.dart';
|
||||||
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
|
// import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
|
||||||
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
// import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
// import 'package:flutter/foundation.dart';
|
||||||
import 'package:geofencing/geofencing.dart';
|
// import 'package:geofencing/geofencing.dart';
|
||||||
|
//
|
||||||
class HMG_Geofencing {
|
// class HMG_Geofencing {
|
||||||
var _testTrigger = false;
|
// var _testTrigger = false;
|
||||||
static var _isolatePortName = "hmg_geofencing_send_port";
|
// static var _isolatePortName = "hmg_geofencing_send_port";
|
||||||
|
//
|
||||||
List<GeoZonesResponseModel> _zones;
|
// List<GeoZonesResponseModel> _zones;
|
||||||
List<String> registeredGeofences = [];
|
// List<String> registeredGeofences = [];
|
||||||
|
//
|
||||||
final AndroidGeofencingSettings androidSettings = AndroidGeofencingSettings(initialTrigger: <GeofenceEvent>[GeofenceEvent.enter, GeofenceEvent.exit, GeofenceEvent.dwell], loiteringDelay: 1000 * 60);
|
// final AndroidGeofencingSettings androidSettings = AndroidGeofencingSettings(initialTrigger: <GeofenceEvent>[GeofenceEvent.enter, GeofenceEvent.exit, GeofenceEvent.dwell], loiteringDelay: 1000 * 60);
|
||||||
|
//
|
||||||
final BuildContext context;
|
// final BuildContext context;
|
||||||
final List<GeofenceEvent> triggers = List();
|
// final List<GeofenceEvent> triggers = List();
|
||||||
|
//
|
||||||
HMG_Geofencing(this.context) {
|
// HMG_Geofencing(this.context) {
|
||||||
triggers.add(GeofenceEvent.enter);
|
// triggers.add(GeofenceEvent.enter);
|
||||||
triggers.add(GeofenceEvent.exit);
|
// triggers.add(GeofenceEvent.exit);
|
||||||
// triggers.add(GeofenceEvent.dwell);
|
// // triggers.add(GeofenceEvent.dwell);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Future<HMG_Geofencing> loadZones() async{
|
// Future<HMG_Geofencing> loadZones() async{
|
||||||
_zones = await locator<GeofencingServices>().getAllGeoZones(GeoZonesRequestModel());
|
// _zones = await locator<GeofencingServices>().getAllGeoZones(GeoZonesRequestModel());
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
void init() async {
|
// void init() async {
|
||||||
// debug check (Testing Geo Zones)
|
// // debug check (Testing Geo Zones)
|
||||||
if (kDebugMode) {
|
// if (kDebugMode) {
|
||||||
addTestingGeofences();
|
// addTestingGeofences();
|
||||||
}
|
// }
|
||||||
_saveZones();
|
// _saveZones();
|
||||||
await GeofencingManager.initialize();
|
// await GeofencingManager.initialize();
|
||||||
await Future.delayed(Duration(seconds: 2));
|
// await Future.delayed(Duration(seconds: 2));
|
||||||
_registerIsolatePort();
|
// _registerIsolatePort();
|
||||||
_registerGeofences().then((value) {
|
// _registerGeofences().then((value) {
|
||||||
debugPrint(value.toString());
|
// debugPrint(value.toString());
|
||||||
if(_testTrigger) {
|
// if(_testTrigger) {
|
||||||
var events = [GeofenceEvent.enter,GeofenceEvent.exit];
|
// var events = [GeofenceEvent.enter,GeofenceEvent.exit];
|
||||||
events.shuffle();
|
// events.shuffle();
|
||||||
transitionTrigger(value, null, events.first);
|
// transitionTrigger(value, null, events.first);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
void _saveZones() {
|
// void _saveZones() {
|
||||||
var list = List();
|
// var list = List();
|
||||||
_zones.forEach((element) {
|
// _zones.forEach((element) {
|
||||||
list.add(element.toJson());
|
// list.add(element.toJson());
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
var jsonString = jsonEncode(list);
|
// var jsonString = jsonEncode(list);
|
||||||
AppSharedPreferences pref = AppSharedPreferences();
|
// AppSharedPreferences pref = AppSharedPreferences();
|
||||||
pref.setString(HMG_GEOFENCES, jsonString);
|
// pref.setString(HMG_GEOFENCES, jsonString);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Future<List<String>> _registerGeofences() async {
|
// Future<List<String>> _registerGeofences() async {
|
||||||
registeredGeofences = await GeofencingManager.getRegisteredGeofenceIds();
|
// registeredGeofences = await GeofencingManager.getRegisteredGeofenceIds();
|
||||||
|
//
|
||||||
var maxLimit = Platform.isIOS ? 20 : 100;
|
// var maxLimit = Platform.isIOS ? 20 : 100;
|
||||||
|
//
|
||||||
if (registeredGeofences.length < maxLimit) {
|
// if (registeredGeofences.length < maxLimit) {
|
||||||
var notRegistered = _zones.where((element) => !(registeredGeofences.contains(element.geofenceId()))).toList();
|
// var notRegistered = _zones.where((element) => !(registeredGeofences.contains(element.geofenceId()))).toList();
|
||||||
for (int i = 0; i < notRegistered.length; i++) {
|
// for (int i = 0; i < notRegistered.length; i++) {
|
||||||
var zone = notRegistered.elementAt(i);
|
// var zone = notRegistered.elementAt(i);
|
||||||
var lat = double.tryParse(zone.latitude);
|
// var lat = double.tryParse(zone.latitude);
|
||||||
var lon = double.tryParse(zone.longitude);
|
// var lon = double.tryParse(zone.longitude);
|
||||||
var rad = double.tryParse(zone.radius.toString());
|
// var rad = double.tryParse(zone.radius.toString());
|
||||||
|
//
|
||||||
if (lat != null || lon != null || rad != null) {
|
// if (lat != null || lon != null || rad != null) {
|
||||||
await GeofencingManager.registerGeofence(GeofenceRegion(zone.geofenceId(), lat, lon, rad, triggers), transitionTrigger);
|
// await GeofencingManager.registerGeofence(GeofenceRegion(zone.geofenceId(), lat, lon, rad, triggers), transitionTrigger);
|
||||||
registeredGeofences.add(zone.geofenceId());
|
// registeredGeofences.add(zone.geofenceId());
|
||||||
if (registeredGeofences.length >= maxLimit) {
|
// if (registeredGeofences.length >= maxLimit) {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
await Future.delayed(Duration(milliseconds: 100));
|
// await Future.delayed(Duration(milliseconds: 100));
|
||||||
debugPrint("Geofence: ${zone.description} registered");
|
// debugPrint("Geofence: ${zone.description} registered");
|
||||||
} else {
|
// } else {
|
||||||
debugPrint("Geofence: ${zone.description} registered");
|
// debugPrint("Geofence: ${zone.description} registered");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return registeredGeofences;
|
// return registeredGeofences;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
void addTestingGeofences() {
|
// void addTestingGeofences() {
|
||||||
_zones.add(GeoZonesResponseModel.get("24.777577,46.652675", 150, "msH"));
|
// _zones.add(GeoZonesResponseModel.get("24.777577,46.652675", 150, "msH"));
|
||||||
_zones.add(GeoZonesResponseModel.get("24.691136,46.650116", 150, "zkH"));
|
// _zones.add(GeoZonesResponseModel.get("24.691136,46.650116", 150, "zkH"));
|
||||||
_zones.add(GeoZonesResponseModel.get("24.7087913,46.6656461", 150, "csO"));
|
// _zones.add(GeoZonesResponseModel.get("24.7087913,46.6656461", 150, "csO"));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
static void transitionTrigger(List<String> id, Location location, GeofenceEvent event) {
|
// static void transitionTrigger(List<String> id, Location location, GeofenceEvent event) {
|
||||||
var dataToSend = id.map((element) => {"event": event, "geofence_id": element}).toList() ?? [];
|
// var dataToSend = id.map((element) => {"event": event, "geofence_id": element}).toList() ?? [];
|
||||||
final SendPort send = IsolateNameServer.lookupPortByName(_isolatePortName);
|
// final SendPort send = IsolateNameServer.lookupPortByName(_isolatePortName);
|
||||||
send?.send(dataToSend);
|
// send?.send(dataToSend);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
ReceivePort _port = ReceivePort();
|
// ReceivePort _port = ReceivePort();
|
||||||
void _registerIsolatePort() async{
|
// void _registerIsolatePort() async{
|
||||||
IsolateNameServer.registerPortWithName(_port.sendPort, _isolatePortName);
|
// IsolateNameServer.registerPortWithName(_port.sendPort, _isolatePortName);
|
||||||
_port.listen((dynamic data) {
|
// _port.listen((dynamic data) {
|
||||||
|
//
|
||||||
Future result = AppSharedPreferences().getStringWithDefaultValue(HMG_GEOFENCES,"[]");
|
// Future result = AppSharedPreferences().getStringWithDefaultValue(HMG_GEOFENCES,"[]");
|
||||||
result.then((jsonString){
|
// result.then((jsonString){
|
||||||
|
//
|
||||||
List jsonList = json.decode(jsonString) ?? [];
|
// List jsonList = json.decode(jsonString) ?? [];
|
||||||
List<GeoZonesResponseModel> geoList = jsonList.map((e) => GeoZonesResponseModel().fromJson(e)).toList() ?? [];
|
// List<GeoZonesResponseModel> geoList = jsonList.map((e) => GeoZonesResponseModel().fromJson(e)).toList() ?? [];
|
||||||
|
//
|
||||||
(data as List).forEach((element) async {
|
// (data as List).forEach((element) async {
|
||||||
GeofenceEvent geofenceEvent = element["event"];
|
// GeofenceEvent geofenceEvent = element["event"];
|
||||||
String geofence_id = element["geofence_id"];
|
// String geofence_id = element["geofence_id"];
|
||||||
|
//
|
||||||
GeoZonesResponseModel geoZone = _findByGeofenceFrom(geoList, by: geofence_id);
|
// GeoZonesResponseModel geoZone = _findByGeofenceFrom(geoList, by: geofence_id);
|
||||||
if(geoZone != null) {
|
// if(geoZone != null) {
|
||||||
LocalNotification.getInstance().showNow(
|
// LocalNotification.getInstance().showNow(
|
||||||
title: "GeofenceEvent: ${_nameOf(geofenceEvent)}",
|
// title: "GeofenceEvent: ${_nameOf(geofenceEvent)}",
|
||||||
subtitle: geoZone.description,
|
// subtitle: geoZone.description,
|
||||||
payload: json.encode(geoZone.toJson()));
|
// payload: json.encode(geoZone.toJson()));
|
||||||
|
//
|
||||||
_logGeoZoneToServer(zoneId: geoZone.geofId, transition: _idOf(geofenceEvent));
|
// _logGeoZoneToServer(zoneId: geoZone.geofId, transition: _idOf(geofenceEvent));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
await Future.delayed(Duration(milliseconds: 700));
|
// await Future.delayed(Duration(milliseconds: 700));
|
||||||
|
//
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
_logGeoZoneToServer({int zoneId, int transition}){
|
// _logGeoZoneToServer({int zoneId, int transition}){
|
||||||
locator<GeofencingServices>()
|
// locator<GeofencingServices>()
|
||||||
.logGeoZone(LogGeoZoneRequestModel(GeoType: transition, PointsID: zoneId ?? 1))
|
// .logGeoZone(LogGeoZoneRequestModel(GeoType: transition, PointsID: zoneId ?? 1))
|
||||||
.then((response){
|
// .then((response){
|
||||||
|
//
|
||||||
}).catchError((error){
|
// }).catchError((error){
|
||||||
|
//
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
GeoZonesResponseModel _findByGeofenceFrom(List<GeoZonesResponseModel> list, { String by}) {
|
// GeoZonesResponseModel _findByGeofenceFrom(List<GeoZonesResponseModel> list, { String by}) {
|
||||||
var have = list.where((element) => element.geofenceId() == by).toList().first;
|
// var have = list.where((element) => element.geofenceId() == by).toList().first;
|
||||||
return have;
|
// return have;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String _nameOf(GeofenceEvent event) {
|
// String _nameOf(GeofenceEvent event) {
|
||||||
switch (event) {
|
// switch (event) {
|
||||||
case GeofenceEvent.enter:
|
// case GeofenceEvent.enter:
|
||||||
return "Enter";
|
// return "Enter";
|
||||||
case GeofenceEvent.exit:
|
// case GeofenceEvent.exit:
|
||||||
return "Exit";
|
// return "Exit";
|
||||||
case GeofenceEvent.dwell:
|
// case GeofenceEvent.dwell:
|
||||||
return "dWell";
|
// return "dWell";
|
||||||
default:
|
// default:
|
||||||
return event.toString();
|
// return event.toString();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
int _idOf(GeofenceEvent event){
|
// int _idOf(GeofenceEvent event){
|
||||||
switch (event) {
|
// switch (event) {
|
||||||
case GeofenceEvent.enter:
|
// case GeofenceEvent.enter:
|
||||||
return 1;
|
// return 1;
|
||||||
case GeofenceEvent.exit:
|
// case GeofenceEvent.exit:
|
||||||
return 2;
|
// return 2;
|
||||||
case GeofenceEvent.dwell:
|
// case GeofenceEvent.dwell:
|
||||||
return 3;
|
// return 3;
|
||||||
default:
|
// default:
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
Loading…
Reference in New Issue