Skip to content

Commit

Permalink
Merge pull request #29 from appwrite/update-playground
Browse files Browse the repository at this point in the history
feat: update playground
  • Loading branch information
christyjacob4 authored Jun 3, 2023
2 parents b1dddca + 619da3b commit 77bed95
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

android {
compileSdkVersion 32
compileSdkVersion 33

defaultConfig {
applicationId "io.appwrite.playgroundforandroid"
Expand Down Expand Up @@ -36,7 +36,7 @@ android {
}

dependencies {
implementation 'io.appwrite:sdk-for-android:1.1.0'
implementation 'io.appwrite:sdk-for-android:1.2.1'

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.8.0'
Expand Down
8 changes: 2 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="io.appwrite.views.CallbackActivity"
android:exported="true">
<activity android:name="io.appwrite.views.CallbackActivity" android:exported="true">
<intent-filter android:label="android_web_auth">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="appwrite-callback-608fa1dd20ef0" />
<data android:scheme="appwrite-callback-[PROJECT_ID]" />
</intent-filter>
</activity>
</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class PlaygroundViewModel : ViewModel() {
realtime = Realtime(client)
}

private val _user = MutableLiveData<AppwriteAccount?>(null)
val user: LiveData<AppwriteAccount?> = _user
private val _user = MutableLiveData<AppwriteAccount<Any>?>(null)
val user: LiveData<AppwriteAccount<Any>?> = _user

private val _dialogText = MutableLiveData<String?>(null)
val dialogText: LiveData<String?> = _dialogText
Expand All @@ -75,7 +75,7 @@ class PlaygroundViewModel : ViewModel() {
fun createAccount() {
viewModelScope.launch {
try {
val user: AppwriteAccount = account.create(
val user: AppwriteAccount<Any> = account.create(
userId = ID.unique(),
email = "$emailId@appwrite.io",
password = "password"
Expand Down Expand Up @@ -120,7 +120,7 @@ class PlaygroundViewModel : ViewModel() {
fun getAccount() {
viewModelScope.launch {
try {
val user: AppwriteAccount = account.get()
val user: AppwriteAccount<Any> = account.get()
val json = user.toJson()
_dialogText.postValue(json)
_user.postValue(user)
Expand All @@ -144,7 +144,7 @@ class PlaygroundViewModel : ViewModel() {
viewModelScope.launch {
try {
emailId = currentTimeMillis()
val user: AppwriteAccount = account.updateEmail(
val user: AppwriteAccount<Any> = account.updateEmail(
email = "$emailId@email.com",
password = "password"
)
Expand All @@ -160,7 +160,7 @@ class PlaygroundViewModel : ViewModel() {
fun updateAccountPrefs() {
viewModelScope.launch {
try {
val user: AppwriteAccount = account.updatePrefs(
val user: AppwriteAccount<Any> = account.updatePrefs(
mapOf(
"key" to "value"
)
Expand All @@ -177,7 +177,7 @@ class PlaygroundViewModel : ViewModel() {
fun updateStatus() {
viewModelScope.launch {
try {
val user: AppwriteAccount = account.updateStatus()
val user: AppwriteAccount<Any> = account.updateStatus()
val json = user.toJson()
_user.postValue(user)
_dialogText.postValue(json)
Expand All @@ -202,7 +202,7 @@ class PlaygroundViewModel : ViewModel() {
fun createDocument() {
viewModelScope.launch {
try {
val document: Document = databases.createDocument(
val document: Document<Any> = databases.createDocument(
databaseId,
collectionId,
documentId = ID.unique(),
Expand All @@ -227,7 +227,7 @@ class PlaygroundViewModel : ViewModel() {
fun listDocuments() {
viewModelScope.launch {
try {
val documentList: DocumentList = databases.listDocuments(
val documentList: DocumentList<Any> = databases.listDocuments(
databaseId,
collectionId,
queries = listOf(
Expand Down

0 comments on commit 77bed95

Please sign in to comment.