Commit 46f3e142432bc74f804b9bcd487a3d69117aa63f

Authored by gaiyaguang
1 parent b1337589

安卓打包,去除fake_push

@@ -41,7 +41,7 @@ android { @@ -41,7 +41,7 @@ android {
41 defaultConfig { 41 defaultConfig {
42 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 42 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
43 applicationId "com.naji.one_key" 43 applicationId "com.naji.one_key"
44 - minSdkVersion 17 44 + minSdkVersion 21
45 targetSdkVersion 28 45 targetSdkVersion 28
46 versionCode flutterVersionCode.toInteger() 46 versionCode flutterVersionCode.toInteger()
47 versionName flutterVersionName 47 versionName flutterVersionName
1 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 1 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
2 package="com.naji.one_key"> 3 package="com.naji.one_key">
3 <!-- io.flutter.app.FlutterApplication is an android.app.Application that 4 <!-- io.flutter.app.FlutterApplication is an android.app.Application that
4 calls FlutterMain.startInitialization(this); in its onCreate method. 5 calls FlutterMain.startInitialization(this); in its onCreate method.
@@ -8,6 +9,7 @@ @@ -8,6 +9,7 @@
8 <application 9 <application
9 android:name="io.flutter.app.FlutterApplication" 10 android:name="io.flutter.app.FlutterApplication"
10 android:label="一键订" 11 android:label="一键订"
  12 + tools:replace="android:label"
11 android:icon="@mipmap/ic_launcher"> 13 android:icon="@mipmap/ic_launcher">
12 <activity 14 <activity
13 android:name=".MainActivity" 15 android:name=".MainActivity"
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:convert'; 2 import 'dart:convert';
3 3
4 -import 'package:fake_push/fake_push.dart' as fake; 4 +//import 'package:fake_push/fake_push.dart' as fake;
5 import 'package:flutter/cupertino.dart'; 5 import 'package:flutter/cupertino.dart';
6 import 'package:flutter/material.dart'; 6 import 'package:flutter/material.dart';
7 import 'package:flutter_screenutil/flutter_screenutil.dart'; 7 import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -39,12 +39,12 @@ class HomePage extends StatefulWidget{ @@ -39,12 +39,12 @@ class HomePage extends StatefulWidget{
39 class HomePageState extends State<HomePage>{ 39 class HomePageState extends State<HomePage>{
40 40
41 // 信鸽推送 41 // 信鸽推送
42 - fake.Push _push = fake.Push();  
43 - StreamSubscription<String> _receiveDeviceToken;  
44 - StreamSubscription<fake.Message> _receiveMessage;  
45 - StreamSubscription<fake.Message> _receiveNotification;  
46 - StreamSubscription<String> _launchNotification;  
47 - StreamSubscription<String> _resumeNotification; 42 +// fake.Push _push = fake.Push();
  43 +// StreamSubscription<String> _receiveDeviceToken;
  44 +// StreamSubscription<fake.Message> _receiveMessage;
  45 +// StreamSubscription<fake.Message> _receiveNotification;
  46 +// StreamSubscription<String> _launchNotification;
  47 +// StreamSubscription<String> _resumeNotification;
48 48
49 // 极光推送 49 // 极光推送
50 final JPush jpush = new JPush(); 50 final JPush jpush = new JPush();
@@ -124,53 +124,53 @@ class HomePageState extends State<HomePage>{ @@ -124,53 +124,53 @@ class HomePageState extends State<HomePage>{
124 124
125 //初始化信鸽推送 125 //初始化信鸽推送
126 void initXinge(){ 126 void initXinge(){
127 - _receiveDeviceToken =  
128 - _push.receiveDeviceToken().listen(_handleReceiveDeviceToken);  
129 - _receiveMessage = _push.receiveMessage().listen(_handleReceiveMessage);  
130 - _receiveNotification =  
131 - _push.receiveNotification().listen(_handleReceiveNotification);  
132 - _launchNotification =  
133 - _push.launchNotification().listen(_handleLaunchNotification);  
134 - _resumeNotification =  
135 - _push.resumeNotification().listen(_handleResumeNotification);  
136 -  
137 - _push.startWork(enableDebug: !_isReleaseMode());  
138 -  
139 - // 第二次打开应用再调用  
140 - SharedPreferences.getInstance().then((SharedPreferences sharedPref) {  
141 - if (sharedPref.getBool('firstStart') ?? true) {  
142 - sharedPref.setBool('firstStart', false);  
143 - } else {  
144 - _push.areNotificationsEnabled().then((bool isEnabled) {  
145 - if (!isEnabled) {  
146 - showCupertinoDialog(  
147 - context: context,  
148 - builder: (BuildContext context) {  
149 - return CupertinoAlertDialog(  
150 - title: const Text('提示'),  
151 - content: const Text('开启通知权限可收到更多优质内容'),  
152 - actions: <Widget>[  
153 - CupertinoDialogAction(  
154 - child: const Text('取消'),  
155 - onPressed: () {  
156 - Navigator.of(context).pop();  
157 - },  
158 - ),  
159 - CupertinoDialogAction(  
160 - child: const Text('设置'),  
161 - onPressed: () {  
162 - _push.openNotificationsSettings();  
163 - Navigator.of(context).pop();  
164 - },  
165 - ),  
166 - ],  
167 - );  
168 - },  
169 - );  
170 - }  
171 - });  
172 - }  
173 - }); 127 +// _receiveDeviceToken =
  128 +// _push.receiveDeviceToken().listen(_handleReceiveDeviceToken);
  129 +// _receiveMessage = _push.receiveMessage().listen(_handleReceiveMessage);
  130 +// _receiveNotification =
  131 +// _push.receiveNotification().listen(_handleReceiveNotification);
  132 +// _launchNotification =
  133 +// _push.launchNotification().listen(_handleLaunchNotification);
  134 +// _resumeNotification =
  135 +// _push.resumeNotification().listen(_handleResumeNotification);
  136 +//
  137 +// _push.startWork(enableDebug: !_isReleaseMode());
  138 +//
  139 +// // 第二次打开应用再调用
  140 +// SharedPreferences.getInstance().then((SharedPreferences sharedPref) {
  141 +// if (sharedPref.getBool('firstStart') ?? true) {
  142 +// sharedPref.setBool('firstStart', false);
  143 +// } else {
  144 +// _push.areNotificationsEnabled().then((bool isEnabled) {
  145 +// if (!isEnabled) {
  146 +// showCupertinoDialog(
  147 +// context: context,
  148 +// builder: (BuildContext context) {
  149 +// return CupertinoAlertDialog(
  150 +// title: const Text('提示'),
  151 +// content: const Text('开启通知权限可收到更多优质内容'),
  152 +// actions: <Widget>[
  153 +// CupertinoDialogAction(
  154 +// child: const Text('取消'),
  155 +// onPressed: () {
  156 +// Navigator.of(context).pop();
  157 +// },
  158 +// ),
  159 +// CupertinoDialogAction(
  160 +// child: const Text('设置'),
  161 +// onPressed: () {
  162 +// _push.openNotificationsSettings();
  163 +// Navigator.of(context).pop();
  164 +// },
  165 +// ),
  166 +// ],
  167 +// );
  168 +// },
  169 +// );
  170 +// }
  171 +// });
  172 +// }
  173 +// });
174 } 174 }
175 175
176 bool _isReleaseMode() { 176 bool _isReleaseMode() {
@@ -178,31 +178,31 @@ class HomePageState extends State<HomePage>{ @@ -178,31 +178,31 @@ class HomePageState extends State<HomePage>{
178 } 178 }
179 179
180 void _handleReceiveDeviceToken(String deviceToken) async { 180 void _handleReceiveDeviceToken(String deviceToken) async {
181 - String token=await _push.getDeviceToken();  
182 - print('receiveDeviceToken: $deviceToken - $token');  
183 - userTokenInit2(token);  
184 - }  
185 -  
186 - void _handleReceiveMessage(fake.Message message) {  
187 - print(  
188 - 'receiveMessage: ${message.title} - ${message.content} - ${message.customContent}'); 181 +// String token=await _push.getDeviceToken();
  182 +// print('receiveDeviceToken: $deviceToken - $token');
  183 +// userTokenInit2(token);
189 } 184 }
190 185
191 - void _handleReceiveNotification(fake.Message notification) {  
192 - print(  
193 - 'receiveNotification: ${notification.title} - ${notification.content} - ${notification.customContent}');  
194 -  
195 - }  
196 -  
197 - void _handleLaunchNotification(String customContent) {  
198 - print('launchNotification: $customContent');  
199 -  
200 - }  
201 -  
202 - void _handleResumeNotification(String customContent) {  
203 - print('resumeNotification: $customContent');  
204 -  
205 - } 186 +// void _handleReceiveMessage(fake.Message message) {
  187 +// print(
  188 +// 'receiveMessage: ${message.title} - ${message.content} - ${message.customContent}');
  189 +// }
  190 +//
  191 +// void _handleReceiveNotification(fake.Message notification) {
  192 +// print(
  193 +// 'receiveNotification: ${notification.title} - ${notification.content} - ${notification.customContent}');
  194 +//
  195 +// }
  196 +//
  197 +// void _handleLaunchNotification(String customContent) {
  198 +// print('launchNotification: $customContent');
  199 +//
  200 +// }
  201 +//
  202 +// void _handleResumeNotification(String customContent) {
  203 +// print('resumeNotification: $customContent');
  204 +//
  205 +// }
206 206
207 //初始化推送token 207 //初始化推送token
208 userTokenInit(String registrationId){ 208 userTokenInit(String registrationId){
@@ -326,21 +326,21 @@ class HomePageState extends State<HomePage>{ @@ -326,21 +326,21 @@ class HomePageState extends State<HomePage>{
326 @override 326 @override
327 void dispose() { 327 void dispose() {
328 // TODO: implement dispose 328 // TODO: implement dispose
329 - if (_receiveDeviceToken != null) {  
330 - _receiveDeviceToken.cancel();  
331 - }  
332 - if (_receiveMessage != null) {  
333 - _receiveMessage.cancel();  
334 - }  
335 - if (_receiveNotification != null) {  
336 - _receiveNotification.cancel();  
337 - }  
338 - if (_launchNotification != null) {  
339 - _launchNotification.cancel();  
340 - }  
341 - if (_resumeNotification != null) {  
342 - _resumeNotification.cancel();  
343 - } 329 +// if (_receiveDeviceToken != null) {
  330 +// _receiveDeviceToken.cancel();
  331 +// }
  332 +// if (_receiveMessage != null) {
  333 +// _receiveMessage.cancel();
  334 +// }
  335 +// if (_receiveNotification != null) {
  336 +// _receiveNotification.cancel();
  337 +// }
  338 +// if (_launchNotification != null) {
  339 +// _launchNotification.cancel();
  340 +// }
  341 +// if (_resumeNotification != null) {
  342 +// _resumeNotification.cancel();
  343 +// }
344 super.dispose(); 344 super.dispose();
345 LogUtil.v("home_dispose"); 345 LogUtil.v("home_dispose");
346 } 346 }
@@ -218,13 +218,6 @@ packages: @@ -218,13 +218,6 @@ packages:
218 url: "https://pub.flutter-io.cn" 218 url: "https://pub.flutter-io.cn"
219 source: hosted 219 source: hosted
220 version: "0.2.0" 220 version: "0.2.0"
221 - fake_push:  
222 - dependency: "direct main"  
223 - description:  
224 - name: fake_push  
225 - url: "https://pub.flutter-io.cn"  
226 - source: hosted  
227 - version: "0.5.4"  
228 fixnum: 221 fixnum:
229 dependency: transitive 222 dependency: transitive
230 description: 223 description:
@@ -387,13 +380,6 @@ packages: @@ -387,13 +380,6 @@ packages:
387 url: "https://pub.flutter-io.cn" 380 url: "https://pub.flutter-io.cn"
388 source: hosted 381 source: hosted
389 version: "0.3.3" 382 version: "0.3.3"
390 - jaguar_serializer:  
391 - dependency: transitive  
392 - description:  
393 - name: jaguar_serializer  
394 - url: "https://pub.flutter-io.cn"  
395 - source: hosted  
396 - version: "2.2.12"  
397 jpush_flutter: 383 jpush_flutter:
398 dependency: "direct main" 384 dependency: "direct main"
399 description: 385 description:
@@ -72,7 +72,7 @@ dependencies: @@ -72,7 +72,7 @@ dependencies:
72 # 网络状态 72 # 网络状态
73 connectivity: ^0.4.8 73 connectivity: ^0.4.8
74 # 信鸽推送 74 # 信鸽推送
75 - fake_push: ^0.5.4 75 +# fake_push: ^0.5.4
76 76
77 dev_dependencies: 77 dev_dependencies:
78 flutter_test: 78 flutter_test: