feat(breaks): Implement Google Maps API key integration and decode Dart defines for both client and staff apps

This commit is contained in:
Achintha Isuru
2026-02-16 13:50:02 -05:00
parent 6ed12a0519
commit 888cf83c18
8 changed files with 96 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import Flutter
import UIKit
import GoogleMaps
@main
@objc class AppDelegate: FlutterAppDelegate {
@@ -7,7 +8,31 @@ import UIKit
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if let apiKey = getDartDefine(key: "GOOGLE_MAPS_API_KEY") {
GMSServices.provideAPIKey(apiKey)
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
private func getDartDefine(key: String) -> String? {
guard let dartDefines = Bundle.main.infoDictionary?["DART_DEFINES"] as? String else {
return nil
}
let defines = dartDefines.components(separatedBy: ",")
for define in defines {
guard let decodedData = Data(base64Encoded: define),
let decodedString = String(data: decodedData, encoding: .utf8) else {
continue
}
let components = decodedString.components(separatedBy: "=")
if components.count == 2 && components[0] == key {
return components[1]
}
}
return nil
}
}

View File

@@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Krow With Us Staff</string>
<string>Krow With Us Staff</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Krow With Us Staff</string>
<string>Krow With Us Staff</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@@ -45,5 +45,7 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>DART_DEFINES</key>
<string>$(DART_DEFINES)</string>
</dict>
</plist>