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,
|
||||
_ => bg.Config.DESIRED_ACCURACY_MEDIUM,
|
||||
},
|
||||
url: instance.getString(url),
|
||||
url: _formatUrl(instance.getString(url)),
|
||||
params: {
|
||||
"device_id": instance.getString(id),
|
||||
},
|
||||
|
|
@ -48,7 +48,19 @@ class Preferences {
|
|||
maxRecordsToPersist: instance.getBool(buffer) != false ? -1 : 0,
|
||||
logLevel: bg.Config.LOG_LEVEL_INFO,
|
||||
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 %>",
|
||||
"coords": {
|
||||
"latitude": <%= latitude %>,
|
||||
|
|
@ -70,8 +82,7 @@ class Preferences {
|
|||
},
|
||||
"extras": {},
|
||||
"_": "&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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue