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

Mixpanel integration and upgrade flutter version #42

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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.

2 changes: 1 addition & 1 deletion .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: subosito/flutter-action@v1
with:
channel: "stable"
flutter-version: '3.0.5'
flutter-version: '3.10.5'
- run: |
flutter doctor
flutter pub get
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/firebase-hosting-production-pull-request.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/firebase-hosting-pull-request.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ulaskelas-frontend",
"request": "launch",
"type": "dart"
},
{
"name": "ulaskelas-frontend (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "ulaskelas-frontend (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release"
}
]
}
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"
}
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ This document briefly describes some guidance on how you can contribute to this

1. **[lib/main_development.dart](lib/main_development.dart)**: The entry of Project.

## PR

Please PR on the development branch first :smile:

While creating PR, below materials could be helpful:

* [Effective Dart](https://www.dartlang.org/guides/language/effective-dart)
Expand Down
46 changes: 21 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 👨‍💻 Ulas Kelas
[![Generic badge](https://img.shields.io/badge/Flutter-v3.0.5-blue)](https://flutter.dev/docs)
[![Generic badge](https://img.shields.io/badge/Dart-v2.13.4-blue)](https://dart.dev/guides)
[![Generic badge](https://img.shields.io/badge/Flutter-v3.10.5-blue)](https://flutter.dev/docs)
[![Generic badge](https://img.shields.io/badge/Dart-v3.0.6-blue)](https://dart.dev/guides)
[![test](https://github.com/RistekCSUI/ulaskelas-frontend/actions/workflows/config.yml/badge.svg)](https://github.com/RistekCSUI/ulaskelas-frontend/actions/workflows/config.yml)
[![Deploy Web](https://github.com/RistekCSUI/ulaskelas-frontend/actions/workflows/firebase-hosting-merge.yml/badge.svg)](https://github.com/RistekCSUI/ulaskelas-frontend/actions/workflows/firebase-hosting-merge.yml)
[![codecov](https://codecov.io/gh/RistekCSUI/ulaskelas-frontend/branch/main/graph/badge.svg?token=SHFALBJG9U)](https://codecov.io/gh/RistekCSUI/ulaskelas-frontend)
Expand All @@ -12,38 +12,34 @@ Ulas Kelas app

## ⚡️ Getting Started

### 🚚 How to run, drive, and build Apk
### 🚚 How to run

Example how to run release development app
Make sure you have [Backend](https://github.com/ristekoss/ulaskelas-backend) running on your local's

Update .env.example with your local's url, for example:
```
flutter clean
flutter pub get
flutter run -t lib/main_development.dart --release --flavor development
BASE_URL_DEV = localhost:3000
BASE_URL_PROD = ""
```

Example how to build release development app
Add key.properties to /android
```
flutter clean
flutter pub get
flutter build apk -t lib/main_development.dart --release --no-shrink --flavor development --split-per-abi
storePassword=<storePassword>
storePasswordDevelopment=<storePasswordDevelopment>
keyPassword=<keyPassword>
keyPasswordDevelopment=<keyPasswordDevelopment>
keyAlias=<keyAlias>
keyAliasDevelopment=<keyAliasDevelopment>
storeFile=<storeFile>
storeFileDevelopment=<storeFileDevelopment>
```

Example how to build bundle release production app
Example how to run development app
```
flutter clean
flutter pub get
flutter build appbundle -t lib/main_production.dart --release --no-shrink --flavor production
```

Example how to run flutter web app
```
flutter run -t lib/main_development.dart -d chrome
```

Example how to drive automation test on development environment
note that automation test doesn't support release mode
```
flutter drive -t test_driver/app.dart --flavor development
dart run build_runner build --delete-conflicting-outputs
flutter run -t lib/main_development.dart --flavor development
```

### ⚙️ Supported Flavor
Expand Down Expand Up @@ -112,7 +108,7 @@ examples:
feat: Form Login
ci: refactor analysis job

before push
### before push
1. flutter analyze
2. flutter test

Expand Down
10 changes: 5 additions & 5 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.2.4.0.yaml
include: package:very_good_analysis/analysis_options.5.0.0.yaml

analyzer:
# We should disable linter for generated code
Expand All @@ -9,13 +9,13 @@ analyzer:
- lib/**/*.freezed.dart
- test/**/*.mocks.dart

strong-mode:
implicit-casts: true
implicit-dynamic: true

errors:
# Allow having TODOs in the code.
todo: ignore
language:
strict-casts: false
strict-inference: false
strict-raw-types: false

# LINTER Preferences
#
Expand Down
8 changes: 4 additions & 4 deletions 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 All @@ -34,7 +34,7 @@ if (keystorePropertiesFile.exists()) {
}

android {
compileSdkVersion 31
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -43,8 +43,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ristek.ulaskelas"
minSdkVersion 19
targetSdkVersion 30
minSdkVersion 26
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
buildscript {
ext.kotlin_version = '1.5.10'
ext.kotlin_version = '1.8.20'
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
5 changes: 2 additions & 3 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// Created by Muhamad Fauzi Ridwan on 23/08/21.

import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:flutter/material.dart';
import 'package:states_rebuilder/states_rebuilder.dart';
import 'package:ulaskelas/app_wrapper.dart';
import 'package:ulaskelas/core/bases/states/_states.dart';
import 'package:ulaskelas/core/constants/_constants.dart';

FirebaseAnalytics analytics = FirebaseAnalytics();
FirebaseAnalytics analytics = FirebaseAnalytics.instance;

class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
const App({super.key});

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 4 additions & 2 deletions lib/app_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import 'package:ristek_material_component/ristek_material_component.dart';
import 'package:ulaskelas/core/_core.dart';
import 'package:ulaskelas/core/bases/widgets/confirmation_modal_dialog.dart';
import 'package:ulaskelas/core/theme/_theme.dart';
import 'package:ulaskelas/services/_services.dart';
import 'package:ulaskelas/services/launch_service.dart';
import 'package:ulaskelas/services/versioning/check_version.dart';

import 'core/environment/_environment.dart';

class AppWrapper extends StatefulWidget {
const AppWrapper({Key? key}) : super(key: key);
const AppWrapper({super.key});

@override
_AppWrapperState createState() => _AppWrapperState();
Expand All @@ -27,6 +28,7 @@ class _AppWrapperState extends State<AppWrapper> {
@override
void initState() {
super.initState();
MixpanelService.track('open_app');
splashTime();
}

Expand Down Expand Up @@ -122,7 +124,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
5 changes: 4 additions & 1 deletion lib/authentication_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import 'package:flutter/material.dart';
import 'package:ristek_material_component/ristek_material_component.dart';
import 'package:states_rebuilder/states_rebuilder.dart';
import 'package:ulaskelas/features/matkul/bookmarks/domain/entities/query_bookmark.dart';
import 'package:ulaskelas/services/_services.dart';

import 'core/bases/states/_states.dart';
import 'core/constants/_constants.dart';
import 'core/theme/_theme.dart';

class AuthenticationPage extends StatelessWidget {
const AuthenticationPage({Key? key}) : super(key: key);
const AuthenticationPage({super.key});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -69,6 +70,7 @@ Aplikasi ulasan mata kuliah Fasilkom UI.\nMasuk dan buat ulasanmu sekarang!''',
}

Future<void> _ssoLogin() async {
MixpanelService.track('login');
if (authRM.state.isLoading) {
return;
}
Expand All @@ -81,6 +83,7 @@ Aplikasi ulasan mata kuliah Fasilkom UI.\nMasuk dan buat ulasanmu sekarang!''',
await Future.delayed(const Duration(seconds: 1));
await authRM.setState((s) => s.ssoLogin());
if (authRM.state.isLogin) {
MixpanelService.track('login_success');
await profileRM.state.retrieveData();
await bookmarkRM.state.retrieveData(QueryBookmark());
if (profileRM.state.profile.isBlocked ?? false) {
Expand Down
2 changes: 2 additions & 0 deletions lib/core/bases/states/_states.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import 'package:ulaskelas/onboarding_page.dart';
import 'package:ulaskelas/services/_services.dart';
import 'package:universal_html/html.dart';

import '../../utils/util.dart';

part 'auth_state.dart';
part 'cleaner.dart';
part 'global_state.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/core/bases/states/auth_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class AuthState {
path: '/static.html',
);

final url = '${Endpoints.sso}/?redirect_url=${redirectUri.toString()}';
final url = '${Endpoints.sso}/?redirect_url=$redirectUri';
Logger().w(Uri.parse(url).query);

Logger().w(redirectUri.toString());
Expand Down
Loading