Skip to content

feat: update playground #29

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 3, 2023
Merged
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
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ plugins {
}

android {
compileSdkVersion 32
compileSdkVersion 33

defaultConfig {
applicationId "io.appwrite.playgroundforandroid"
@@ -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'
8 changes: 2 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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
@@ -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"
@@ -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)
@@ -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"
)
@@ -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"
)
@@ -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)
@@ -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(),
@@ -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(