Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

WIP:set published profileData variable for profileView #155

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mentorship ios/ViewModels/ProfileViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ class ProfileViewModel: ObservableObject {
@Published var updateProfileResponseData = ProfileModel.UpdateProfileResponseData(success: false, message: "")
@Published var inActivity = false
@Published var showAlert = false
@Published var getProfileData: ProfileModel.ProfileData? = nil
var isUpdateProfileData:Bool = false {
didSet {
getProfileData = getProfile()
}
}
var alertTitle = LocalizedStringKey("")

// MARK: - Functions
Expand All @@ -38,6 +44,7 @@ class ProfileViewModel: ObservableObject {
return
}
UserDefaults.standard.set(profileData, forKey: UserDefaultsConstants.profile)
isUpdateProfileData = true
}

//gets profile object from user defaults
Expand Down
2 changes: 1 addition & 1 deletion mentorship ios/Views/Profile/ProfileSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI
struct ProfileSummary: View {
@ObservedObject var profileViewModel = ProfileViewModel()
var profileData: ProfileModel.ProfileData {
return profileViewModel.getProfile()
return profileViewModel.getProfileData ?? profileViewModel.getProfile()
}
@State private var showProfileEditor = false

Expand Down