Clarify app version

This commit is contained in:
Hillel Coren 2020-04-10 15:12:34 +03:00
parent 70af7bdd80
commit 6d1c7d2996
5 changed files with 18 additions and 39 deletions

View File

@ -67,6 +67,11 @@ class StartSaving {}
class StopSaving {}
class ServerVersionUpdated {
ServerVersionUpdated({this.version});
final String version;
}
class LoadStaticSuccess implements PersistStatic {
LoadStaticSuccess({this.data});

View File

@ -40,7 +40,6 @@ AppState appReducer(AppState state, dynamic action) {
..isLoading = loadingReducer(state.isLoading, action)
..isSaving = savingReducer(state.isSaving, action)
..lastError = lastErrorReducer(state.lastError, action)
..serverVersion = serverVersionReducer(state.serverVersion, action)
..authState.replace(authReducer(state.authState, action))
..staticState.replace(staticReducer(state.staticState, action))
..userCompanyStates[state.uiState.selectedCompanyIndex] = companyReducer(
@ -50,11 +49,6 @@ AppState appReducer(AppState state, dynamic action) {
state.prefState, action, state.uiState.selectedCompanyIndex)));
}
final serverVersionReducer = combineReducers<String>([
// TODO re-enable this
//TypedReducer<String, LoadStaticSuccess>(_loadStaticSuccess),
]);
final lastErrorReducer = combineReducers<String>([
TypedReducer<String, ClearLastError>((state, action) {
return '';

View File

@ -66,7 +66,6 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
isLoading: false,
isSaving: false,
isTesting: false,
serverVersion: '',
lastError: '',
authState: AuthState(),
staticState: StaticState(),
@ -89,8 +88,6 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
String get lastError;
String get serverVersion;
AuthState get authState;
StaticState get staticState;
@ -141,6 +138,9 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
String get accentColor =>
user?.userCompany?.settings?.accentColor ?? kDefaultAccentColor;
String get appVersion =>
'${account.currentVersion}-${kAppVersion.split('.').last}';
List<HistoryRecord> get historyList =>
prefState.companyPrefs[uiState.selectedCompanyIndex].historyList
.where((history) {
@ -477,7 +477,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
final int patch = int.parse(parts[2]);
try {
final serverParts = serverVersion.split('.');
final serverParts = account.currentVersion.split('.');
final int serverMajor = int.parse(serverParts[0]);
final int serverMinor = int.parse(serverParts[1]);
final int serverPatch = int.parse(serverParts[2]);

View File

@ -30,9 +30,6 @@ class _$AppStateSerializer implements StructuredSerializer<AppState> {
'lastError',
serializers.serialize(object.lastError,
specifiedType: const FullType(String)),
'serverVersion',
serializers.serialize(object.serverVersion,
specifiedType: const FullType(String)),
'authState',
serializers.serialize(object.authState,
specifiedType: const FullType(AuthState)),
@ -81,10 +78,6 @@ class _$AppStateSerializer implements StructuredSerializer<AppState> {
result.lastError = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'serverVersion':
result.serverVersion = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'authState':
result.authState.replace(serializers.deserialize(value,
specifiedType: const FullType(AuthState)) as AuthState);
@ -124,8 +117,6 @@ class _$AppState extends AppState {
@override
final String lastError;
@override
final String serverVersion;
@override
final AuthState authState;
@override
final StaticState staticState;
@ -144,7 +135,6 @@ class _$AppState extends AppState {
this.isSaving,
this.isTesting,
this.lastError,
this.serverVersion,
this.authState,
this.staticState,
this.prefState,
@ -163,9 +153,6 @@ class _$AppState extends AppState {
if (lastError == null) {
throw new BuiltValueNullFieldError('AppState', 'lastError');
}
if (serverVersion == null) {
throw new BuiltValueNullFieldError('AppState', 'serverVersion');
}
if (authState == null) {
throw new BuiltValueNullFieldError('AppState', 'authState');
}
@ -198,7 +185,6 @@ class _$AppState extends AppState {
isSaving == other.isSaving &&
isTesting == other.isTesting &&
lastError == other.lastError &&
serverVersion == other.serverVersion &&
authState == other.authState &&
staticState == other.staticState &&
prefState == other.prefState &&
@ -213,14 +199,12 @@ class _$AppState extends AppState {
$jc(
$jc(
$jc(
$jc(
$jc(
$jc(
$jc($jc(0, isLoading.hashCode),
isSaving.hashCode),
isTesting.hashCode),
lastError.hashCode),
serverVersion.hashCode),
authState.hashCode),
staticState.hashCode),
prefState.hashCode),
@ -248,11 +232,6 @@ class AppStateBuilder implements Builder<AppState, AppStateBuilder> {
String get lastError => _$this._lastError;
set lastError(String lastError) => _$this._lastError = lastError;
String _serverVersion;
String get serverVersion => _$this._serverVersion;
set serverVersion(String serverVersion) =>
_$this._serverVersion = serverVersion;
AuthStateBuilder _authState;
AuthStateBuilder get authState =>
_$this._authState ??= new AuthStateBuilder();
@ -287,7 +266,6 @@ class AppStateBuilder implements Builder<AppState, AppStateBuilder> {
_isSaving = _$v.isSaving;
_isTesting = _$v.isTesting;
_lastError = _$v.lastError;
_serverVersion = _$v.serverVersion;
_authState = _$v.authState?.toBuilder();
_staticState = _$v.staticState?.toBuilder();
_prefState = _$v.prefState?.toBuilder();
@ -321,7 +299,6 @@ class AppStateBuilder implements Builder<AppState, AppStateBuilder> {
isSaving: isSaving,
isTesting: isTesting,
lastError: lastError,
serverVersion: serverVersion,
authState: authState.build(),
staticState: staticState.build(),
prefState: prefState.build(),

View File

@ -459,7 +459,8 @@ class SidebarFooter extends StatelessWidget {
if (state.prefState.isMenuCollapsed) ...[
Expanded(child: SizedBox())
] else ...[
if (account.currentVersion != account.latestVersion)
if (account.currentVersion != account.latestVersion &&
account.latestVersion != '0.0.0')
IconButton(
icon: Icon(
Icons.warning,
@ -628,6 +629,8 @@ void _showUpdate(BuildContext context) {
void _showAbout(BuildContext context) async {
//final packageInfo = await PackageInfo.fromPlatform();
final Store<AppState> store = StoreProvider.of<AppState>(context);
final state = store.state;
final localization = AppLocalization.of(context);
final ThemeData themeData = Theme.of(context);
final TextStyle aboutTextStyle = themeData.textTheme.bodyText2;
@ -643,7 +646,7 @@ void _showAbout(BuildContext context) async {
height: 40.0,
),
//applicationVersion: 'Version: ${packageInfo.version}',
applicationVersion: 'Version: $kAppVersion',
applicationVersion: 'Version: ${state.appVersion}',
applicationLegalese: '© ${DateTime.now().year} Invoice Ninja',
children: <Widget>[
Padding(