Skip to content

Commit

Permalink
Add set current version code to user property
Browse files Browse the repository at this point in the history
  • Loading branch information
abc873693 committed Feb 24, 2021
1 parent 45b03c0 commit 026e8bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/config/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Constants {
static const CRAWLER_SELECTOR = 'crawler_selector';
static const SEMESTER_DATA = 'semester_data';
static const MOBILE_NKUST_USER_AGENT = 'mobile_nksut_user_agent';
static const VERSION_CODE = "version_code";

static const TAG_STUDENT_PICTURE = "tag_student_picture";
static const TAG_NEWS_PICTURE = "tag_news_picture";
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:ap_common/config/ap_constants.dart';
import 'package:ap_common/models/version_info.dart';
import 'package:ap_common/utils/analytics_utils.dart';
import 'package:ap_common/utils/dialog_utils.dart';
import 'package:ap_common/utils/notification_utils.dart';
import 'package:ap_common/utils/preferences.dart';
Expand Down Expand Up @@ -71,6 +72,10 @@ class Utils {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
var currentVersion =
Preferences.getString(Constants.PREF_CURRENT_VERSION, '');
AnalyticsUtils.instance?.setUserProperty(
Constants.VERSION_CODE,
packageInfo.buildNumber,
);
if (currentVersion != packageInfo.buildNumber) {
DialogUtils.showUpdateContent(
context,
Expand Down

0 comments on commit 026e8bc

Please sign in to comment.