Fix iOS URL issue
This commit is contained in:
parent
1970ca8783
commit
0f37947be1
1 changed files with 35 additions and 24 deletions
|
|
@ -39,7 +39,7 @@ class Preferences {
|
||||||
'low' => bg.Config.DESIRED_ACCURACY_LOW,
|
'low' => bg.Config.DESIRED_ACCURACY_LOW,
|
||||||
_ => bg.Config.DESIRED_ACCURACY_MEDIUM,
|
_ => bg.Config.DESIRED_ACCURACY_MEDIUM,
|
||||||
},
|
},
|
||||||
url: instance.getString(url),
|
url: _formatUrl(instance.getString(url)),
|
||||||
params: {
|
params: {
|
||||||
"device_id": instance.getString(id),
|
"device_id": instance.getString(id),
|
||||||
},
|
},
|
||||||
|
|
@ -48,7 +48,19 @@ class Preferences {
|
||||||
maxRecordsToPersist: instance.getBool(buffer) != false ? -1 : 0,
|
maxRecordsToPersist: instance.getBool(buffer) != false ? -1 : 0,
|
||||||
logLevel: bg.Config.LOG_LEVEL_INFO,
|
logLevel: bg.Config.LOG_LEVEL_INFO,
|
||||||
logMaxDays: 1,
|
logMaxDays: 1,
|
||||||
locationTemplate: '''{
|
locationTemplate: _locationTemplate(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String? _formatUrl(String? url) {
|
||||||
|
if (url == null) return null;
|
||||||
|
final uri = Uri.parse(url);
|
||||||
|
if ((uri.path.isEmpty || uri.path == '') && !url.endsWith('/')) return '$url/';
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String _locationTemplate() {
|
||||||
|
return '''{
|
||||||
"timestamp": "<%= timestamp %>",
|
"timestamp": "<%= timestamp %>",
|
||||||
"coords": {
|
"coords": {
|
||||||
"latitude": <%= latitude %>,
|
"latitude": <%= latitude %>,
|
||||||
|
|
@ -70,8 +82,7 @@ class Preferences {
|
||||||
},
|
},
|
||||||
"extras": {},
|
"extras": {},
|
||||||
"_": "&id=${instance.getString(id)}&lat=<%= latitude %>&lon=<%= longitude %>×tamp=<%= timestamp %>&"
|
"_": "&id=${instance.getString(id)}&lat=<%= latitude %>&lon=<%= longitude %>×tamp=<%= timestamp %>&"
|
||||||
}'''.split('\n').map((line) => line.trimLeft()).join(),
|
}'''.split('\n').map((line) => line.trimLeft()).join();
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> _migrate() async {
|
static Future<void> _migrate() async {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue