Skip to content

Commit 4a8c719

Browse files
authored
Merge branch 'main' into neelkanth-kaushik/LIBRARIES-2724
2 parents 560cebc + 0a82acd commit 4a8c719

File tree

11 files changed

+61
-56
lines changed

11 files changed

+61
-56
lines changed

.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ migrate_working_dir/
1616
*.iws
1717
.idea/
1818

19-
# The .vscode folder contains launch configuration and tasks you configure in
20-
# VS Code which you may wish to be included in version control, so this line
21-
# is commented out by default.
22-
#.vscode/
23-
2419
# Flutter/Dart/Pub related
2520
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
2621
pubspec.lock
22+
_pubspec.lock
2723
**/doc/api/
2824
.dart_tool/
2925
.packages
@@ -36,6 +32,7 @@ build/
3632

3733
# VSCode
3834
launch.json
35+
**/.vscode/
3936

4037
#Coverage
4138
coverage/

README.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ The main [segment_analytics](http://pub.dev/packages/segment_analytics) package.
1515

1616
[Docs](packages/core#readme)
1717

18+
[Changelog](packages/core/CHANGELOG.md)
19+
1820
## Plugins
1921

2022
### Adjust (`segment_analytics_plugin_adjust`)
@@ -62,26 +64,6 @@ Some destination plugins might not support all platform functionality. Refer to
6264

6365
See the [example app](./example/README.md) to check a full test app of how to integrate Analytics-Flutter into your own Flutter app.
6466

65-
## Release Notes
66-
67-
### Version 1.1.7
68-
69-
1. **Release Date** - 21<sup>st</sup> May 2025.
70-
71-
2. **Fixes Github Issue [#144](https://github.com/segmentio/analytics_flutter/issues/144)** - Up to version 1.1.6, the `setFlushPolicies` method inadvertently overwrote the `Configuration.collectDeviceId`property. This issue has been resolved in version 1.1.7.
72-
73-
3. **Fixes Github Issue [#147](https://github.com/segmentio/analytics_flutter/issues/147)** - The `compileSdkVersion` in the `build.gradle` file has been updated from 31 to 35. Previously, this caused the following error:
74-
`Android build error "Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'android.content.pm.ApplicationInfo?"` . This update resolves the issue with `compileSdkVersion 35`.
75-
76-
4. **Fixes Github Issue [#138](https://github.com/segmentio/analytics_flutter/issues/138)** - Prior to version 1.1.7, the version field returned the browser's version string instead of the app version from `pubspec.yaml`. Since `pubspec.yaml` is a build-time configuration file and not accessible at runtime (especially in browser environments), this was expected behavior.
77-
As of version 1.1.7, if the following tag is added to `<project-root>/web/index.html`: `<meta name="app-version" content="1.2.3">`
78-
the app will return the value in the `content` attribute.
79-
**Note:** This value should be manually synchronized with the version in `pubspec.yaml`.
80-
81-
5. **Fixes Github Issue [#152](https://github.com/segmentio/analytics_flutter/issues/152) and [#98](https://github.com/segmentio/analytics_flutter/issues/98)** - Until version 1.1.6, the `integrations: {}` field was missing in the data payload sent to the Segment server. This has been addressed in version 1.1.7.
82-
83-
6. **Fixes Github Issue [#157](https://github.com/segmentio/analytics_flutter/issues/157)** - Resolves the `Concurrent modification during iteration: Instance(length: 6) of '_GrowableList'` error that occurred when multiple plugins were added simultaneously.
84-
8567
## Contributing
8668

8769
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

packages/core/CHANGELOG.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
## 1.1.9
2+
3+
- Fix for storageJson configuration properly enabling/disabling writing of files on all platforms #171
4+
15
## 1.1.8
26

3-
- Reverting fix for #152
7+
- Reverting fix for #152 - The `integrations` field is vestigial and remains available for SDK users to populate to suppress extra events from server side destinations.
48

59
## 1.1.7
610

7-
- Fix for setFlushPolicies method is overwriting Configuration properties #144
8-
- Fix for Android build error on nullable receiver in sdk 35 #147
9-
- Fix for Context app version wrong on Flutter web #138
10-
- Fix for Integrations field is empty in segment analytics #152
11+
- Fix for setFlushPolicies method is overwriting Configuration properties #144 - Up to version 1.1.6, the `setFlushPolicies` method inadvertently overwrote the `Configuration.collectDeviceId`property.
12+
- Fix for Android build error on nullable receiver in sdk 35 #147 - The `compileSdkVersion` in the `build.gradle` file has been updated from 31 to 35. Previously, this caused the following error:
13+
`Android build error "Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'android.content.pm.ApplicationInfo?"`.
14+
- Fix for Context app version wrong on Flutter web #138 - Prior to version 1.1.7, the version field returned the browser's version string instead of the app version from `pubspec.yaml`. Since `pubspec.yaml` is a build-time configuration file and not accessible at runtime (especially in browser environments), this was expected behavior.
15+
As of version 1.1.7, if the following tag is added to `<project-root>/web/index.html`: `<meta name="app-version" content="1.2.3">`
16+
the app will return the value in the `content` attribute.
17+
**Note:** This value should be manually synchronized with the version in `pubspec.yaml`.
18+
- Fix for Integrations field is empty in segment analytics #152 - Until version 1.1.6, the `integrations: {}` field was missing in the data payload sent to the Segment server.
1119
- Fix for AppsFlyer Destination not initializing properly #98
12-
- fix for Crash in Timeline.applyPlugins #157
20+
- fix for Crash in Timeline.applyPlugins #157 - Resolves the `Concurrent modification during iteration: Instance(length: 6) of '_GrowableList'` error that occurred when multiple plugins were added simultaneously.
1321

1422
## 1.1.6
1523

packages/core/README.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -578,25 +578,7 @@ See the [example app](../../example/README.md) to check a full test app of how t
578578

579579
## Release Notes
580580

581-
### Version 1.1.8 (10 Jul 2025)
582-
583-
Reverting fix for #152
584-
585-
### Version 1.1.7 (21 May 2025)
586-
587-
1. **Fixes Github Issue [#144](https://github.com/segmentio/analytics_flutter/issues/144)** - Up to version 1.1.6, the `setFlushPolicies` method inadvertently overwrote the `Configuration.collectDeviceId`property. This issue has been resolved in version 1.1.7.
588-
589-
2. **Fixes Github Issue [#147](https://github.com/segmentio/analytics_flutter/issues/147)** - The `compileSdkVersion` in the `build.gradle` file has been updated from 31 to 35. Previously, this caused the following error:
590-
`Android build error "Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'android.content.pm.ApplicationInfo?"` . This update resolves the issue with `compileSdkVersion 35`.
591-
592-
3. **Fixes Github Issue [#138](https://github.com/segmentio/analytics_flutter/issues/138)** - Prior to version 1.1.7, the version field returned the browser's version string instead of the app version from `pubspec.yaml`. Since `pubspec.yaml` is a build-time configuration file and not accessible at runtime (especially in browser environments), this was expected behavior.
593-
As of version 1.1.7, if the following tag is added to `<project-root>/web/index.html`: `<meta name="app-version" content="1.2.3">`
594-
the app will return the value in the `content` attribute.
595-
**Note:** This value should be manually synchronized with the version in `pubspec.yaml`.
596-
597-
4. **Fixes Github Issue [#152](https://github.com/segmentio/analytics_flutter/issues/152) and [#98](https://github.com/segmentio/analytics_flutter/issues/98)** - Until version 1.1.6, the `integrations: {}` field was missing in the data payload sent to the Segment server. This has been addressed in version 1.1.7.
598-
599-
5. **Fixes Github Issue [#157](https://github.com/segmentio/analytics_flutter/issues/157)** - Resolves the `Concurrent modification during iteration: Instance(length: 6) of '_GrowableList'` error that occurred when multiple plugins were added simultaneously.
581+
See our [Changelog](./CHANGELOG.md) for release notes.
600582

601583
## Contributing
602584

packages/core/lib/client.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Analytics createClient(Configuration configuration) {
1919
configuration = setFlushPolicies(configuration, defaultFlushPolicies);
2020
}
2121

22-
final analytics = Analytics(configuration, storeFactory());
22+
final analytics = Analytics(
23+
configuration,
24+
storeFactory(storageJson: configuration.storageJson ?? true),
25+
);
2326

2427
if (configuration.debug) {
2528
analytics.addPlugin(EventLogger());

packages/core/lib/utils/store/io.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ import 'package:segment_analytics/utils/store/store.dart';
99
import 'package:path_provider/path_provider.dart';
1010

1111
class StoreImpl with Store {
12+
final bool storageJson;
13+
StoreImpl({this.storageJson = true});
1214
@override
1315
Future<Map<String, dynamic>?> getPersisted(String key) {
16+
if (!storageJson) return Future.value(null);
1417
return _readFile(key);
1518
}
1619

@@ -19,8 +22,18 @@ class StoreImpl with Store {
1922

2023
@override
2124
Future setPersisted(String key, Map<String, dynamic> value) {
25+
if (!storageJson) return Future.value();
2226
return _writeFile(key, value);
2327
}
28+
29+
@override
30+
Future deletePersisted(String key) async {
31+
if (!storageJson) return;
32+
final file = File(await _fileName(key));
33+
if (await file.exists()) {
34+
await file.delete();
35+
}
36+
}
2437

2538
Future _writeFile(String fileKey, Map<String, dynamic> data) async {
2639
RandomAccessFile file =

packages/core/lib/utils/store/store.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ mixin Store {
44
Future<Map<String, dynamic>?> getPersisted(String key);
55

66
Future setPersisted(String key, Map<String, dynamic> value);
7+
8+
Future deletePersisted(String key);
79

810
Future get ready;
911

1012
void dispose();
1113
}
1214

13-
StoreImpl storeFactory() {
14-
return StoreImpl();
15+
StoreImpl storeFactory({bool storageJson = true}) {
16+
return StoreImpl(storageJson: storageJson);
1517
}

packages/core/lib/utils/store/unsupported.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import 'package:segment_analytics/errors.dart';
44
import 'store.dart';
55

66
class StoreImpl with Store {
7+
final bool storageJson;
8+
StoreImpl({this.storageJson = true});
79
@override
810
Future<Map<String, dynamic>?> getPersisted(String key) {
911
throw PlatformNotSupportedError();
@@ -16,9 +18,14 @@ class StoreImpl with Store {
1618
Future setPersisted(String key, Map<String, dynamic> value) {
1719
throw PlatformNotSupportedError();
1820
}
21+
22+
@override
23+
Future deletePersisted(String key) {
24+
throw PlatformNotSupportedError();
25+
}
1926

2027
@override
2128
void dispose() {
2229
throw PlatformNotSupportedError();
2330
}
24-
}
31+
}

packages/core/lib/utils/store/web.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import 'package:segment_analytics/utils/store/store.dart';
55
import 'package:web/web.dart' as web;
66

77
class StoreImpl implements Store {
8+
final bool storageJson;
9+
StoreImpl({this.storageJson = true});
810
web.Storage get localStorage => web.window.localStorage;
911

1012
@override
1113
Future<Map<String, dynamic>?> getPersisted(String key) {
14+
if (!storageJson) return Future.value(null);
1215
return _readFromStorage(key);
1316
}
1417

@@ -17,9 +20,17 @@ class StoreImpl implements Store {
1720

1821
@override
1922
Future setPersisted(String key, Map<String, dynamic> value) {
23+
if (!storageJson) return Future.value();
2024
_writeToStorage(key, value);
2125
return Future.value();
2226
}
27+
28+
@override
29+
Future deletePersisted(String key) {
30+
if (!storageJson) return Future.value();
31+
localStorage.removeItem(_getFileName(key));
32+
return Future.value();
33+
}
2334

2435
String _getFileName(String fileKey) {
2536
return "analytics-flutter-$fileKey.json";

packages/core/lib/version.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const segmentVersion = "1.1.8";
1+
const segmentVersion = "1.1.9";

0 commit comments

Comments
 (0)