No description
Find a file
Varakh c0920f6527
All checks were successful
/ build (push) Successful in 4m26s
feature/prepare-next-dev-cycle (#136)
Reviewed-on: #136
2024-11-01 14:51:39 +00:00
.forgejo/workflows chore(deps,build): move to latest gradle wrapper and AGP, apply all possible updates 2024-11-01 15:21:38 +01:00
android chore(deps,build): move to latest gradle wrapper and AGP, apply all possible updates 2024-11-01 15:21:38 +01:00
assets Various improvements and #noissue 2023-11-26 23:53:17 +01:00
ios 10: Fixed input colors in login view when using dark theme; Added removal of individual files selected for upload; Added size for individual files selected for upload; Replaced intent sharing library with flutter_sharing_intent 2023-01-16 01:43:37 +01:00
lib chore(deps,build): move to latest gradle wrapper and AGP, apply all possible updates 2024-11-01 15:21:38 +01:00
.editorconfig Use 4 spaces as tab 2021-05-21 01:33:16 +02:00
.gitignore chore(deps,build): move to latest gradle wrapper and AGP, apply all possible updates 2024-11-01 15:21:38 +01:00
.metadata Initial commit 2021-02-02 15:33:23 +01:00
analysis_options.yaml Added proper linting #noissue 2023-01-04 21:17:54 +01:00
CHANGELOG.md chore(release): prepare next dev cycle 2024-11-01 15:40:03 +01:00
LICENSE.txt Add license exception for app store distribution #noissue 2022-12-27 12:28:49 +01:00
pubspec.lock chore(deps,build): move to latest gradle wrapper and AGP, apply all possible updates 2024-11-01 15:21:38 +01:00
pubspec.yaml chore(release): prepare next dev cycle 2024-11-01 15:40:03 +01:00
README.md Prepare release of 1.6.2+20 #noissue 2023-12-01 19:09:33 +01:00
renovate.json5 chore(deps,ci): Updates and group renovate updates together 2024-06-08 10:35:06 +02:00

README

A mobile flutter app for FileBin.

Available on the Play Store and IzzyOnDroid.

The main git repository is hosted at https://git.myservermanager.com/varakh/fbmobile. Other repositories are mirrors and pull requests, issues, and planning are managed there.

Contributions are very welcome!

Getting Started

This project is a starting point for a Flutter application.

  • In Intellij or Android Studio (recommended), install the flutter and dart (dependency of flutter) plugins

  • Set up Android SDK:

    • Install via IDE in a folder of your choice (you probably want it not be to installed as superuser)

    • Set the ANDROID_HOME variable so that IDE can detect it automatically

      export ANDROID_HOME="$HOME/.android_sdk"
      export PATH=$PATH:$ANDROID_HOME/tools/bin
      export PATH=$PATH:$ANDROID_HOME/platform-tools
      
  • Set up flutter SDK, you probably want this also on your PATH like ANDROID_HOME

    export PATH="$HOME/.flutter_sdk/bin/:$PATH"
    
  • In the IDE, set the correct SDK paths (e.g. to flutter, dart, Android)

Start by installing dependencies and generating entities!

Dependencies

  • Run flutter packages pub get in project root folder to get dependencies or open the pubspec.yaml and click on the buttons provided by the IDE plugins

JSON Serialization Files

Generate required entities by using these commands:

  • Build once: flutter packages pub run build_runner build --delete-conflicting-outputs
  • File watcher: flutter packages pub run build_runner watch

Architecture

  • Views have models
  • Model classes use services
  • Service classes use data repositories
  • Data repositories use the Api class

Resulting data workflow: USER -> view -> model -> service -> repository -> API.

  • NEVER use services in views (except for NavigationService or DialogService if needed)! Create a model function instead. The UI is then fully decoupled from any business logic.
  • DON'T swallow exceptions with catch (_/e)
  • ONLY handle ServiceException! Other exceptions are serious errors and should therefore result in an error (or get caught by a global catcher)
  • ONLY handle ServiceException in model classes to show the user a result
  • ALWAYS use the DialogService (also possible from within a service/model) and DON'T create separate dialogs
  • ALWAYS use the NavigationService for navigation and NOT Navigation.of(...)

Build & Release

Release with Fastlane

You need fastlane installed locally. Look at the initial setup on how to do that.

Fastlane is used to manage the app store presentation and automatic uploading to the Play Store and to the App Store. With fastlane you can do common tasks in a collaborative way, e.g. publishing to or adapting the texts for the different stores from the commandline.

Before using fastlane you need to properly setup signing, otherwise building will not work.

Initial setup should already be done but this link helps for initial project setup: https://flutter.dev/docs/deployment/cd.

Signing & store access setup

You need to setup individually on your machine for signing and afterwards publish an app for the different platforms.

Android
  • Copy android/key.properties.example to android/key.properties
  • Adjust properties matching your setup and folder structure
  • Point to the android/fastlane/secrets/key.jks you just extracted and ask for the store password.
  • Copy the api-access.json file into android/fastlane/secrets/
iOS

fastlane's match capability helps with Apple's singing, secure keys, and profiles. Use fastlane match in the ios folder to download existing profiles. They're stored in a separate git repository and are encrypted.

You need access to the git repository in which those private files reside.

Usage / doing the actual release

Go into the platform directory you want to build for, e.g. ios/ or android/ and then look into the Fastlane file which lanes are present. Run a lane via fastlane <platform> <lane>, e.g. use the following to build for Android fastlane android build.

Important! For iOS you need to execute pod install first. You also need cocoapods installed.

Android

It's recommended you set up fastlane via bundler (you need this to be installed on your machine).

Go into the android/ sub-directory of the project

bundle config set --local path 'vendor/bundle'
bundle install

# update fastlane when needed
bundle update fastlane

# build only
bundle exec fastlane android build

# deploy (push BETA to app store)
bundle exec fastlane android beta

# deploy (push to app store)
bundle exec fastlane android deploy

# deploy (build signed fdroid large bundle [no target and abi split])
bundle exec fastlane android build_production_fdroid
iOS

For iOS you need to execute fastlane ios build before uploading to testflight with fastlane ios beta.

Probably do the same Ruby/fastlane setup as mentioned under the Android section.

See the following links on how to setup:

To have a clean environment, when building please follow the steps precisely:

  • Clean your local setup with flutter clean
  • Fetch dependencies with flutter pub get
  • Generate model files with flutter packages pub run build_runner build --delete-conflicting-outputs
  • Increase version in pubspec.yaml if needed or not already done
  • Build Android and iOS apps
    • For Android generate an app bundle with flutter build appbundle or flutter build apk.
    • For iOS use flutter build ios --release --no-codesign

Debug

You should use an emulator or real device and Android Studio's internal capability to communicate and to deploy on it. If you want to build a plain debug version, ensure to have a clean environment like mentioned above and then execute the following:

flutter build apk --debug
flutter build ios --debug

Troubleshooting

Seeing something like the following? Remove your .gradle/ folder!
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.2.1-4818971-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
Flutter problems?

Ensure to be on the version mentioned above which should be in the stable branch. If everything breaks, start from fresh via flutter clean and maybe re-do all necessary steps to get the app working in the first place.