Skip to content

Commit

Permalink
feat: 🚀 upgrade SDK, deps, and fix any deprecations in the way + FVM (#…
Browse files Browse the repository at this point in the history
…18)

* add fvm

* upgrade all deps to latest possible, and do any required changes

- path_provider, shared_preferences, url_launcher doesn't support iOS 11 anymore
- freezed was left at 2.5.2 instead of 2.5.3 because of analyzer version issues

* fix almost all deprecations and things that got removed

* disable impeller on android

* setup firebase with flutterfire, and run it on iOS

* disable m3

* fix android not working and follow docs of flutter_local_notifications for both iOS and Android

* remove a launch.json in android folder related to dart :D

* migrate to the declarative way of gradle plugin

https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply

* make android work after recreating the folder!!!

* remove PopScope, it doesn't work as expected and not needed
  • Loading branch information
YazeedAlKhalaf authored Aug 8, 2024
1 parent 596b83d commit e693246
Show file tree
Hide file tree
Showing 61 changed files with 772 additions and 622 deletions.
3 changes: 3 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "3.22.1"
}
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ assets/icons/*
/assets/icons/bottom-nav/*
!/assets/icons/bottom-nav/p_*


/assets/icons/fav/*
!/assets/icons/fav/p_*

/assets/icons/settings/*
!/assets/icons/settings/p_*


/assets/images/*
!/assets/images/p_*

Expand All @@ -88,10 +86,16 @@ assets/icons/*
!/assets/images/home-cards/light/p_*
!/assets/images/home-cards/dark/p_*


# Exclude some assets
!assets/json/

# Google Service File
android/app/google-services.json
GoogleService-Info.plist
GoogleService-Info.plist

# FVM Version Cache
.fvm/

# firebase stuff from flutterfire
firebase.json
lib/firebase_options.dart
13 changes: 8 additions & 5 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "12fccda598477eddd19f93040a1dba24f915b9be"
revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3"
channel: "stable"

project_type: app
Expand All @@ -13,11 +13,14 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 12fccda598477eddd19f93040a1dba24f915b9be
base_revision: 12fccda598477eddd19f93040a1dba24f915b9be
create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
- platform: android
create_revision: 12fccda598477eddd19f93040a1dba24f915b9be
base_revision: 12fccda598477eddd19f93040a1dba24f915b9be
create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
- platform: ios
create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3
base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3

# User provided section

Expand Down
11 changes: 6 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dart.lineLength": 80,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
}
"dart.lineLength": 80,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"dart.flutterSdkPath": ".fvm/versions/3.22.1"
}
45 changes: 40 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,42 @@ This project contains the codebase for the Android version that is on Play Store

## How to run

*Note: the assets were replaced by placeholders, so the version you will run locally is different in look than the version in stores.*
_Note: the assets were replaced by placeholders, so the version you will run locally is different in look than the version in stores._

### 1. Firebase Setup

It's important to put your own Firebase service file in order to run the app, as it uses Remote Config and Firebase Messaging.

1. Create a [new Firebase project](https://console.firebase.google.com/).
2. Add a new Android or iOS app, depending on which device you want to use, and follow the configuration steps to connect Noor to your Firebase project.
2. Add a new Android or iOS app, depending on which device you want to use, and follow the configuration steps to connect Noor to your Firebase project. This could help: https://firebase.google.com/docs/flutter/setup
3. Go to Remote Config page.
4. Add a new parameter with name `noorThker`, with any value of your choice.
5. Go to Cloud Messaging page, and enable it for your project.
6. To setup the cloud function that trigger a notification each time the Remote Config variable changes on the console, find the code in [this repo](https://github.com/Maryom/Noor_RemoteConfig).

### 2. Run
> **NOTE:** You can't really run the app without it, so make sure to set it up.
>
> The app needs some files generated the `flutterfire_cli`, specifically `lib/firebase_options.dart`, `android/app/google-services.json`, and `ios/Runner/GoogleService-Info.plist`.
>
> So make sure to follow the link in **step 2** if you haven't already.
### 2. (optional) FVM Setup

FVM is used to make sure everyone working on the project uses the same version. It is also easier to maintain since the `.fvmrc` file has the config you need to get started quickly.

It also makes it easy for **Noor** to stay on an older version without needing to do lots of upgrades and downgrades, since developers usually work on projects with different versions.

> FVM website: [https://fvm.app/](https://fvm.app/)
Once FVM is installed, run the following command to get things ready:

```
fvm use 3.22.1
```

> Be sure to check `.fvmrc` for the correct version this project uses, in case the version above is old.
### 3. Run

1. Clone the project:

Expand All @@ -51,7 +75,18 @@ git clone https://github.com/pr-Mais/noor.git
flutter pub get
```

4. Run:
3. (for android only) Edit the `android/app/build.gradle`:

This will allow you to sign the app with the debug keystore, no need to make a keystore just for development :D

```diff
- // signingConfig signingConfigs.debug
- signingConfig signingConfigs.release
+ signingConfig signingConfigs.debug
+ // signingConfig signingConfigs.release
```

1. Run:

```bash
flutter run
Expand All @@ -65,6 +100,6 @@ If you encounter any bug while using the apps in store, or running it locally, p
For features request, contact us on [[email protected]](mailto:[email protected]?subject=%D8%A7%D9%82%D8%AA%D8%B1%D8%A7%D8%AD&body=%D8%A7%D9%84%D8%B3%D9%84%D8%A7%D9%85%20%D8%B9%D9%84%D9%8A%D9%83%D9%85%D8%8C)

## Credits

Shout out to the amazing designer [Shaikha Alqahtani](https://twitter.com/Ishaiookh).
<br/> The iOS version from Noor was made with native Swift by [Maryam Aljamea](https://twitter.com/0_1Mary).

2 changes: 2 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
77 changes: 35 additions & 42 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
plugins {
id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
id 'com.google.gms.google-services'
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}
Expand All @@ -23,63 +26,53 @@ if (keyPropertiesFile.exists()) {

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = '1.0'
flutterVersionName = "1.0"
}

android {
namespace 'com.noor.sa'
compileSdkVersion 33
ndkVersion flutter.ndkVersion
namespace = "com.noor.sa"
compileSdk = 34
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "com.noor.sa"
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
applicationId = "com.noor.sa"
minSdk = 21
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
// i added this back cuz it was there before the android folder recreation
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
release {
keyAlias keyProperties['keyAlias']
keyPassword keyProperties['keyPassword']
storeFile keyProperties['storeFile'] ? file(keyProperties['storeFile']) : null
storePassword keyProperties['storePassword']
}
}
buildTypes {
release {
signingConfigs {
release {
keyAlias keyProperties['keyAlias']
keyPassword keyProperties['keyPassword']
storeFile keyProperties['storeFile'] ? file(keyProperties['storeFile']) : null
storePassword keyProperties['storePassword']
}
}

buildTypes {
release {
// signingConfig signingConfigs.debug
signingConfig signingConfigs.release
shrinkResources false
minifyEnabled true
}
}
}
}
}

flutter {
source '../..'
source = "../.."
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

8 changes: 3 additions & 5 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.noor.sa">
<!-- Flutter needs it to communicate with the running application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
</manifest>
Loading

0 comments on commit e693246

Please sign in to comment.