Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/aptabase_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum _SendResult { disabled, success, discard, tryAgain }
class Aptabase {
Aptabase._();

static const _sdkVersion = "aptabase_flutter@0.4.1";
static const _sdkVersion = "aptabase_flutter@0.4.2";
static const _sessionTimeout = Duration(hours: 1);

static const Map<String, String> _hosts = {
Expand All @@ -39,9 +39,9 @@ class Aptabase {

static final _http = newUniversalHttpClient();

static late final String _appKey;
static String? _appKey;
static Uri? _apiUrl;
static late final InitOptions _initOptions;
static late final Uri? _apiUrl;
static var _sessionId = _newSessionId();
static var _lastTouchTs = DateTime.now().toUtc();
static Timer? _timer;
Expand Down Expand Up @@ -187,7 +187,8 @@ class Aptabase {
String eventName, [
Map<String, dynamic>? props,
]) async {
if (_appKey.isEmpty || _apiUrl == null) {
final appKey = _appKey;
if (_apiUrl == null || appKey == null || appKey.isEmpty) {
_logInfo("Tracking is disabled!");

return;
Expand All @@ -211,7 +212,8 @@ class Aptabase {
static Future<_SendResult> _send(List<String> events) async {
try {
final apiUrl = _apiUrl;
if (apiUrl == null) {
final appKey = _appKey;
if (apiUrl == null || appKey == null) {
_logInfo("Tracking is disabled!");

return _SendResult.disabled;
Expand All @@ -221,7 +223,7 @@ class Aptabase {

request.followRedirects = true;
request.headers
..set("App-Key", _appKey)
..set("App-Key", appKey)
..set(
HttpHeaders.contentTypeHeader,
"application/json; charset=UTF-8",
Expand Down
12 changes: 6 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: aptabase_flutter
description: "Flutter SDK for Aptabase: Open Source Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps"
version: 0.4.1
version: 0.4.2
homepage: https://aptabase.com
repository: https://github.com/aptabase/aptabase_flutter
issue_tracker: https://github.com/aptabase/aptabase_flutter/issues
Expand All @@ -12,12 +12,12 @@ environment:
dependencies:
flutter:
sdk: flutter
package_info_plus: ^8.0.0
device_info_plus: ^10.1.0
universal_io: ^2.2.2
shared_preferences: ^2.3.3
package_info_plus: any
device_info_plus: any
universal_io: any
shared_preferences: any

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ^6.0.0