diff --git a/iosApp/FeedFlow.xcodeproj/project.pbxproj b/iosApp/FeedFlow.xcodeproj/project.pbxproj index 88da2863..d333e6cb 100644 --- a/iosApp/FeedFlow.xcodeproj/project.pbxproj +++ b/iosApp/FeedFlow.xcodeproj/project.pbxproj @@ -977,7 +977,7 @@ shared, "-lsqlite3", ); - PRODUCT_BUNDLE_IDENTIFIER = com.prof18.feedflow.debug; + PRODUCT_BUNDLE_IDENTIFIER = com.prof18.feedflow.dev; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/iosApp/Info.plist b/iosApp/Info.plist index 7fa3efcb..b05028df 100644 --- a/iosApp/Info.plist +++ b/iosApp/Info.plist @@ -27,8 +27,21 @@ $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString VERSION_NAME + CFBundleURLTypes + + + CFBundleURLName + + CFBundleURLSchemes + + $(DROPBOX_URL_SCHEME) + + + CFBundleVersion VERSION_CODE + DropboxApiKey + $(DROPBOX_API_KEY) ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes @@ -39,8 +52,8 @@ brave googlechromes firefox-focus - dbapi-8-emm - dbapi-2 + dbapi-8-emm + dbapi-2 LSRequiresIPhoneOS @@ -49,6 +62,18 @@ NSAllowsArbitraryLoads + NSUbiquitousContainers + + iCloud.com.prof18.feedflow + + NSUbiquitousContainerIsDocumentScopePublic + + NSUbiquitousContainerName + FeedFlow + NSUbiquitousContainerSupportedFolderLevels + Any + + UIApplicationSceneManifest UIApplicationSupportsMultipleScenes @@ -73,30 +98,5 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - CFBundleURLTypes - - - CFBundleURLSchemes - - $(DROPBOX_URL_SCHEME) - - CFBundleURLName - - - - DropboxApiKey - $(DROPBOX_API_KEY) - NSUbiquitousContainers - - iCloud.com.prof18.feedflow - - NSUbiquitousContainerIsDocumentScopePublic - - NSUbiquitousContainerName - FeedFlow - NSUbiquitousContainerSupportedFolderLevels - Any - - diff --git a/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/di/KoinIOS.kt b/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/di/KoinIOS.kt index 538c7ae3..e9f8c45f 100644 --- a/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/di/KoinIOS.kt +++ b/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/di/KoinIOS.kt @@ -126,6 +126,7 @@ internal actual fun getPlatformModule(appEnvironment: AppEnvironment): Module = accountsRepository = get(), feedSyncMessageQueue = get(), feedSyncRepository = get(), + feedRetrieverRepository = get(), ) } } diff --git a/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/presentation/ICloudSyncViewModel.kt b/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/presentation/ICloudSyncViewModel.kt index f9436638..448f2f2e 100644 --- a/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/presentation/ICloudSyncViewModel.kt +++ b/shared/src/iosMain/kotlin/com/prof18/feedflow/shared/presentation/ICloudSyncViewModel.kt @@ -4,6 +4,7 @@ import com.prof18.feedflow.core.model.AccountConnectionUiState import com.prof18.feedflow.core.model.AccountSyncUIState import com.prof18.feedflow.feedsync.icloud.ICloudSettings import com.prof18.feedflow.shared.domain.DateFormatter +import com.prof18.feedflow.shared.domain.feed.retriever.FeedRetrieverRepository import com.prof18.feedflow.shared.domain.feedsync.AccountsRepository import com.prof18.feedflow.shared.domain.feedsync.FeedSyncMessageQueue import com.prof18.feedflow.shared.domain.feedsync.FeedSyncRepository @@ -20,6 +21,7 @@ class ICloudSyncViewModel internal constructor( private val dateFormatter: DateFormatter, private val accountsRepository: AccountsRepository, private val feedSyncRepository: FeedSyncRepository, + private val feedRetrieverRepository: FeedRetrieverRepository, feedSyncMessageQueue: FeedSyncMessageQueue, ) : BaseViewModel() { @@ -38,20 +40,20 @@ class ICloudSyncViewModel internal constructor( } fun setICloudAuth() { - iCloudSettings.setUseICloud(true) - accountsRepository.setICloudAccount() - iCloudSyncUiMutableState.update { - AccountConnectionUiState.Linked( - syncState = getSyncState(), - ) + scope.launch { + iCloudSettings.setUseICloud(true) + accountsRepository.setICloudAccount() + iCloudSyncUiMutableState.update { + AccountConnectionUiState.Linked( + syncState = getSyncState(), + ) + } + emitSyncLoading() + accountsRepository.setICloudAccount() + feedSyncRepository.firstSync() + feedRetrieverRepository.fetchFeeds() + emitLastSyncUpdate() } - /* - emitSyncLoading() - accountsRepository.setDropboxAccount() - feedSyncRepository.firstSync() - feedRetrieverRepository.fetchFeeds() - emitLastSyncUpdate() - */ } fun triggerBackup() { @@ -63,11 +65,12 @@ class ICloudSyncViewModel internal constructor( } fun unlink() { - iCloudSettings.setUseICloud(false) -// feedSyncRepository.deleteAll() - accountsRepository.clearAccount() - iCloudSyncUiMutableState.update { - AccountConnectionUiState.Unlinked + scope.launch { + iCloudSyncUiMutableState.update { AccountConnectionUiState.Loading } + iCloudSettings.setUseICloud(false) + feedSyncRepository.deleteAll() + accountsRepository.clearAccount() + iCloudSyncUiMutableState.update { AccountConnectionUiState.Unlinked } } }