Skip to content

Commit

Permalink
feat(iosApp): use Info.plist file to inject base url and default event.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed May 10, 2024
1 parent 982f067 commit 5c5e8ca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Binary file not shown.
4 changes: 4 additions & 0 deletions iosApp/iosApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BASE_URL_C4H</key>
<string>https://cms4partners-ce427.nw.r.appspot.com</string>
<key>DEFAULT_EVENT</key>
<string>devfest-lille-2024</string>
<key>BASE_URL</key>
<string>${BASE_URL}</string>
<key>CFBundleDevelopmentRegion</key>
Expand Down
3 changes: 2 additions & 1 deletion iosApp/iosApp/screens/app/AppViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class AppViewModel: ObservableObject {
@Published var uiState: AppUiState = AppUiState.loading

func fetchEventId() {
self.uiState = repository.isInitialized() ? .agenda : .events
let defaultEvent = Bundle.main.object(forInfoDictionaryKey: "DEFAULT_EVENT") as! String
self.uiState = repository.isInitialized(defaultEvent: defaultEvent) ? .agenda : .events
}

func saveEventId(eventId: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import org.koin.core.component.inject
import org.koin.core.context.startKoin
import org.koin.core.qualifier.named
import org.koin.dsl.module
import platform.Foundation.NSBundle

val buildConfigModule = module {
single(named(IsDebugNamed)) { false }
single(named(ApplicationIdNamed)) { "org.gdglille.devfest.ios" }
single(named(Conference4HallBaseUrlNamed)) { "https://cms4partners-ce427.nw.r.appspot.com" }
single(named(Conference4HallBaseUrlNamed)) {
NSBundle.mainBundle.objectForInfoDictionaryKey(key = "BASE_URL_C4H") as String
}
}

class RepositoryHelper : KoinComponent {
Expand Down

0 comments on commit 5c5e8ca

Please sign in to comment.