mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-18 05:15:56 +08:00
推送,ios/android,test
This commit is contained in:
@ -51,8 +51,23 @@ android {
|
|||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
manifestPlaceholders = [
|
||||||
|
JPUSH_PKGNAME : "com.alibaba.fluttergo",
|
||||||
|
JPUSH_APPKEY : "62eb07d227d1f11dd7fa6239", //JPush上注册的包名对应的appkey.
|
||||||
|
JPUSH_CHANNEL : "developer-default",
|
||||||
|
]
|
||||||
|
|
||||||
|
// ndk {
|
||||||
|
// //选择要添加的对应cpu类型的.so库。
|
||||||
|
// abiFilters 'armeabi', 'armeabi-v7a','x86', 'x86_64', 'mips'//, 'arm64-v8a'
|
||||||
|
// // 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
release {
|
release {
|
||||||
keyAlias keystoreProperties['keyAlias']
|
keyAlias keystoreProperties['keyAlias']
|
||||||
@ -86,6 +101,8 @@ dependencies {
|
|||||||
///implementation 'com.google.firebase:firebase-perf:16.2.3'
|
///implementation 'com.google.firebase:firebase-perf:16.2.3'
|
||||||
// 登陆
|
// 登陆
|
||||||
////implementation 'com.google.firebase:firebase-auth:16.0.3'
|
////implementation 'com.google.firebase:firebase-auth:16.0.3'
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//firebase
|
//firebase
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
0828E494220692B500A59437 /* iPhone XR Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone XR Landscape.png"; sourceTree = "<group>"; };
|
0828E494220692B500A59437 /* iPhone XR Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone XR Landscape.png"; sourceTree = "<group>"; };
|
||||||
0828E4A42206936100A59437 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
0828E4A42206936100A59437 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||||
084A20872202E4FD00428FF5 /* flutter go.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flutter go.png"; sourceTree = "<group>"; };
|
084A20872202E4FD00428FF5 /* flutter go.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "flutter go.png"; sourceTree = "<group>"; };
|
||||||
|
10D9E78922B7651B003C2C98 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
@ -184,6 +185,7 @@
|
|||||||
97C146F01CF9000F007C117D /* Runner */ = {
|
97C146F01CF9000F007C117D /* Runner */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
10D9E78922B7651B003C2C98 /* Runner.entitlements */,
|
||||||
94722E5B22511D3600F63900 /* GoogleService-Info.plist */,
|
94722E5B22511D3600F63900 /* GoogleService-Info.plist */,
|
||||||
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
|
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
|
||||||
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
|
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
|
||||||
@ -246,6 +248,11 @@
|
|||||||
CreatedOnToolsVersion = 7.3.1;
|
CreatedOnToolsVersion = 7.3.1;
|
||||||
DevelopmentTeam = 4WLT68XRNA;
|
DevelopmentTeam = 4WLT68XRNA;
|
||||||
ProvisioningStyle = Manual;
|
ProvisioningStyle = Manual;
|
||||||
|
SystemCapabilities = {
|
||||||
|
com.apple.Push = {
|
||||||
|
enabled = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -530,7 +537,8 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2;
|
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
DEVELOPMENT_TEAM = 4WLT68XRNA;
|
DEVELOPMENT_TEAM = 4WLT68XRNA;
|
||||||
@ -547,7 +555,7 @@
|
|||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.alibaba.fluttergo;
|
PRODUCT_BUNDLE_IDENTIFIER = com.alibaba.fluttergo;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = FlutterGO_alibaba_distribution_app_store;
|
PROVISIONING_PROFILE_SPECIFIER = "FlutterGO-alibaba-develop";
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@ -558,6 +566,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2;
|
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -1,5 +1,6 @@
|
|||||||
#include "AppDelegate.h"
|
#include "AppDelegate.h"
|
||||||
#include "GeneratedPluginRegistrant.h"
|
#include "GeneratedPluginRegistrant.h"
|
||||||
|
#include "FlutterJPushPlugin.h"
|
||||||
|
|
||||||
@import Firebase;//增加 firebase 支持
|
@import Firebase;//增加 firebase 支持
|
||||||
|
|
||||||
@ -10,6 +11,8 @@
|
|||||||
|
|
||||||
[FIRApp configure];//增加 firebase 支持
|
[FIRApp configure];//增加 firebase 支持
|
||||||
|
|
||||||
|
[self startupJPush:launchOptions appKey:@"62eb07d227d1f11dd7fa6239" channel:@"jpush" isProduction:FALSE];
|
||||||
|
|
||||||
[GeneratedPluginRegistrant registerWithRegistry:self];
|
[GeneratedPluginRegistrant registerWithRegistry:self];
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
[NSThread sleepForTimeInterval:2];
|
[NSThread sleepForTimeInterval:2];
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
|
<key>LSApplicationCategoryType</key>
|
||||||
|
<string></string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
|
8
ios/Runner/Runner.entitlements
Normal file
8
ios/Runner/Runner.entitlements
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@ -12,6 +12,7 @@ import 'package:flutter_go/utils/analytics.dart' as Analytics;
|
|||||||
import 'package:flutter_go/views/login_page/login_page.dart';
|
import 'package:flutter_go/views/login_page/login_page.dart';
|
||||||
import 'package:flutter_go/utils/data_utils.dart';
|
import 'package:flutter_go/utils/data_utils.dart';
|
||||||
import 'package:flutter_go/model/user_info.dart';
|
import 'package:flutter_go/model/user_info.dart';
|
||||||
|
import 'package:flutter_jpush/flutter_jpush.dart';
|
||||||
|
|
||||||
//import 'views/welcome_page/index.dart';
|
//import 'views/welcome_page/index.dart';
|
||||||
|
|
||||||
@ -36,10 +37,61 @@ class _MyAppState extends State<MyApp> {
|
|||||||
bool _hasLogin = false;
|
bool _hasLogin = false;
|
||||||
bool _isLoading = true;
|
bool _isLoading = true;
|
||||||
UserInformation _userInfo;
|
UserInformation _userInfo;
|
||||||
|
bool isConnected = false;
|
||||||
|
String registrationId;
|
||||||
|
List notificationList = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_startupJpush();
|
||||||
|
|
||||||
|
FlutterJPush.addConnectionChangeListener((bool connected) {
|
||||||
|
setState(() {
|
||||||
|
/// 是否连接,连接了才可以推送
|
||||||
|
print("连接状态改变:$connected");
|
||||||
|
this.isConnected = connected;
|
||||||
|
if (connected) {
|
||||||
|
//在启动的时候会去连接自己的服务器,连接并注册成功之后会返回一个唯一的设备号
|
||||||
|
FlutterJPush.getRegistrationID().then((String regId) {
|
||||||
|
print("主动获取设备号:$regId");
|
||||||
|
setState(() {
|
||||||
|
this.registrationId = regId;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
FlutterJPush
|
||||||
|
.addReceiveNotificationListener((JPushNotification notification) {
|
||||||
|
setState(() {
|
||||||
|
/// 收到推送
|
||||||
|
print("收到推送提醒: $notification");
|
||||||
|
notificationList.add(notification);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
FlutterJPush
|
||||||
|
.addReceiveOpenNotificationListener((JPushNotification notification) {
|
||||||
|
setState(() {
|
||||||
|
print("打开了推送提醒: $notification");
|
||||||
|
|
||||||
|
/// 打开了推送提醒
|
||||||
|
notificationList.add(notification);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
FlutterJPush.addReceiveCustomMsgListener((JPushMessage msg) {
|
||||||
|
setState(() {
|
||||||
|
print("收到推送消息提醒: $msg");
|
||||||
|
|
||||||
|
/// 打开了推送提醒
|
||||||
|
notificationList.add(msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
DataUtils.checkLogin().then((hasLogin) {
|
DataUtils.checkLogin().then((hasLogin) {
|
||||||
if (hasLogin.runtimeType == UserInformation) {
|
if (hasLogin.runtimeType == UserInformation) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -105,6 +157,15 @@ class _MyAppState extends State<MyApp> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void _startupJpush() async {
|
||||||
|
print("初始化jpush");
|
||||||
|
await FlutterJPush.startup();
|
||||||
|
print("初始化jpush成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
final provider = new Provider();
|
final provider = new Provider();
|
||||||
await provider.init(true);
|
await provider.init(true);
|
||||||
|
@ -125,6 +125,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.7"
|
version: "1.1.7"
|
||||||
|
flutter_jpush:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_jpush
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.4"
|
||||||
flutter_markdown:
|
flutter_markdown:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@ -213,7 +220,7 @@ packages:
|
|||||||
name: open_file
|
name: open_file
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.3"
|
||||||
package_info:
|
package_info:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -47,6 +47,7 @@ dependencies:
|
|||||||
permission_handler: ^3.0.0
|
permission_handler: ^3.0.0
|
||||||
open_file: ^2.0.1+2
|
open_file: ^2.0.1+2
|
||||||
package_info: ^0.4.0+3
|
package_info: ^0.4.0+3
|
||||||
|
flutter_jpush: ^0.0.4
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Reference in New Issue
Block a user