Commit 4cd28c4a authored by 汪林玲's avatar 汪林玲

iOS事件

parent b7e96935
PODS:
- Flutter (1.0.0)
- UMCommon (7.3.5):
- UMDevice
- UMDevice (2.0.4)
- umeng_common_sdk (1.0.0):
- Flutter
- UMCommon
- UMDevice
DEPENDENCIES:
- Flutter (from `Flutter`)
- umeng_common_sdk (from `.symlinks/plugins/umeng_common_sdk/ios`)
SPEC REPOS:
trunk:
- UMCommon
- UMDevice
EXTERNAL SOURCES:
Flutter:
:path: Flutter
umeng_common_sdk:
:path: ".symlinks/plugins/umeng_common_sdk/ios"
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
UMCommon: ab4d875ddefe1b06c60b577e4a58bc4d433ee067
UMDevice: 590115ebb238250e574988c7a3e9511f5d5cd4d3
umeng_common_sdk: 51fabf3b59f6a0f293a6fc0d35251c943d2f69ab
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
COCOAPODS: 1.10.1
...@@ -365,7 +365,7 @@ ...@@ -365,7 +365,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 486K7NX823; DEVELOPMENT_TEAM = 4R6KK56452;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -380,7 +380,7 @@ ...@@ -380,7 +380,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.umeng.umengCommonSdkExample; PRODUCT_BUNDLE_IDENTIFIER = com.umeng.umengComm12;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
...@@ -497,7 +497,7 @@ ...@@ -497,7 +497,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 486K7NX823; DEVELOPMENT_TEAM = 4R6KK56452;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -512,7 +512,7 @@ ...@@ -512,7 +512,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.umeng.umengCommonSdkExample; PRODUCT_BUNDLE_IDENTIFIER = com.umeng.umengComm12;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
...@@ -524,7 +524,7 @@ ...@@ -524,7 +524,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 486K7NX823; DEVELOPMENT_TEAM = 4R6KK56452;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
...@@ -539,7 +539,7 @@ ...@@ -539,7 +539,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = com.umeng.umengCommonSdkExample; PRODUCT_BUNDLE_IDENTIFIER = com.umeng.umengComm12;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
......
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:umeng_common_sdk/umeng_common_sdk.dart'; import 'package:umeng_common_sdk/umeng_common_sdk.dart';
...@@ -14,16 +16,22 @@ class _MyAppState extends State<MyApp> { ...@@ -14,16 +16,22 @@ class _MyAppState extends State<MyApp> {
@override @override
void initState() { void initState() {
UmengCommonSdk.preInit( UmengCommonSdk.preInit(
appKey: '6130b199695f794bbd9cb984', appKey: Platform.isIOS
? '6131e783695f794bbd9ed608'
: '6130b199695f794bbd9cb984',
channel: 'qiaomeng', channel: 'qiaomeng',
enableLog: true, enableLog: true,
).then((value) {}).whenComplete(() { ).then((value) {}).whenComplete(() {
Future.delayed(Duration(seconds: 15), () { Future.delayed(Duration(seconds: 15), () {
UmengCommonSdk.init( UmengCommonSdk.init(
appKey: '6130b199695f794bbd9cb984', appKey: Platform.isIOS
? '6131e783695f794bbd9ed608'
: '6130b199695f794bbd9cb984',
channel: 'qiaomeng', channel: 'qiaomeng',
deviceType: 1, deviceType: 1,
pushSecret: '6130b199695f794bbd9cb984', pushSecret: Platform.isIOS
? '6131e783695f794bbd9ed608'
: '6130b199695f794bbd9cb984',
); );
}); });
}); });
...@@ -42,13 +50,31 @@ class _MyAppState extends State<MyApp> { ...@@ -42,13 +50,31 @@ class _MyAppState extends State<MyApp> {
await UmengCommonSdk.onEvent( await UmengCommonSdk.onEvent(
event: 'event_test', event: 'event_test',
properties: { properties: {
'key': '测试上传数据', 'key': 'Key数据',
'key1': '测试上传数据', 'key1': 'Key1数据',
}, },
); );
}, },
child: Text('上报事件'), child: Text('上报事件'),
), ),
TextButton(
onPressed: () async {
await UmengCommonSdk.onPageStart(pageName: "/PAGE/HOST/A");
},
child: Text('页面打开'),
),
TextButton(
onPressed: () async {
await UmengCommonSdk.onPageStart(pageName: "/PAGE/HOST/B");
},
child: Text('关闭'),
),
TextButton(
onPressed: () async {
await UmengCommonSdk.onSignIn(userId: "user_id");
},
child: Text('用户登陆'),
),
], ],
), ),
), ),
......
name: umeng_common_sdk_example name: umeng_common_sdk_example
description: Demonstrates how to use the umeng_common_sdk plugin. description: Demonstrates how to use the umeng_common_sdk plugin.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment: environment:
...@@ -13,59 +11,10 @@ dependencies: ...@@ -13,59 +11,10 @@ dependencies:
sdk: flutter sdk: flutter
umeng_common_sdk: umeng_common_sdk:
# When depending on this package from a real application you should use:
# umeng_common_sdk: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../ path: ../
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.3
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter: flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true uses-material-design: true
\ No newline at end of file
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// gestures. You can also use WidgetTester to find child widgets in the widget // gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct. // tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
......
...@@ -8,12 +8,18 @@ ...@@ -8,12 +8,18 @@
+ (BOOL)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result{ + (BOOL)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result{
BOOL resultCode = YES; BOOL resultCode = YES;
if ([@"initCommon" isEqualToString:call.method]){ if([@"preInit" isEqualToString:call.method]){
NSArray* arguments = (NSArray *)call.arguments; NSString *appKey = call.arguments[@"appKey"];
NSString* appkey = arguments[1]; NSString *channel = call.arguments[@"channel"];
NSString* channel = arguments[2]; NSNumber *enableLog =call.arguments[@"enableLog"];
[UMConfigure initWithAppkey:appkey channel:channel]; [UMConfigure setLogEnabled:enableLog.intValue == 1];
//result(@"success"); result(@YES);
NSLog(@"========> appKey:%@ channel:%@ enableLog:%@",appKey,channel,enableLog);
}else if ([@"init" isEqualToString:call.method]){
NSString *appKey = call.arguments[@"appKey"];
NSString *channel = call.arguments[@"channel"];
[UMConfigure initWithAppkey:appKey channel:channel];
result(@YES);
} }
else{ else{
resultCode = NO; resultCode = NO;
...@@ -28,21 +34,25 @@ ...@@ -28,21 +34,25 @@
+ (BOOL)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result{ + (BOOL)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result{
BOOL resultCode = YES; BOOL resultCode = YES;
NSArray* arguments = (NSArray *)call.arguments;
if ([@"onEvent" isEqualToString:call.method]){ if ([@"onEvent" isEqualToString:call.method]){
NSString* eventName = arguments[0]; NSString *eventId = call.arguments[@"eventId"];
NSDictionary* properties = arguments[1]; NSDictionary* properties = call.arguments[@"properties"];
[MobClick event:eventName attributes:properties]; [MobClick event:eventId attributes:properties];
//result(@"success"); result(@YES);
} }
else if ([@"onProfileSignIn" isEqualToString:call.method]){ else if ([@"onSignIn" isEqualToString:call.method]){
NSString* userID = arguments[0]; NSString *userId = call.arguments[@"userId"];
[MobClick profileSignInWithPUID:userID]; NSString *provider = call.arguments[@"provider"];
//result(@"success"); if(provider){
[MobClick profileSignInWithPUID:userId provider:provider];
}else{
[MobClick profileSignInWithPUID:userId];
}
result(@YES);
} }
else if ([@"onProfileSignOff" isEqualToString:call.method]){ else if ([@"onSignOff" isEqualToString:call.method]){
[MobClick profileSignOff]; [MobClick profileSignOff];
//result(@"success"); result(@YES);
} }
else if ([@"setPageCollectionModeAuto" isEqualToString:call.method]){ else if ([@"setPageCollectionModeAuto" isEqualToString:call.method]){
[MobClick setAutoPageEnabled:YES]; [MobClick setAutoPageEnabled:YES];
...@@ -53,14 +63,14 @@ ...@@ -53,14 +63,14 @@
//result(@"success"); //result(@"success");
} }
else if ([@"onPageStart" isEqualToString:call.method]){ else if ([@"onPageStart" isEqualToString:call.method]){
NSString* pageName = arguments[0]; NSString* pageName = call.arguments[@"pageName"];
[MobClick beginLogPageView:pageName]; [MobClick beginLogPageView:pageName];
//result(@"success"); result(@YES);
} }
else if ([@"onPageEnd" isEqualToString:call.method]){ else if ([@"onPageEnd" isEqualToString:call.method]){
NSString* pageName = arguments[0]; NSString* pageName = call.arguments[@"pageName"];
[MobClick endLogPageView:pageName]; [MobClick endLogPageView:pageName];
//result(@"success"); result(@YES);
} }
else if ([@"reportError" isEqualToString:call.method]){ else if ([@"reportError" isEqualToString:call.method]){
NSLog(@"reportError API not existed "); NSLog(@"reportError API not existed ");
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'umeng_common_sdk' s.name = 'umeng_common_sdk'
s.version = '0.0.1' s.version = '1.0.0'
s.summary = 'A new Flutter plugin.' s.summary = 'A new Flutter plugin.'
s.description = <<-DESC s.description = <<-DESC
A new Flutter plugin. A new Flutter plugin.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment