Skip to content

Commit f6ad8ff

Browse files
committed
WIP
1 parent a015ec7 commit f6ad8ff

File tree

211 files changed

+3208
-1224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+3208
-1224
lines changed

.env.default

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
ZAPIFY_HOME_BANNER_UNIT_ID=
22
ZAPIFY_AMPLITUDE_KEY=
3-
FIREBASE_PROJECT_ID=zapfy-f575a
4-
ANDROID_PACKAGE_NAME=com.zapfy.app.dev
5-
IOS_BUNDLE_ID=com.zapfy.app.dev

.fvm/fvm_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"flutterSdkVersion": "3.3.10",
2+
"flutterSdkVersion": "3.7.12",
33
"flavors": {}
44
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
.packages
3030
.pub-cache/
3131
.pub/
32-
/build/
32+
build/
3333

3434
# Web related
3535
lib/generated_plugin_registrant.dart

.groovylintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "recommended",
3+
"rules": {
4+
"CompileStatic": {
5+
"enabled": false
6+
},
7+
"NoDef": {
8+
"enabled": false
9+
},
10+
"VariableTypeRequired": {
11+
"enabled": false
12+
}
13+
}
14+
}

.metadata

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: 7e9793dee1b85a243edd0e06cb1658e98b077561
8-
channel: unknown
7+
revision: 135454af32477f815a7525073027a3ff9eff1bfd
8+
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
17+
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
18+
19+
# User provided section
20+
21+
# List of Local paths (relative to this file) that should be
22+
# ignored by the migrate tool.
23+
#
24+
# Files that are not part of the templates will be ignored by default.
25+
unmanaged_files:
26+
- 'lib/main.dart'
27+
- 'ios/Runner.xcodeproj/project.pbxproj'

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ repos:
1212
rev: v1.1.0
1313
hooks:
1414
- id: fvm-dart-format
15+
args: ["--set-exit-if-changed"]
1516
- id: fvm-dart-analyze

README.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,20 @@ There are many of others applications for the same purpose, but this app is just
1818

1919
### Requirements
2020

21-
- [FVM](https://fvm.app/)
21+
- Flutter ^3.7 or [FVM](https://fvm.app/) (recommended)
2222
- Platform SDKs: Android and XCode
23-
- Registered Android and iOS projects in Firebase
24-
25-
### Setup
26-
27-
```bash
28-
# Get dependencies
29-
fvm flutter pub get
30-
31-
# Download Firebase configuration
32-
fvm dart run flutter_toolkit:cli project-setup
33-
```
23+
- Registered Android and iOS projects in Firebase (optional)
3424

3525
### Run
3626

3727
```bash
38-
fvm dart run flutter_toolkit:cli run-app
28+
flutter run
3929
```
4030

4131
### Unit tests
4232

4333
```bash
44-
fvm flutter test
34+
flutter test
4535
```
4636

4737
## Built with

android/app/build.gradle

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* groovylint-disable DuplicateListLiteral, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, UnnecessaryGString */
12
def localProperties = new Properties()
23
def localPropertiesFile = rootProject.file('local.properties')
34
if (localPropertiesFile.exists()) {
@@ -18,34 +19,23 @@ if (flutterRoot == null) {
1819
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
1920
}
2021

21-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
22-
if (flutterVersionCode == null) {
23-
flutterVersionCode = '1'
24-
}
25-
26-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
27-
if (flutterVersionName == null) {
28-
flutterVersionName = '1.0'
29-
}
30-
31-
def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
32-
if (flutterMinSdkVersion == null) {
33-
flutterMinSdkVersion = '19'
34-
}
22+
def flutterVersionCode = localProperties['flutter.versionCode'] ?: '1'
23+
def flutterVersionName = localProperties['flutter.versionName'] ?: '1.0'
24+
def flutterMinSdkVersion = localProperties['flutter.minSdkVersion'] ?: '19'
3525

3626
def isFirebaseDistribution = System.getenv('IS_FIREBASE_DISTRIBUTION') == 'true'
3727

3828
apply plugin: 'com.android.application'
39-
// START: FlutterFire Configuration
40-
apply plugin: 'com.google.gms.google-services'
41-
apply plugin: 'com.google.firebase.firebase-perf'
42-
apply plugin: 'com.google.firebase.crashlytics'
43-
// END: FlutterFire Configuration
4429
apply plugin: 'kotlin-android'
30+
31+
apply from: 'load-environment-variables.gradle'
32+
apply from: 'google-services.gradle'
33+
apply from: 'google-ads.gradle'
34+
4535
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
4636

4737
android {
48-
compileSdkVersion 33
38+
compileSdkVersion flutter.compileSdkVersion
4939

5040
compileOptions {
5141
sourceCompatibility JavaVersion.VERSION_1_8
@@ -64,12 +54,10 @@ android {
6454
applicationId "com.zapfy.app"
6555

6656
minSdkVersion flutterMinSdkVersion.toInteger()
67-
targetSdkVersion 33
57+
targetSdkVersion flutter.targetSdkVersion
6858

6959
versionCode flutterVersionCode.toInteger()
7060
versionName flutterVersionName
71-
72-
manifestPlaceholders["ADS_APP_ID"] = System.getenv('ANDROID_ADS_APP_ID') ?: secretsProperties.getProperty('ads.appId')
7361
}
7462

7563
signingConfigs {
@@ -83,9 +71,6 @@ android {
8371

8472
buildTypes {
8573
debug {
86-
FirebasePerformance {
87-
instrumentationEnabled false
88-
}
8974
applicationIdSuffix ".dev"
9075
signingConfig signingConfigs.debug
9176
}
@@ -110,20 +95,6 @@ flutter {
11095
source '../..'
11196
}
11297

113-
project.gradle.taskGraph.whenReady { graph ->
114-
project.tasks.findAll().forEach { task ->
115-
if (task.name.contains("processDebugGoogleServices")) {
116-
def googleServicesJsonFiles = fileTree(dir: ".", include: "**/google-services.json")
117-
if (googleServicesJsonFiles.isEmpty()) {
118-
task.enabled = false
119-
}
120-
}
121-
}
122-
}
123-
12498
dependencies {
12599
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126-
127-
implementation platform('com.google.firebase:firebase-bom:30.3.0')
128-
implementation 'com.google.firebase:firebase-analytics'
129100
}

android/app/google-ads.gradle

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import groovy.json.JsonSlurper
2+
3+
def hasGoogleAdsPlugin = false
4+
5+
def flutterProjectRoot = rootProject.projectDir.parentFile
6+
def pluginsFile = new File(flutterProjectRoot, '.flutter-plugins-dependencies')
7+
8+
if (pluginsFile.exists()) {
9+
def flutterPlugins = new JsonSlurper().parseText(pluginsFile.text).plugins.android
10+
hasGoogleAdsPlugin = flutterPlugins.any { plugin -> plugin.name == 'google_mobile_ads' }
11+
}
12+
13+
if (!hasGoogleAdsPlugin) {
14+
println 'No Google Ads ID found, skipping'
15+
return
16+
}
17+
18+
println 'Found Google Mobile ADS plugin, adding Google Ads ID to manifest'
19+
20+
def secretsPropertiesFile = rootProject.file("secrets.properties")
21+
if (!secretsPropertiesFile.exists()) {
22+
secretsPropertiesFile = rootProject.file("secrets.defaults.properties")
23+
}
24+
def secretsProperties = new Properties()
25+
secretsProperties.load(new FileInputStream(secretsPropertiesFile))
26+
27+
def adsAppId = System.getenv('ANDROID_ADS_APP_ID') ?: secretsProperties.getProperty('ads.appId')
28+
29+
apply plugin: 'com.google.gms.google-services'
30+
31+
android {
32+
defaultConfig {
33+
manifestPlaceholders["ADS_APP_ID"] = adsAppId
34+
}
35+
}

android/app/google-services.gradle

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import groovy.json.JsonSlurper
2+
3+
def flutterProjectRoot = rootProject.projectDir.parentFile
4+
def googleServicesJsonFiles = fileTree(dir: '.', include: '**/google-services.json')
5+
def pluginsFile = new File(flutterProjectRoot, '.flutter-plugins-dependencies')
6+
def hasFirebasePlugin = false
7+
8+
if (pluginsFile.exists() && !googleServicesJsonFiles.empty) {
9+
def flutterPlugins = new JsonSlurper().parseText(pluginsFile.text).plugins.android
10+
hasFirebasePlugin = flutterPlugins.any { plugin -> plugin.name.startsWith('firebase_') }
11+
}
12+
13+
if (hasFirebasePlugin) {
14+
println 'Found Firebase plugin, adding Google Services config'
15+
} else {
16+
println 'No Firebase plugins detected, skipping Google Services'
17+
return
18+
}
19+
20+
apply plugin: 'com.google.gms.google-services'
21+
apply plugin: 'com.google.firebase.firebase-perf'
22+
apply plugin: 'com.google.firebase.crashlytics'
23+
24+
android {
25+
buildTypes {
26+
debug {
27+
FirebasePerformance {
28+
instrumentationEnabled false
29+
}
30+
}
31+
release {
32+
firebaseCrashlytics {
33+
mappingFileUploadEnabled true
34+
}
35+
}
36+
}
37+
}
38+
39+
dependencies {
40+
implementation platform('com.google.firebase:firebase-bom:30.3.0')
41+
implementation 'com.google.firebase:firebase-analytics'
42+
}
43+
44+
task generateFirebaseOptions {
45+
enabled = !googleServicesJsonFiles.files.empty
46+
47+
outputs.upToDateWhen {
48+
processDebugGoogleServices.state.upToDate
49+
}
50+
51+
doLast {
52+
logger.info('Updating firebase_options.jsonc...')
53+
54+
def scriptFile = rootProject.file(firebaseOptionsGeneratorScriptPath)
55+
def srcConfigFile = googleServicesJsonFiles.files.first()
56+
def destConfigFile = rootProject.file(firebaseOptionsJsonPath)
57+
58+
def applicationId = android.applicationVariants
59+
.find { variant -> variant.name == 'debug' }
60+
.mergedFlavor
61+
.applicationId
62+
63+
def proc = [
64+
scriptFile,
65+
'--android-app-id',
66+
applicationId,
67+
srcConfigFile,
68+
destConfigFile,
69+
].execute()
70+
71+
def sdout = new StringBuffer()
72+
def sderr = new StringBuffer()
73+
74+
proc.waitForProcessOutput(sdout, sderr)
75+
proc.waitFor()
76+
77+
if (!sdout.empty) {
78+
logger.quiet("${sdout}")
79+
}
80+
81+
if (proc.exitValue() != 0) {
82+
throw new GradleException("Failed to update ${destConfigFile}: ${sderr}")
83+
}
84+
85+
logger.info("Firebase options updated: ${destConfigFile.absolutePath}")
86+
}
87+
}
88+
89+
90+
91+
// tasks.whenTaskAdded { task ->
92+
// if (task.name.contains('processDebugGoogleServices')) {
93+
// task.finalizedBy(generateFirebaseOptions)
94+
// if (googleServicesJsonFiles.empty) {
95+
// task.enabled = false
96+
// }
97+
// } else if (task.name.contains('copyFlutterAssetsDebug')) {
98+
// task.dependsOn(generateFirebaseOptions)
99+
// } else if (task.name.contains('compileFlutterBuild')) {
100+
// task.dependsOn(peitica)
101+
// }
102+
// }

0 commit comments

Comments
 (0)