panhui 6 лет назад
Родитель
Сommit
8e4e1ea28a

+ 16 - 6
android/app/build.gradle

@@ -32,20 +32,30 @@ android {
     }
 
     defaultConfig {
-        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
         applicationId "com.izouma.mobilecybergames"
-        minSdkVersion 18
+        minSdkVersion 19
         targetSdkVersion 27
         versionCode flutterVersionCode.toInteger()
         versionName flutterVersionName
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+        ndk {
+            abiFilters 'armeabi-v7a'
+        }
+    }
+    signingConfigs {
+        release {
+            storeFile file('zouma.jks')
+            storePassword "zouma123"
+            keyAlias "zouma"
+            keyPassword "zouma123"
+        }
     }
-
     buildTypes {
         release {
-            // TODO: Add your own signing config for the release build.
-            // Signing with the debug keys for now, so `flutter run --release` works.
-            signingConfig signingConfigs.debug
+            signingConfig signingConfigs.release
+            minifyEnabled false
+            useProguard true
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
 }

+ 7 - 0
android/app/proguard-rules.pro

@@ -0,0 +1,7 @@
+#Flutter Wrapper
+-keep class io.flutter.app.** { *; }
+-keep class io.flutter.plugin.**  { *; }
+-keep class io.flutter.util.**  { *; }
+-keep class io.flutter.view.**  { *; }
+-keep class io.flutter.**  { *; }
+-keep class io.flutter.plugins.**  { *; }

+ 60 - 0
android/app/src/main/java/com/izouma/mobilecybergames/ScreenStreamPlugin.java

@@ -12,7 +12,10 @@ import android.widget.Toast;
 import com.alivc.live.pusher.AlivcAudioAACProfileEnum;
 import com.alivc.live.pusher.AlivcFpsEnum;
 import com.alivc.live.pusher.AlivcLivePushConfig;
+import com.alivc.live.pusher.AlivcLivePushError;
+import com.alivc.live.pusher.AlivcLivePushErrorListener;
 import com.alivc.live.pusher.AlivcLivePushInfoListener;
+import com.alivc.live.pusher.AlivcLivePushNetworkListener;
 import com.alivc.live.pusher.AlivcLivePusher;
 import com.alivc.live.pusher.AlivcPreviewOrientationEnum;
 import com.alivc.live.pusher.AlivcResolutionEnum;
@@ -182,6 +185,63 @@ public class ScreenStreamPlugin implements MethodChannel.MethodCallHandler, Plug
                 Log.d(TAG, "onAdjustFps");
             }
         });
+        mAlivcLivePusher.setLivePushErrorListener(new AlivcLivePushErrorListener() {
+            @Override
+            public void onSystemError(AlivcLivePusher alivcLivePusher, AlivcLivePushError alivcLivePushError) {
+                Log.d(TAG, "onSystemError\n" + alivcLivePushError.getMsg());
+            }
+
+            @Override
+            public void onSDKError(AlivcLivePusher alivcLivePusher, AlivcLivePushError alivcLivePushError) {
+                Log.d(TAG, "onSDKError\n" + alivcLivePushError.getMsg());
+            }
+        });
+        mAlivcLivePusher.setLivePushNetworkListener(new AlivcLivePushNetworkListener() {
+            @Override
+            public void onNetworkPoor(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onNetworkRecovery(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onReconnectStart(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onReconnectFail(AlivcLivePusher alivcLivePusher) {
+                Log.e(TAG, "onReconnectFail");
+            }
+
+            @Override
+            public void onReconnectSucceed(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onSendDataTimeout(AlivcLivePusher alivcLivePusher) {
+
+            }
+
+            @Override
+            public void onConnectFail(AlivcLivePusher alivcLivePusher) {
+                Log.e(TAG, "onConnectFail");
+            }
+
+            @Override
+            public String onPushURLAuthenticationOverdue(AlivcLivePusher alivcLivePusher) {
+                return null;
+            }
+
+            @Override
+            public void onSendMessage(AlivcLivePusher alivcLivePusher) {
+
+            }
+        });
 
         mAlivcLivePusher.startPreview(null);
         mAlivcLivePusher.startPush(url);

+ 12 - 5
android/app/src/main/res/drawable/launch_background.xml

@@ -1,8 +1,15 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Modify this file to customize your launch splash screen -->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:drawable="@android:color/white" />
-
+<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item>
+        <shape>
+            <solid android:color="#FF3A3D5C" />
+        </shape>
+    </item>
+    <item>
+        <bitmap
+            android:gravity="center"
+            android:src="@mipmap/logo" />
+    </item>
     <!-- You can insert your own image assets here -->
     <!-- <item>
         <bitmap

BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-hdpi/logo.png


BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-mdpi/logo.png


BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xhdpi/logo.png


BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xxhdpi/logo.png


BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


BIN
android/app/src/main/res/mipmap-xxxhdpi/logo.png


BIN
android/app/zouma.jks


+ 34 - 30
lib/main.dart

@@ -21,36 +21,37 @@ class MobileCyberGamesApp extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return StoreProvider(
-        store: this.store,
-        child: new MaterialApp(
-          title: '全民电竞',
-          supportedLocales: [
-            const Locale('en'), // English
-            const Locale('zh'), // China
-          ],
-          localizationsDelegates: [
-            GlobalMaterialLocalizations.delegate,
-            GlobalWidgetsLocalizations.delegate,
-            ChineseCupertinoLocalizations.delegate,
-          ],
-          theme: ThemeData(
-              cardColor: Color(0xFF2B2B42),
-              backgroundColor: Color(0xFF222335),
-              primaryColor: Color(0xFFC2524D),
-              buttonColor: Color(0xFFC2524D),
+      store: this.store,
+      child: new MaterialApp(
+        title: '全民电竞',
+        supportedLocales: [
+          const Locale('en'), // English
+          const Locale('zh'), // China
+        ],
+        localizationsDelegates: [
+          GlobalMaterialLocalizations.delegate,
+          GlobalWidgetsLocalizations.delegate,
+          ChineseCupertinoLocalizations.delegate,
+        ],
+        theme: ThemeData(
+            cardColor: Color(0xFF2B2B42),
+            backgroundColor: Color(0xFF222335),
+            primaryColor: Color(0xFFC2524D),
+            buttonColor: Color(0xFFC2524D),
 //              highlightColor: Color(0xFF933E3E),
-              accentColor: Color(0xFFC2524D),
-              textSelectionColor: Colors.white,
-              textTheme: TextTheme(
-                subhead: TextStyle(color: Colors.white),
-              ),
-              buttonTheme: ButtonThemeData(
-                buttonColor: Color(0xFFC2524D),
-                highlightColor: Color(0xFF9B4040),
-                splashColor: Color(0xFF9B4040),
-              )),
-          home: store.state.isLogin ? HomePage() : LoginFirst(),
-        ));
+            accentColor: Color(0xFFC2524D),
+            textSelectionColor: Colors.white,
+            textTheme: TextTheme(
+              subhead: TextStyle(color: Colors.white),
+            ),
+            buttonTheme: ButtonThemeData(
+              buttonColor: Color(0xFFC2524D),
+              highlightColor: Color(0xFF9B4040),
+              splashColor: Color(0xFF9B4040),
+            )),
+        home: store.state.isLogin ? HomePage() : LoginFirst(),
+      ),
+    );
   }
 }
 
@@ -60,17 +61,20 @@ void main() async {
   ));
   final prefs = await SharedPreferences.getInstance();
   print(prefs.getString('token'));
+<<<<<<< HEAD
   //测试token
   // HttpManager.token=prefs.getString('token')??"eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIyZDExNzgzOS1lZTQxLTRmZjItOGMyYi0zMzdiNmVhYWE3ODUiLCJpc3MiOiJhZG1pbiIsImlhdCI6MTU1MTMzNjAxNiwic3ViIjoiODQ3MDIiLCJleHAiOjE1NTE1OTUyMTZ9.VFvZRMpAvrPos5FwgkaofVemgb5rAXVuGTOSiHcNEKw";
   HttpManager.token = prefs.getString('token') ??
       "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI0NWY0OGY2NS1jODQxLTRjNDgtYmY0My1jYTAwYzlkZjk5OWQiLCJpc3MiOiJhZG1pbiIsImlhdCI6MTU1MTMxNzAzMCwic3ViIjoiODQ3MDIiLCJleHAiOjE1NTE1NzYyMzB9.ILhuOwvblQKqVxNaLk9CbYas6aoUQAlzlZrTk4VLqY8";
+=======
+  HttpManager.token = prefs.getString('token') ?? "";
+>>>>>>> 65218265d3d6138b9ff40fedea1d84f50cb8d8d9
   Result result = await HttpManager.get("userInfo/getUserInfo");
   AppState state = AppState.empty();
   if (result.success && result.data != null) {
     state.isLogin = true;
     UserInfo userInfo = UserInfo.fromJson(result.data);
     state.userInfo = userInfo;
-    prefs.setString("token", result.token);
   } else {
     state.isLogin = false;
   }

+ 0 - 1
lib/pages/HomePage.dart

@@ -13,7 +13,6 @@ import '../styles/totast.dart';
 import '../net/HttpManager.dart';
 import '../net/Result.dart';
 import 'TipList.dart';
-import '../plugins/ScreenStramPlugin.dart';
 import '../model/UserInfo.dart';
 import '../redux/AppState.dart';
 

+ 1 - 1
lib/pages/TipInfo.dart

@@ -50,7 +50,7 @@ class TipInfoState extends State<TipInfo> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     Future.delayed(Duration(milliseconds: 100), () => getInfo());
   }

+ 2 - 2
lib/pages/TipList.dart

@@ -50,7 +50,7 @@ class TipListState extends State<TipList> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     _mControll = new ScrollController();
 
@@ -68,7 +68,7 @@ class TipListState extends State<TipList> {
 
   @override
   void dispose() {
-    // TODO: implement dispose
+    
     super.dispose();
     _mControll.dispose();
   }

+ 1 - 14
lib/pages/changeUserInfo.dart

@@ -131,22 +131,9 @@ class ChangeUserInfoState extends State<ChangeUserInfo> {
                   )),
               onWillPop: () {
                 Toast.hide();
-                Navigator.pop(context);
+                Navigator.pop(context, false);
                 return Future.value(false);
               });
         });
   }
-
-  // void getUserInfo() async {
-  //   final response = await Dio().get(domain + 'userInfo/getUserInfo',
-  //       options: Options(headers: {
-  //         "token": StoreProvider.of<CountState>(context).state.usetoken
-  //       }));
-  //   final res = json.decode(response.toString());
-  //   if (res['success']) {
-  //     StoreProvider.of<CountState>(context)
-  //         .dispatch({"action": Actions.updateUser, "val": res['data']});
-  //     Navigator.pop(context);
-  //   }
-  // }
 }

+ 4 - 11
lib/pages/loginSecond.dart

@@ -29,7 +29,6 @@ class LoginSecondState extends State<LoginSecond> {
   void initState() {
     super.initState();
     Future.delayed(Duration(milliseconds: 100), () {
-      print('发送');
       sendMsg();
     });
   }
@@ -122,17 +121,13 @@ class LoginSecondState extends State<LoginSecond> {
                                     } else if (inputCode.length != 6) {
                                       Toast.show(context, '请输入验证码', 1500, 'info');
                                     } else {
-                                      print(_sessionID);
-                                      print(inputCode);
                                       Toast.show(context, '加载中', -1, 'loading');
-                                      Toast.hide();
                                       final Result res = await HttpManager.post('auth/loginSms',
                                           data: {"phone": widget.phone, "code": inputCode, "sessionId": _sessionID, "requireToken": true});
                                       Toast.hide();
                                       if (res.success) {
-                                        print(res);
                                         final prefs = await SharedPreferences.getInstance();
-                                        prefs.setString('token', res.token);
+                                        await prefs.setString('token', res.token);
                                         print(prefs.getString('token'));
                                         HttpManager.token = res.token;
                                         StoreProvider.of<AppState>(context).dispatch({"action": Actions.updateAll, "user": res.data});
@@ -159,17 +154,13 @@ class LoginSecondState extends State<LoginSecond> {
         ),
         onWillPop: () {
           Toast.hide();
-          print("返回键点击了");
           Navigator.pop(context);
           return Future.value(false);
         });
   }
 
   void sendMsg() async {
-    print('发送验证码');
-
     Toast.show(context, '加载中', -1, 'loading');
-
     final Result res = await HttpManager.get('rong/sendCode', data: {"phone": widget.phone});
     Toast.hide();
     if (res.success) {
@@ -191,7 +182,9 @@ class LoginSecondState extends State<LoginSecond> {
         isSend = false;
       });
     } else {
-      sendTime = sendTime - 1;
+      setState(() {
+        sendTime = sendTime - 1;
+      });
       Future.delayed(Duration(milliseconds: 1000), () {
         getTime();
       });

+ 1 - 3
lib/pages/recharge.dart

@@ -48,7 +48,6 @@ class RechrageState extends State<Rechrage> {
 
   Future<Null> _focusNodeListener() async {
     if (_focusNode.hasFocus) {
-      print('获取焦点');
       setState(() {
         if (!autoChoose) {
           autoChoose = true;
@@ -57,7 +56,6 @@ class RechrageState extends State<Rechrage> {
         isInput = true;
       });
     } else {
-      print('失去焦点');
       setState(() {
         isInput = false;
       });
@@ -67,7 +65,7 @@ class RechrageState extends State<Rechrage> {
   @override
   Widget build(BuildContext context) {
     ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
-    // TODO: implement build
+    
     return new Scaffold(
         appBar: AppBar(
           backgroundColor: PRIMARY_COLOR,

+ 4 - 4
lib/pages/roomInfo.dart

@@ -258,7 +258,7 @@ class RoomInfoState extends State<RoomInfo>
     if (houseInfo != null) {
       status = houseInfo.statusFlag;
     }
-    // TODO: implement build
+    
     return new WillPopScope(
       child: Scaffold(
         appBar: AppBar(
@@ -628,7 +628,7 @@ class RankContentState extends State<RankContent> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     getTopList();
   }
@@ -783,7 +783,7 @@ class SecondPageState extends State<SecondPage> {
 
   @override
   void initState() {
-    // TODO: implement initState
+    
     super.initState();
     _perController = ScrollController();
     currentPage = 1;
@@ -801,7 +801,7 @@ class SecondPageState extends State<SecondPage> {
 
   @override
   void dispose() {
-    // TODO: implement dispose
+    
     super.dispose();
     _perController.dispose();
   }

+ 1 - 1
lib/pages/roomList.dart

@@ -94,7 +94,7 @@ class RoomListState extends State<RoomList> {
   Widget build(BuildContext context) {
     ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
 
-    // TODO: implement build
+    
     return new Scaffold(
         appBar: AppBar(
           backgroundColor: PRIMARY_COLOR,

+ 0 - 3
lib/widget/ITextInput.dart

@@ -99,17 +99,14 @@ class _ITextFieldState extends State<ITextField> {
 
   @override
   void initState() {
-    // TODO: implement initState
     super.initState();
     _inputText = widget.inputText != null ? widget.inputText : '';
     _focusNode.addListener(() {
       if (!_focusNode.hasFocus) {
-        print('失去焦点');
         setState(() {
           _hasdeleteIcon = false;
         });
       } else {
-        print('获取焦点');
         setState(() {
           _hasdeleteIcon = (_inputText.isNotEmpty);
         });