Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mixpanel tracker #37

Merged
merged 4 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
Expand Down
2 changes: 1 addition & 1 deletion lib/app_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ A new version of this app available on the store, please update into the newer v
Text(
'by RISTEK Fasilkom UI',
style: FontTheme.poppins14w500white(),
)
),
],
),
),
Expand Down
6 changes: 5 additions & 1 deletion lib/core/environment/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Config {
await HiveDataBaseService.init();
}
await Pref.init();
await MixpanelService.init();

// TODO(fauzi): Implement notification plugin
// await notificationPlugin.init();
Expand All @@ -55,6 +56,7 @@ class Config {
}

static bool get isDevelopment => appFlavor == Flavor.development;

static BaseConfig get baseConfig => _baseConfig()!;

static BaseConfig? _baseConfig() {
Expand All @@ -74,8 +76,10 @@ class Config {

class BaseConfig {
const BaseConfig({
required this.endpoints, this.assetAbsolutePath = Constants.assetPath,
required this.endpoints,
this.assetAbsolutePath = Constants.assetPath,
});

final String assetAbsolutePath;
final BaseEndpoints endpoints;
}
Expand Down
4 changes: 3 additions & 1 deletion lib/core/environment/secrets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import 'package:envied/envied.dart';

part 'secrets.g.dart';

@Envied(name: 'Secret', path: '.env.example')
@Envied(name: 'Secret', path: '.env')
abstract class Secret {
@EnviedField(varName: 'BASE_URL_DEV')
static const String baseUrlDev = _Secret.baseUrlDev;
@EnviedField(varName: 'BASE_URL_PROD')
static const String baseUrlProd = _Secret.baseUrlProd;
@EnviedField(varName: 'MIXPANEL_TOKEN')
static const String mixpanelToken = _Secret.mixpanelToken;
}
1 change: 1 addition & 0 deletions lib/features/home/presentation/pages/_pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:ulaskelas/features/home/presentation/widgets/_widgets.dart';
import 'package:ulaskelas/features/matkul/form/domain/entities/query_review.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/_widgets.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/skeleton_card_course.dart';
import 'package:ulaskelas/services/_services.dart';

part 'home_daftar_matkul_page.dart';
part 'home_daftar_ulasan_page.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class _HomeDaftarUlasanPageState extends BaseStateful<HomeDaftarUlasanPage> {
review.course!,
review.courseCode!,
);
MixpanelService.track('view_my_review');
},
);
},
Expand Down
24 changes: 16 additions & 8 deletions lib/features/home/presentation/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class _HomePageState extends BaseStateful<HomePage> {
Text(
'Lihat Semua Mata Kuliah',
style: FontTheme.poppins14w400purple(),
)
),
],
),
Icon(
Expand Down Expand Up @@ -141,7 +141,7 @@ class _HomePageState extends BaseStateful<HomePage> {
'Lihat Semua',
style: FontTheme.poppins13w400purple(),
),
)
),
],
),
),
Expand Down Expand Up @@ -219,12 +219,16 @@ class _HomePageState extends BaseStateful<HomePage> {
style: FontTheme.poppins14w700black(),
),
InkWell(
onTap: () => nav.goToHomeDaftarUlasan(),
onTap: () {
nav.goToHomeDaftarUlasan();

MixpanelService.track('view_all_reviews');
},
child: Text(
'Lihat Semua',
style: FontTheme.poppins13w400purple(),
),
)
),
],
),
),
Expand Down Expand Up @@ -260,10 +264,14 @@ class _HomePageState extends BaseStateful<HomePage> {
final review = data.summaries[i];
return CardMatkulReview(
review: review,
onTap: () => nav.goToDetailMatkulPage(
review.course!,
review.courseCode.toString(),
),
onTap: () {
nav.goToDetailMatkulPage(
review.course!,
review.courseCode.toString(),
);

MixpanelService.track('view_my_review');
},
);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ class CardMatkulReview extends StatelessWidget {
: (review.hateSpeechStatus == 'WAITING')
? TagStatus.pending
: TagStatus.rejected,
)
),
],
)
),
],
)
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class _EditComponentPageState extends BaseStateful<EditComponentPage> {
await onSubmitCallBack(context);
},
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class _ComponentFormPageState extends BaseStateful<ComponentFormPage> {
await onSubmitCallBack(context);
},
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class _CalculatorComponentPageState
Text(
_getFinalScoreAndGrade(widget.totalScore),
style: FontTheme.poppins14w600black(),
)
),
],
),
Padding(
Expand Down Expand Up @@ -103,7 +103,7 @@ class _CalculatorComponentPageState
textAlign: TextAlign.center,
style: FontTheme.poppins12w600black(),
),
)
),
],
),
),
Expand Down Expand Up @@ -193,7 +193,7 @@ class _CalculatorComponentPageState
),
),
),
)
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CardCompononent extends StatelessWidget {
style: FontTheme.poppins12w400black(),
textAlign: TextAlign.right,
),
)
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SimpanButton extends StatelessWidget {
color: Color.fromRGBO(0, 0, 0, 0.05),
blurRadius: 4,
offset: Offset(0, -2),
)
),
],
),
child: AutoLayoutButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TagLeaderboard extends StatelessWidget {
return [
BaseColors.purpleHearth,
BaseColors.purpleHearth,
BaseColors.white
BaseColors.white,
];
}else if(rank == 1){
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SkeletonCardLeaderboard extends StatelessWidget {
),
),
),
)
),
],
),
title: Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class _AllReviewMatkulPageState extends BaseStateful<AllReviewMatkulPage> {
size: 28,
),
),
)
),
],
);
},
Expand All @@ -149,7 +149,7 @@ class _AllReviewMatkulPageState extends BaseStateful<AllReviewMatkulPage> {
color: Color.fromRGBO(0, 0, 0, 0.05),
blurRadius: 4,
offset: Offset(0, -2),
)
),
],
),
child: TulisUlasanButton(
Expand All @@ -161,7 +161,7 @@ class _AllReviewMatkulPageState extends BaseStateful<AllReviewMatkulPage> {
}
},
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class _DetailMatkulPageState extends BaseStateful<DetailMatkulPage> {
'${course.reviewCount} Ulasan',
style: FontTheme.poppins12w400black(),
),
)
),
],
),
const WidthSpace(32),
Expand Down Expand Up @@ -347,7 +347,7 @@ class _DetailMatkulPageState extends BaseStateful<DetailMatkulPage> {
);
}
},
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class _ReviewMatkulPageState extends BaseStateful<ReviewMatkulPage> {
children: [
TulisUlasanButton(
onTap: () {},
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:ulaskelas/features/leaderboard/presentation/widgets/_widgets.dar
import 'package:ulaskelas/features/matkul/bookmarks/data/models/_models.dart';
import 'package:ulaskelas/features/matkul/form/data/models/_models.dart';
import 'package:ulaskelas/features/matkul/search/data/models/_models.dart';
import 'package:ulaskelas/services/_services.dart';
import 'package:ulaskelas/services/launch_service.dart';

part 'review_card.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class ReviewCard extends StatelessWidget {
// color: likesCountColor,
),
),
)
),
],
)
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ part of '_widgets.dart';

class TitleAndBookMark extends StatelessWidget {
const TitleAndBookMark({
required this.course, super.key,
required this.course,
super.key,
});

final CourseModel course;
Expand Down Expand Up @@ -36,6 +37,7 @@ class TitleAndBookMark extends StatelessWidget {
shortName: course.shortName,
);
bookmarkRM.setState((s) => s.toggleBookmark(bookmark));
MixpanelService.track('bookmark_course');
},
child: Icon(
Icons.bookmark,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Pilih maksimal 3 kategori yang menurutmu dapat\nmerepresentasikan mata kuliah in
},
),
),
)
),
],
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _SuccessFormPageState extends BaseStateful<SuccessFormPage> {
onPressed: () {
nav.pop();
},
)
),
],
),
),
Expand Down
1 change: 1 addition & 0 deletions lib/features/matkul/search/presentation/pages/_pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:ulaskelas/core/theme/_theme.dart';
import 'package:ulaskelas/features/matkul/main/domain/entities/query_search_course.dart';
import 'package:ulaskelas/features/matkul/search/presentation/states/_states.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/_widgets.dart';
import 'package:ulaskelas/services/_services.dart';

part 'filter_page.dart';
part 'search_course_page.dart';
11 changes: 10 additions & 1 deletion lib/features/matkul/search/presentation/pages/filter_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,19 @@ class _FilterPageState extends BaseStateful<FilterPage> {
text: 'Terapkan Filter',
onTap: () {
nav.pop<bool>(true);
MixpanelService.track(
'apply_course_filter',
params: {
'jenis_matkul': filterRM.state.selectedType.toString(),
'jumlah_sks': filterRM.state.selectedSks.toString(),
'semester_wajib_ambil':
filterRM.state.selectedSemester.toString(),
},
);
},
),
),
)
),
],
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class _SearchCoursePageState
},
onFieldSubmitted: (val) {
searchCourseRM.state.addToHistory(val);
MixpanelService.track(
'search_course',
params: {
'query': val,
},
);
},
onChange: onQueryChanged,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:ulaskelas/core/theme/_theme.dart';
import 'package:ulaskelas/features/matkul/search/data/models/_models.dart';
import 'package:ulaskelas/features/matkul/search/presentation/states/_states.dart';
import 'package:ulaskelas/features/matkul/search/presentation/widgets/skeleton_card_course.dart';
import 'package:ulaskelas/services/_services.dart';

part 'base_app_bar.dart';
part 'card_course.dart';
Expand Down
Loading