plugins {
    id "com.android.application"
    // (Firebase, Google Services 필요 시)
    id 'com.google.gms.google-services'
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('app/key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    namespace = "com.allscore_app"
    compileSdkVersion 34

    defaultConfig {
        applicationId "com.allscore_app"
        minSdkVersion 23
        targetSdkVersion 34
        versionCode 12
        versionName "1.0.12"
    }
    // ...

    signingConfigs {
        release {
            // key.properties 에서 키 불러오기
            keyAlias keystoreProperties["keyAlias"]
            keyPassword keystoreProperties["keyPassword"]
            storeFile keystoreProperties["storeFile"] ? file(keystoreProperties["storeFile"]) : null
            storePassword keystoreProperties["storePassword"]
        }
    }

    buildTypes {
        release {
            // signingConfig signingConfigs.debug
            // 코드 난독화, 리소스 축소 등 필요 시 설정
            minifyEnabled false
            shrinkResources false
            // (중요) release 시 signing 적용
            signingConfig signingConfigs.release
        }
        debug {
            // 기본 debug 서명
        }
    }
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17
    }
}

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

dependencies {
    // 기존 의존성 유지
    implementation 'com.google.android.gms:play-services-auth:20.6.0'
    implementation 'com.google.android.gms:play-services-ads:23.6.0'
    
    // Firebase BOM
    implementation platform('com.google.firebase:firebase-bom:32.7.1')
    
    // Firebase 제품들은 버전을 지정하지 않아도 됩니다
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-analytics'
}

// (Firebase Auth, Crashlytics 등을 사용한다면, 아래 구문이 필요할 수 있습니다.)
apply plugin: 'com.google.gms.google-services'
