Skip to content
Merged
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
9 changes: 6 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
COURSES_URL=
GRADS_URL=
GRADE_OPTIMIZER_URL=
API_COURSES=
API_SUBJECTS=
API_GENETIC_ALGORITHM=
API_SUPPORT_URL=
API_FINAL_SCORE_URL=
API_NOTIFICATIONS=
1 change: 0 additions & 1 deletion .github/workflows/build_IOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# run: |
# echo "GRADS_URL=${{ vars.API_COURSES }}" >> .env # The courses API
# echo "COURSES_URL=${{ vars.API_SUBJECTS }}" >> .env # The subjects API
# echo "GRADE_OPTIMIZER_URL=${{ vars.API_GRADE_OPTMIZER }}" >> .env # The grade optimizer API

# - name: Setup Fastlane
# uses: ruby/setup-ruby@v1
Expand Down
77 changes: 51 additions & 26 deletions .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@ on:
- homolog
- prod

workflow_call:

jobs:
build_android:
environment: ${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}

- name: Get Version
run: |
Expand All @@ -29,27 +25,38 @@ jobs:
echo "app_build_name=$app_build_name" >> $GITHUB_ENV

- name: Setup Java Version
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: "12.x"
java-version: "17"
distribution: 'temurin'

- name: Setup Flutter Version
uses: subosito/flutter-action@v1
uses: subosito/flutter-action@v2
with:
flutter-version: "3.24.3"

- name: Get flutter dependencies
run: flutter pub get

- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6"
bundler-cache: true
working-directory: android

- name: Set envs
- name: Set AWS Account ID
run: |
if [[ "${{ github.ref_name }}" == "dev" ]]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID_DEV }}" >> $GITHUB_ENV
elif [[ "${{ github.ref_name }}" == "homolog" ]]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID_HOML }}" >> $GITHUB_ENV
elif [[ "${{ github.ref_name }}" == "prod" ]]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID_PROD }}" >> $GITHUB_ENV
else
echo "Invalid branch name!" && exit 1
fi
echo "STACK_NAME=DevMediasStack${{github.ref_name}}" >> $GITHUB_ENV

- name: Setup AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/GithubActionsRole
role-session-name: github-action

- name: Configure Keystore
run: |
Expand All @@ -65,33 +72,51 @@ jobs:
ANDROID_KEYSTORE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_STORE_PASSWORD }}
working-directory: android

# Busca o endpoint do APIGW no SSM (configurado no back).
- name: Fetch config from SSM
run: |
STAGE=$(echo "${{ github.ref_name }}" | tr '[:upper:]' '[:lower:]')

API_BASE=$(aws ssm get-parameter \
--name "/devmedias/$STAGE/api/url" \
--query "Parameter.Value" --output text)

API_BASE="${API_BASE%/}/"
echo "API_BASE=$API_BASE" >> $GITHUB_ENV

- name: Create .env file
run: |
echo "API_COURSES=${{vars.API_COURSES}}" >> .env # The courses API
echo "API_SUBJECTS=${{vars.API_SUBJECTS}}" >> .env # The subjects API
echo "API_GRADE_OPTMIZER=${{vars.API_GRADE_OPTMIZER}}" >> .env # The grade optimizer API
echo "API_SUPPORT_URL=${{vars.API_SUPPORT_URL}}" >> .env # The support API
echo "API_FINAL_SCORE_URL=${{vars.API_FINAL_SCORE_URL}}" >> .env # The final score API
{
echo "API_COURSES=${API_BASE}get-all-cursos"
echo "API_SUBJECTS=${API_BASE}get-all-disciplinas"
echo "API_GENETIC_ALGORITHM=${API_BASE}genetic-algorithm"
echo "API_SUPPORT_URL=${API_BASE}public/contact-us"
echo "API_FINAL_SCORE_URL=${API_BASE}calculate-mean"
echo "API_NOTIFICATIONS="
} >> .env

- name: Build Android
run: |
flutter build appbundle --release --build-name=$app_build_name --build-number=$app_build_number
flutter build appbundle --release \
--build-name=$app_build_name \
--build-number=$app_build_number

- name: Upload to artifacts
uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: build/app/outputs/bundle/release/
retention-days: 1

deploy_to_play_store:
needs: build_android
environment: ${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository }}

- name: Download artifact
uses: actions/download-artifact@v4
Expand All @@ -102,12 +127,12 @@ jobs:
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6"
ruby-version: "3.2"
bundler-cache: true
working-directory: android

- name: Exec fastlane
run: bundle exec fastlane ${{github.ref_name}}
run: bundle exec fastlane ${{ github.ref_name }}
env:
PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }}
working-directory: android
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Miscellaneous
*.class
*.log
# Lock files (do not ignore Dart/Flutter lockfile — commit pubspec.lock)
*.lock
!pubspec.lock
*.pyc
*.swp
.DS_Store
Expand Down Expand Up @@ -35,6 +37,11 @@ migrate_working_dir/
.pub/
/build/

# Platform build outputs (Gradle, CMake, etc.)
/android/build/
/android/app/build/
/ios/build/

# Symbolication related
app.*.symbols

Expand Down
2 changes: 2 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
gradle-wrapper.jar
/.gradle
/build/
app/build/
/captures/
/gradlew
/gradlew.bat
Expand Down
2 changes: 1 addition & 1 deletion android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@ DEPENDENCIES
fastlane

BUNDLED WITH
1.17.2
1.17.2
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}

sourceSets {
Expand All @@ -57,7 +57,7 @@ android {

defaultConfig {
applicationId "com.dev_medias_front_rn_v2"
minSdkVersion 21
minSdkVersion flutter.minSdkVersion
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
7 changes: 4 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ allprojects {
}
}

rootProject.buildDir = '../build'
rootProject.layout.buildDirectory.value(rootProject.layout.buildDirectory.dir("../../build").get())

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.layout.buildDirectory.value(rootProject.layout.buildDirectory.dir(project.name).get())
}
subprojects {
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
delete rootProject.layout.buildDirectory
}
2 changes: 1 addition & 1 deletion android/fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package_name("com.dev_medias_front_rn")
package_name("com.dev_medias_front_rn_v2")
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "com.android.application" version "8.7.0" apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
}

include ":app"
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
<string>13.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
8 changes: 4 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
PODFILE CHECKSUM: 4f1c12611da7338d21589c0b2ecd6bd20b109694

COCOAPODS: 1.16.2
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -585,7 +585,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -636,7 +636,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
3 changes: 3 additions & 0 deletions ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
Expand Down Expand Up @@ -54,11 +55,13 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
3 changes: 2 additions & 1 deletion lib/app/controller/add_page_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ abstract class AddPageControllerBase with Store {
@action
Future<void> loadCourses() async {
setCoursesLoaded(false);
final result = await coursesController.fetchCourses();
await coursesController.refreshAllSubjects();
final result = Map<String, dynamic>.from(coursesController.allCourses!);
result.removeWhere(
(key, value) => userController.currentCourses.contains(value.code));
availableCourses = ObservableMap<String, dynamic>.of(result);
Expand Down
16 changes: 15 additions & 1 deletion lib/app/controller/common/courses_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,21 @@ abstract class CoursesControllerBase with Store {
setLoadedCourses(true);
return response;
} catch (e) {
throw Exception('Erro de rede: $e');
setLoadedCourses(allCourses != null && allCourses!.isNotEmpty);
rethrow;
}
}

/// GET de todas as disciplinas + atualização do catálogo e lista da home.
@action
Future<bool> refreshAllSubjects() async {
try {
final courses = await fetchCourses();
setAllCourses(courses);
await userController.pruneCurrentCoursesWithCatalog();
return true;
} catch (_) {
return false;
}
}
}
Expand Down
Loading
Loading