-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
667 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/datasource/MainDataStore.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package kr.co.lion.mungnolza.datasource | ||
|
||
import android.content.Context | ||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.booleanPreferencesKey | ||
import androidx.datastore.preferences.core.edit | ||
import androidx.datastore.preferences.core.stringPreferencesKey | ||
import androidx.datastore.preferences.preferencesDataStore | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
import kr.co.lion.mungnolza.util.App | ||
|
||
|
||
object MainDataStore { | ||
private fun getContext(): Context = App.context() | ||
|
||
private val mDataStore: DataStore<Preferences> | ||
get() = getContext().dataStore | ||
|
||
private val Context.dataStore : DataStore<Preferences> by preferencesDataStore("user_pref") | ||
private val FIRST_FLAG = booleanPreferencesKey("FIRST_FLAG") | ||
private val USER_NUMBER = stringPreferencesKey("USER_NUMBER") | ||
|
||
suspend fun setupFirstData(){ | ||
mDataStore.edit { pref -> | ||
pref[FIRST_FLAG] = true | ||
} | ||
} | ||
|
||
suspend fun getFirstFlag(): Boolean{ | ||
var currentValue = false | ||
|
||
mDataStore.edit { pref-> | ||
currentValue = pref[FIRST_FLAG] ?: false | ||
} | ||
|
||
return currentValue | ||
} | ||
|
||
suspend fun setUserNumber(uniqueNumber: String){ | ||
mDataStore.edit { pref-> | ||
pref[USER_NUMBER] = uniqueNumber | ||
} | ||
} | ||
|
||
fun getUserNumber(): Flow<String> { | ||
return mDataStore.data.map { preferences -> | ||
preferences[USER_NUMBER] ?: "" | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/model/BoardAddUerInfoModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package kr.co.lion.mungnolza.model | ||
|
||
import android.net.Uri | ||
import java.net.URI | ||
|
||
data class BoardAddUerInfoModel ( | ||
val contentData: BoardModel, | ||
val writerNickName: String, | ||
val imgUri: Uri | ||
val imgUri: URI | ||
) |
12 changes: 12 additions & 0 deletions
12
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/model/PetImgModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package kr.co.lion.mungnolza.model | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.parcelize.RawValue | ||
import java.net.URI | ||
|
||
@Parcelize | ||
data class PetImgModel ( | ||
val petInfo: @RawValue PetModel, | ||
val imgUrl: URI | ||
): Parcelable |
29 changes: 29 additions & 0 deletions
29
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/model/PetModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package kr.co.lion.mungnolza.model | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
data class PetModel ( | ||
val ownerIdx: String, | ||
val petName: String, | ||
val petBreed: String, | ||
val petGender: String, | ||
val petWeight: String, | ||
val petAge: String, | ||
val isNeutering: Boolean, | ||
val petSignificant: String, | ||
val imgName: String | ||
): Parcelable { | ||
constructor(): this( | ||
ownerIdx = "", | ||
petName = "", | ||
petBreed = "", | ||
petGender = "", | ||
petWeight = "", | ||
petAge = "", | ||
isNeutering = true, | ||
petSignificant = "", | ||
imgName = "" | ||
) | ||
} |
24 changes: 14 additions & 10 deletions
24
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/model/UserModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/repository/FreeBoardRepository.kt
This file was deleted.
Oops, something went wrong.
84 changes: 0 additions & 84 deletions
84
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/repository/FreeBoardRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/repository/UserRepository.kt
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/repository/UserRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/repository/freeboard/FreeBoardRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package kr.co.lion.mungnolza.repository.freeboard | ||
|
||
import java.net.URI | ||
import kr.co.lion.mungnolza.model.BoardModel | ||
|
||
interface FreeBoardRepository { | ||
suspend fun fetchAllBoardData(): List<BoardModel> | ||
suspend fun fetchAllBoardImage(boardIdx: String, imgName: String): URI? | ||
} |
Oops, something went wrong.