Skip to content

Commit ac5d9ae

Browse files
author
weiqiangliu
committed
Release 1.0.5
1 parent 2abc55e commit ac5d9ae

File tree

16 files changed

+67
-388
lines changed

16 files changed

+67
-388
lines changed

.idea/workspace.xml

Lines changed: 5 additions & 314 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## 1.0.3
1+
## 1.0.5
2+
3+
* 增加合规功能
4+
5+
## 1.0.4
26

37
* 属性中适配 DateTime 实例
48

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
```yml
1818
dependencies:
1919
# 添加神策 flutter plugin
20-
sensors_analytics_flutter_plugin: ^1.0.4
20+
sensors_analytics_flutter_plugin: ^1.0.5
2121
```
2222
2323
执行 flutter packages get 命令安装插件

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ android {
3333
}
3434

3535
dependencies {
36-
api 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.2.1'
36+
api 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:4.4.9'
3737
}

android/src/main/java/com/sensorsdata/analytics/sensorsanalyticsflutterplugin/SensorsAnalyticsFlutterPlugin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
104104
case "profileUnsetPushId":
105105
profileUnsetPushId(list);
106106
break;
107+
case "enableDataCollect":
108+
enableDataCollect();
109+
break;
107110
default:
108111
result.notImplemented();
109112
break;
@@ -278,6 +281,13 @@ private void profileUnsetPushId(List list){
278281
SensorsDataAPI.sharedInstance().profileUnsetPushId((String)list.get(0));
279282
}
280283

284+
/**
285+
* 开启数据采集
286+
*/
287+
private void enableDataCollect(){
288+
SensorsDataAPI.sharedInstance().enableDataCollect();
289+
}
290+
281291
private JSONObject assertProperties(Map map) {
282292
if (map != null) {
283293
return new JSONObject(map);

example/android/app/src/main/java/com/sensorsdata/analytics/sensorsanalyticsflutterplugin_example/App.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private void initSensorsDataAPI() {
3434
SensorsAnalyticsAutoTrackEventType.APP_CLICK)
3535
.enableTrackAppCrash()
3636
.enableVisualizedAutoTrack(true)
37+
//.disableDataCollect()
3738
.enableVisualizedAutoTrackConfirmDialog(true);
3839
SensorsDataAPI.startWithConfigOptions(this, configOptions);
3940
SensorsDataAPI.sharedInstance(this).trackFragmentAppViewScreen();

example/ios/Podfile

Lines changed: 15 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
platform :ios, '9.0'
2+
# platform :ios, '9.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -10,75 +10,29 @@ project 'Runner', {
1010
'Release' => :release,
1111
}
1212

13-
def parse_KV_file(file, separator='=')
14-
file_abs_path = File.expand_path(file)
15-
if !File.exists? file_abs_path
16-
return [];
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
1717
end
18-
generated_key_values = {}
19-
skip_line_start_symbols = ["#", "/"]
20-
File.foreach(file_abs_path) do |line|
21-
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22-
plugin = line.split(pattern=separator)
23-
if plugin.length == 2
24-
podname = plugin[0].strip()
25-
path = plugin[1].strip()
26-
podpath = File.expand_path("#{path}", file_abs_path)
27-
generated_key_values[podname] = podpath
28-
else
29-
puts "Invalid plugin specification: #{line}"
30-
end
31-
end
32-
generated_key_values
33-
end
34-
35-
target 'Runner' do
36-
# Flutter Pod
37-
38-
copied_flutter_dir = File.join(__dir__, 'Flutter')
39-
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
40-
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
41-
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
42-
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
43-
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
44-
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
4518

46-
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
47-
unless File.exist?(generated_xcode_build_settings_path)
48-
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
49-
end
50-
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
51-
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
52-
53-
unless File.exist?(copied_framework_path)
54-
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
55-
end
56-
unless File.exist?(copied_podspec_path)
57-
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
58-
end
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
5922
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
6025

61-
# Keep pod path relative so it can be checked into Podfile.lock.
62-
pod 'Flutter', :path => 'Flutter'
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
6327

64-
# Plugin Pods
28+
flutter_ios_podfile_setup
6529

66-
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
67-
# referring to absolute paths on developers' machines.
68-
system('rm -rf .symlinks')
69-
system('mkdir -p .symlinks/plugins')
70-
plugin_pods = parse_KV_file('../.flutter-plugins')
71-
plugin_pods.each do |name, path|
72-
symlink = File.join('.symlinks', 'plugins', name)
73-
File.symlink(path, symlink)
74-
pod name, :path => File.join(symlink, 'ios')
75-
end
30+
target 'Runner' do
31+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
7632
end
7733

7834
post_install do |installer|
7935
installer.pods_project.targets.each do |target|
80-
target.build_configurations.each do |config|
81-
config.build_settings['ENABLE_BITCODE'] = 'NO'
82-
end
36+
flutter_additional_ios_build_settings(target)
8337
end
8438
end

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
22
- Flutter (1.0.0)
3-
- sensors_analytics_flutter_plugin (1.0.2):
3+
- sensors_analytics_flutter_plugin (1.0.5):
44
- Flutter
55
- SensorsAnalyticsSDK
66
- SensorsAnalyticsSDK (2.2.4):
@@ -23,9 +23,9 @@ EXTERNAL SOURCES:
2323

2424
SPEC CHECKSUMS:
2525
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
26-
sensors_analytics_flutter_plugin: 67005f4a6591e48b68618f18dd5a68e842598056
26+
sensors_analytics_flutter_plugin: 28c92a16312453a6834eda00ee94d27a5406adf1
2727
SensorsAnalyticsSDK: d898a6b6427dc842fa8c54c4cfb17dcc8a7e2220
2828

29-
PODFILE CHECKSUM: 8685ee79ad9489b94b9f1ac3974f4638bb57b02e
29+
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
3030

3131
COCOAPODS: 1.9.3

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 51;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -220,7 +220,7 @@
220220
);
221221
runOnlyForDeploymentPostprocessing = 0;
222222
shellPath = /bin/sh;
223-
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
223+
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
224224
};
225225
9740EEB61CF901F6004384FC /* Run Script */ = {
226226
isa = PBXShellScriptBuildPhase;
@@ -234,7 +234,7 @@
234234
);
235235
runOnlyForDeploymentPostprocessing = 0;
236236
shellPath = /bin/sh;
237-
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
237+
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
238238
};
239239
98F6785E94D4D2429BB76349 /* [CP] Embed Pods Frameworks */ = {
240240
isa = PBXShellScriptBuildPhase;

example/lib/main.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ class _MyAppState extends State<MyApp> {
113113
SensorsAnalyticsFlutterPlugin.profileUnsetPushId("jgId");
114114
},
115115
),
116+
ListTile(
117+
title: Text("合规功能测试"),
118+
onTap: () {
119+
SensorsAnalyticsFlutterPlugin.enableDataCollect();
120+
},
121+
),
116122
ListTile(
117123
title: Text(
118124
'https://github.com/sensorsdata/sensors_analytics_flutter_plugin'),

0 commit comments

Comments
 (0)