Skip to content

Commit ee303ed

Browse files
committed
.
1 parent c53f5ba commit ee303ed

File tree

20 files changed

+226
-116
lines changed

20 files changed

+226
-116
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ app.*.map.json
4444
/android/app/debug
4545
/android/app/profile
4646
/android/app/release
47+
48+
/release/

android/app/build.gradle

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,80 @@ android {
4949
versionName flutterVersionName
5050
multiDexEnabled true
5151

52-
// ndk {
53-
// abiFilters 'armeabi', 'armeabi-v7a', 'x86'//, 'x86_64', 'mips', 'mips64', 'arm64-v8a',
54-
// }
55-
5652
manifestPlaceholders = [
5753
JPUSH_PKGNAME: applicationId,
5854
JPUSH_APPKEY : 'a8e4d99ac7f968133d73ff19',
5955
JPUSH_CHANNEL: "developer-default",
6056
]
6157
}
6258

59+
// signingConfigs {
60+
// config {
61+
// keyAlias keystoreProperties["keyAlias"]
62+
// keyPassword keystoreProperties["keyPassword"]
63+
// storeFile file(keystoreProperties["storeFile"])
64+
// storePassword keystoreProperties["storePassword"]
65+
// }
66+
// }
67+
6368
buildTypes {
69+
debug {
70+
minifyEnabled false
71+
shrinkResources false
72+
// signingConfig signingConfigs.config
73+
}
74+
profile {
75+
minifyEnabled false
76+
shrinkResources false
77+
// signingConfig signingConfigs.config
78+
}
6479
release {
65-
// TODO: Add your own signing config for the release build.
66-
// Signing with the debug keys for now, so `flutter run --release` works.
6780
signingConfig signingConfigs.debug
81+
82+
ndk {
83+
abiFilters "armeabi-v7a", "arm64-v8a"
84+
// 'armeabi', 'armeabi-v7a', 'x86'//, 'x86_64', 'mips', 'mips64', 'arm64-v8a',
85+
}
86+
}
87+
}
88+
89+
tasks.whenTaskAdded { task ->
90+
if (task.name == "assembleRelease") {
91+
task.finalizedBy copyRelease
6892
}
6993
}
7094
}
7195

96+
task copyRelease {
97+
doLast {
98+
def fromFile = "../../build/app/outputs/apk/release/app-release.apk"
99+
def intoFile = "../../release/"
100+
def sourceFile = file(fromFile)
101+
def destinationPath = file(intoFile)
102+
def time = buildTime()
103+
def destinationFileName = "clicli_v${flutterVersionName}+${flutterVersionCode}_${time}.apk"
104+
105+
106+
if (!sourceFile.exists()) {
107+
throw new GradleException("Source file does not exist.")
108+
} else {
109+
if (!destinationPath.exists()) {
110+
destinationPath.mkdir()
111+
}
112+
copy {
113+
from fromFile
114+
into intoFile
115+
rename { destinationFileName }
116+
}
117+
}
118+
println("\nRelease file copied to ${destinationPath}/${destinationFileName} .")
119+
}
120+
}
121+
122+
def static buildTime() {
123+
return new Date().format("MMdd-HHmmss")
124+
}
125+
72126
flutter {
73127
source '../..'
74128
}

ios/Podfile.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ PODS:
1919
- HLSCachingReverseProxyServer (0.1.0):
2020
- GCDWebServer (~> 3.5)
2121
- PINCache (>= 3.0.1-beta.3)
22+
- JCore (2.7.1)
23+
- JPush (3.7.0):
24+
- JCore (< 3.0.0, >= 2.0.0)
25+
- jpush_flutter (0.0.2):
26+
- Flutter
27+
- JCore (= 2.7.1)
28+
- JPush (= 3.7.0)
2229
- package_info (0.0.1):
2330
- Flutter
2431
- path_provider_ios (0.0.1):
@@ -49,6 +56,7 @@ DEPENDENCIES:
4956
- Flutter (from `Flutter`)
5057
- flutter_downloader (from `.symlinks/plugins/flutter_downloader/ios`)
5158
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
59+
- jpush_flutter (from `.symlinks/plugins/jpush_flutter/ios`)
5260
- package_info (from `.symlinks/plugins/package_info/ios`)
5361
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
5462
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
@@ -63,6 +71,8 @@ SPEC REPOS:
6371
- FMDB
6472
- GCDWebServer
6573
- HLSCachingReverseProxyServer
74+
- JCore
75+
- JPush
6676
- PINCache
6777
- PINOperation
6878
- Toast
@@ -76,6 +86,8 @@ EXTERNAL SOURCES:
7686
:path: ".symlinks/plugins/flutter_downloader/ios"
7787
fluttertoast:
7888
:path: ".symlinks/plugins/fluttertoast/ios"
89+
jpush_flutter:
90+
:path: ".symlinks/plugins/jpush_flutter/ios"
7991
package_info:
8092
:path: ".symlinks/plugins/package_info/ios"
8193
path_provider_ios:
@@ -100,6 +112,9 @@ SPEC CHECKSUMS:
100112
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
101113
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
102114
HLSCachingReverseProxyServer: 59935e1e0244ad7f3375d75b5ef46e8eb26ab181
115+
JCore: 9d5bda3a172c65bbe14f2806ab0f6246f8a06065
116+
JPush: 1fd7a326e7e6588eba517659ce1b79a144e54938
117+
jpush_flutter: d5fd523a73277ed66d453fc7ac1c981d1fa525e2
103118
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
104119
path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5
105120
PINCache: 7a8fc1a691173d21dbddbf86cd515de6efa55086

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
/* Begin PBXFileReference section */
3434
0694F1A2275F37A900D1F45D /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
35+
06AD73D1276834D8002EADD2 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
3536
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
3637
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3738
363C923035B61A09D9DDE57C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
@@ -106,6 +107,7 @@
106107
97C146F01CF9000F007C117D /* Runner */ = {
107108
isa = PBXGroup;
108109
children = (
110+
06AD73D1276834D8002EADD2 /* Runner.entitlements */,
109111
97C146FA1CF9000F007C117D /* Main.storyboard */,
110112
97C146FD1CF9000F007C117D /* Assets.xcassets */,
111113
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -359,6 +361,7 @@
359361
buildSettings = {
360362
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
361363
CLANG_ENABLE_MODULES = YES;
364+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
362365
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
363366
DEVELOPMENT_TEAM = "";
364367
ENABLE_BITCODE = NO;
@@ -490,6 +493,7 @@
490493
buildSettings = {
491494
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
492495
CLANG_ENABLE_MODULES = YES;
496+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
493497
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
494498
DEVELOPMENT_TEAM = "";
495499
ENABLE_BITCODE = NO;
@@ -513,6 +517,7 @@
513517
buildSettings = {
514518
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
515519
CLANG_ENABLE_MODULES = YES;
520+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
516521
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
517522
DEVELOPMENT_TEAM = "";
518523
ENABLE_BITCODE = NO;

ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1320"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ios/Runner/Runner.entitlements

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
8+
</plist>

lib/api/post.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import 'package:clicli_dark/utils/dio_utils.dart';
22
import 'package:flutter/cupertino.dart';
33

4-
const host =
5-
!bool.fromEnvironment("dart.vm.product") ? 'http://localhost:8080' : '';
4+
const host = !bool.fromEnvironment("dart.vm.product")
5+
? 'http://localhost:8080'
6+
: 'http://64.227.101.251:8080';
67

78
getPost(
89
type,

lib/instance.dart

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
// import 'package:clicli_dark/config.dart';
1+
import 'package:clicli_dark/config.dart';
22
import 'package:event_bus/event_bus.dart';
33
import 'package:flutter/material.dart';
4-
// import 'package:jpush_flutter/jpush_flutter.dart';
4+
import 'package:jpush_flutter/jpush_flutter.dart';
55
import 'package:package_info/package_info.dart';
66
import 'package:shared_preferences/shared_preferences.dart';
77

88
class Instances {
9-
static final homeStackscaffoldKey = GlobalKey<ScaffoldState>();
10-
11-
static ScaffoldState? get scaffoldState =>
12-
Instances.homeStackscaffoldKey.currentState;
13-
149
static final navigatorKey = GlobalKey<NavigatorState>();
1510

16-
static NavigatorState? get navigatorState =>
17-
Instances.navigatorKey.currentState;
11+
static NavigatorState get navigatorState =>
12+
Instances.navigatorKey.currentState!;
1813

19-
static BuildContext get currentContext => navigatorState!.overlay!.context;
14+
static BuildContext get currentContext => navigatorState.overlay!.context;
2015

21-
static ThemeData get currentTheme => Theme.of(navigatorState!.context);
16+
static ThemeData get currentTheme => Theme.of(navigatorState.context);
2217

2318
static Color get currentThemeColor => currentTheme.primaryColor;
2419

2520
static late SharedPreferences sp;
2621

2722
static EventBus eventBus = EventBus();
2823

29-
// static JPush jp = JPush();
24+
static late JPush jp;
3025

3126
static String appVersion = '';
3227

3328
static init() async {
34-
// jp.setup(appKey: Config.jpushKey, channel: 'developer-default');
29+
if (!Config.isDev) {
30+
jp = JPush();
31+
jp.setup(appKey: Config.jpushKey, channel: 'developer-default');
32+
}
3533
sp = await SharedPreferences.getInstance();
3634
await PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
3735
final String v = packageInfo.version;

lib/main.dart

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'package:clicli_dark/pages/player_page.dart';
1010
import 'package:clicli_dark/pages/time_line_page.dart';
1111
import 'package:clicli_dark/service/events.dart';
1212
import 'package:clicli_dark/service/theme_manager.dart';
13+
import 'package:clicli_dark/utils/toast_utils.dart';
1314
import 'package:clicli_dark/utils/version_util.dart';
1415
import 'package:clicli_dark/widgets/webview.dart';
1516
import 'package:flutter/material.dart';
@@ -64,7 +65,7 @@ class _CliCliAppState extends State<CliCliApp> {
6465
'CliCli://player': (_) => PlayerPage(data: arg!['data']),
6566
'CliCli://login': (_) => const LoginPage(),
6667
'CliCli://fav': (_) => const BgiPage(),
67-
'CliCli://timeline': (_) => TimeLinePage(),
68+
'CliCli://timeline': (_) => const TimeLinePage(),
6869
'CliCli://history': (_) => const HistoryPage(),
6970
'CliCli://webview': (_) => CWebView(url: arg!['url'])
7071
};
@@ -119,24 +120,22 @@ class _MyHomePageState extends State<MyHomePage> {
119120
final _pageController = PageController();
120121

121122
void _onPageChange(int index) {
122-
if (index == _currentPageIndex) return;
123-
setState(() {
124-
_currentPageIndex = index;
125-
_pageController.jumpToPage(index);
126-
});
123+
if (index == _currentPageIndex) {
124+
_toTop(index);
125+
} else {
126+
setState(() {
127+
_currentPageIndex = index;
128+
_pageController.jumpToPage(index);
129+
});
130+
}
127131
}
128132

129133
int lastBack = 0;
130134

131135
Future<bool> _doubleBackExit() {
132136
final int now = DateTime.now().millisecondsSinceEpoch;
133137
if (now - lastBack > 1000) {
134-
ScaffoldMessenger.of(context).showSnackBar(
135-
const SnackBar(
136-
duration: Duration(milliseconds: 1000),
137-
content: Text('再按一次退出应用'),
138-
),
139-
);
138+
showSnackBar('再按一次退出应用');
140139
lastBack = DateTime.now().millisecondsSinceEpoch;
141140
return Future.value(false);
142141
} else {
@@ -145,6 +144,12 @@ class _MyHomePageState extends State<MyHomePage> {
145144
}
146145
}
147146

147+
_toTop(int i) {
148+
Instances.eventBus.fire(
149+
MainButtonNavDoubleClickToTop([MainStack.home, MainStack.ugc][i]),
150+
);
151+
}
152+
148153
@override
149154
void dispose() {
150155
_pageController.dispose();
@@ -157,7 +162,6 @@ class _MyHomePageState extends State<MyHomePage> {
157162
return WillPopScope(
158163
onWillPop: _doubleBackExit,
159164
child: Scaffold(
160-
key: Instances.homeStackscaffoldKey,
161165
body: PageView.builder(
162166
itemCount: pagesIcon.length,
163167
controller: _pageController,
@@ -179,9 +183,7 @@ class _MyHomePageState extends State<MyHomePage> {
179183
width: 35,
180184
height: 35,
181185
),
182-
onPressed: () {
183-
_onPageChange(i);
184-
},
186+
onPressed: () => _onPageChange(i),
185187
),
186188
),
187189
),

0 commit comments

Comments
 (0)