From 705c76be70abae7eaa150a6ded24cad801ce58fb Mon Sep 17 00:00:00 2001 From: Kevin Galligan Date: Mon, 22 Jul 2019 22:53:14 -0400 Subject: [PATCH 1/6] Adding first functional version --- .idea/gradle.xml | 1 + app/build.gradle | 17 +- app/src/main/AndroidManifest.xml | 1 - .../firebase/firestore/MainActivity.kt | 45 ++ .../firebase/firestore/test/MainActivity.kt | 19 - app/src/main/res/layout/activity_main.xml | 52 +- .../main/res/layout/edit_event_fragment.xml | 234 --------- app/src/main/res/layout/event_card.xml | 80 ---- .../res/layout/event_details_fragment.xml | 14 - app/src/main/res/layout/home_fragment.xml | 15 - app/src/main/res/layout/item_event_button.xml | 20 - .../main/res/layout/item_event_categories.xml | 23 - app/src/main/res/layout/item_event_header.xml | 22 - app/src/main/res/layout/item_event_rsvps.xml | 31 -- app/src/main/res/layout/item_event_save.xml | 57 --- app/src/main/res/layout/item_event_text.xml | 32 -- .../main/res/layout/my_events_fragment.xml | 16 - app/src/main/res/layout/my_rsvp_fragment.xml | 14 - app/src/main/res/layout/search_fragment.xml | 14 - app/src/main/res/layout/tag_card.xml | 27 -- build.gradle | 27 +- buildlibrary.sh | 7 + firestore/build.gradle | 58 ++- .../firestore/DocumentReferenceJVM.kt | 15 +- .../firebase/firestore/initFirestore.kt | 5 - .../firebase/firestore/DocumentReference.kt | 18 +- .../co/touchlab/firebase/firestore/Query.kt | 66 ++- .../touchlab/firebase/firestore/Platform.kt | 3 - .../src/iosMain/c_interop/FirebaseCore.def | 4 + .../iosMain/c_interop/FirebaseFirestore.def | 4 + .../FirebaseCore.framework/Headers/FIRApp.h | 127 +++++ .../Headers/FIRConfiguration.h | 45 ++ .../Headers/FIRLoggerLevel.h | 38 ++ .../Headers/FIROptions.h | 116 +++++ .../Headers/FirebaseCore-umbrella.h | 21 + .../Headers/FirebaseCore.h | 20 + .../FirebaseCore.framework/Info.plist | Bin 0 -> 775 bytes .../Modules/module.modulemap | 6 + .../FIRAnalyticsConfiguration.h | 56 +++ .../FIRAppAssociationRegistration.h | 49 ++ .../PrivateHeaders/FIRAppInternal.h | 180 +++++++ .../PrivateHeaders/FIRBundleUtil.h | 53 +++ .../PrivateHeaders/FIRComponent.h | 91 ++++ .../PrivateHeaders/FIRComponentContainer.h | 44 ++ .../FIRComponentContainerInternal.h | 43 ++ .../PrivateHeaders/FIRComponentType.h | 34 ++ .../PrivateHeaders/FIRConfigurationInternal.h | 29 ++ .../PrivateHeaders/FIRDependency.h | 45 ++ .../PrivateHeaders/FIRErrorCode.h | 38 ++ .../PrivateHeaders/FIRErrors.h | 24 + .../PrivateHeaders/FIRLibrary.h | 44 ++ .../PrivateHeaders/FIRLogger.h | 151 ++++++ .../PrivateHeaders/FIROptionsInternal.h | 114 +++++ .../PrivateHeaders/FIRVersion.h | 23 + .../_CodeSignature/CodeDirectory | Bin 0 -> 155 bytes .../_CodeSignature/CodeRequirements | Bin 0 -> 12 bytes .../_CodeSignature/CodeRequirements-1 | Bin 0 -> 203 bytes .../_CodeSignature/CodeResources | 447 ++++++++++++++++++ .../_CodeSignature/CodeSignature | 0 .../Headers/FIRCollectionReference.h | 100 ++++ .../Headers/FIRDocumentChange.h | 68 +++ .../Headers/FIRDocumentReference.h | 261 ++++++++++ .../Headers/FIRDocumentSnapshot.h | 180 +++++++ .../Headers/FIRFieldPath.h | 48 ++ .../Headers/FIRFieldValue.h | 95 ++++ .../Headers/FIRFirestore.h | 181 +++++++ .../Headers/FIRFirestoreErrors.h | 103 ++++ .../Headers/FIRFirestoreSettings.h | 82 ++++ .../Headers/FIRFirestoreSource.h | 48 ++ .../Headers/FIRGeoPoint.h | 47 ++ .../Headers/FIRListenerRegistration.h | 33 ++ .../Headers/FIRQuery.h | 439 +++++++++++++++++ .../Headers/FIRQuerySnapshot.h | 73 +++ .../Headers/FIRSnapshotMetadata.h | 46 ++ .../Headers/FIRTimestamp.h | 82 ++++ .../Headers/FIRTransaction.h | 127 +++++ .../Headers/FIRWriteBatch.h | 135 ++++++ .../Headers/FirebaseFirestore-umbrella.h | 35 ++ .../Headers/FirebaseFirestore.h | 33 ++ .../FirebaseFirestore.framework/Info.plist | Bin 0 -> 787 bytes .../Modules/module.modulemap | 6 + .../_CodeSignature/CodeDirectory | Bin 0 -> 160 bytes .../_CodeSignature/CodeRequirements | Bin 0 -> 12 bytes .../_CodeSignature/CodeRequirements-1 | Bin 0 -> 208 bytes .../_CodeSignature/CodeResources | 417 ++++++++++++++++ .../_CodeSignature/CodeSignature | 0 .../firebase/firestore/DocumentReference.kt | 22 +- .../firebase/firestore/initFirestore.kt | 9 - .../co/touchlab/testing/AndroidJUnit4.kt | 0 gradle.properties | 22 +- gradle/gradle-mvn-mpp-push.gradle | 96 ++++ .../UserInterfaceState.xcuserstate | Bin 64129 -> 37024 bytes settings.gradle | 2 +- 93 files changed, 4826 insertions(+), 743 deletions(-) create mode 100644 app/src/main/java/co/touchlab/firebase/firestore/MainActivity.kt delete mode 100644 app/src/main/java/co/touchlab/firebase/firestore/test/MainActivity.kt delete mode 100644 app/src/main/res/layout/edit_event_fragment.xml delete mode 100644 app/src/main/res/layout/event_card.xml delete mode 100644 app/src/main/res/layout/event_details_fragment.xml delete mode 100644 app/src/main/res/layout/home_fragment.xml delete mode 100644 app/src/main/res/layout/item_event_button.xml delete mode 100644 app/src/main/res/layout/item_event_categories.xml delete mode 100644 app/src/main/res/layout/item_event_header.xml delete mode 100644 app/src/main/res/layout/item_event_rsvps.xml delete mode 100644 app/src/main/res/layout/item_event_save.xml delete mode 100644 app/src/main/res/layout/item_event_text.xml delete mode 100644 app/src/main/res/layout/my_events_fragment.xml delete mode 100644 app/src/main/res/layout/my_rsvp_fragment.xml delete mode 100644 app/src/main/res/layout/search_fragment.xml delete mode 100644 app/src/main/res/layout/tag_card.xml create mode 100755 buildlibrary.sh delete mode 100644 firestore/src/androidMain/kotlin/co/touchlab/firebase/firestore/initFirestore.kt delete mode 100644 firestore/src/commonTest/kotlin/co/touchlab/firebase/firestore/Platform.kt create mode 100644 firestore/src/iosMain/c_interop/FirebaseCore.def create mode 100644 firestore/src/iosMain/c_interop/FirebaseFirestore.def create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Headers/FIRApp.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Headers/FIRConfiguration.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Headers/FIRLoggerLevel.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Headers/FIROptions.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Headers/FirebaseCore-umbrella.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Headers/FirebaseCore.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Info.plist create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/Modules/module.modulemap create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRAnalyticsConfiguration.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRAppAssociationRegistration.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRAppInternal.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRBundleUtil.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRComponent.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRComponentContainer.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRComponentContainerInternal.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRComponentType.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRConfigurationInternal.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRDependency.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRErrorCode.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRErrors.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRLibrary.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRLogger.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIROptionsInternal.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/PrivateHeaders/FIRVersion.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/_CodeSignature/CodeDirectory create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/_CodeSignature/CodeRequirements create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/_CodeSignature/CodeRequirements-1 create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/_CodeSignature/CodeResources create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseCore-6.0.2/FirebaseCore.framework/_CodeSignature/CodeSignature create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRCollectionReference.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRDocumentChange.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRDocumentReference.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRDocumentSnapshot.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRFieldPath.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRFieldValue.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRFirestore.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRFirestoreErrors.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRFirestoreSettings.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRFirestoreSource.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRGeoPoint.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRListenerRegistration.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRQuery.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRQuerySnapshot.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRSnapshotMetadata.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRTimestamp.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRTransaction.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FIRWriteBatch.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FirebaseFirestore-umbrella.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Headers/FirebaseFirestore.h create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Info.plist create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/Modules/module.modulemap create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/_CodeSignature/CodeDirectory create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/_CodeSignature/CodeRequirements create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/_CodeSignature/CodeRequirements-1 create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/_CodeSignature/CodeResources create mode 100644 firestore/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2/FirebaseFirestore.framework/_CodeSignature/CodeSignature delete mode 100644 firestore/src/iosTest/kotlin/co/touchlab/firebase/firestore/initFirestore.kt rename firestore/src/{iosMain => iosTest}/kotlin/co/touchlab/testing/AndroidJUnit4.kt (100%) create mode 100644 gradle/gradle-mvn-mpp-push.gradle diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 740b807..c7d41fe 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -9,6 +9,7 @@ diff --git a/app/build.gradle b/app/build.gradle index bd79989..e24dda8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,17 +1,12 @@ apply plugin: 'com.android.application' - apply plugin: 'kotlin-android' - apply plugin: 'kotlin-android-extensions' -apply plugin: 'androidx.navigation.safeargs' - - android { compileSdkVersion 28 - buildToolsVersion "29.0.0" + buildToolsVersion "29.0.1" defaultConfig { - applicationId "co.touchlab.firebase.firestore.test" + applicationId "co.touchlab.firebase.firestore" minSdkVersion 21 targetSdkVersion 28 versionCode 1 @@ -41,18 +36,16 @@ dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0' + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0-RC" testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' - implementation "androidx.navigation:navigation-fragment-ktx:2.1.0-alpha06" - implementation "androidx.navigation:navigation-ui-ktx:2.1.0-alpha06" - implementation 'com.google.firebase:firebase-firestore:20.1.0' - implementation 'com.google.firebase:firebase-core:17.0.0' + implementation 'com.google.firebase:firebase-core:17.0.1' - implementation project(':firebase') + implementation project(':firestore') } apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4c34a1a..51ad924 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,7 +9,6 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" - android:name=".MainApp" > diff --git a/app/src/main/java/co/touchlab/firebase/firestore/MainActivity.kt b/app/src/main/java/co/touchlab/firebase/firestore/MainActivity.kt new file mode 100644 index 0000000..0a16fc2 --- /dev/null +++ b/app/src/main/java/co/touchlab/firebase/firestore/MainActivity.kt @@ -0,0 +1,45 @@ +package co.touchlab.firebase.firestore + +import android.os.Bundle +import android.widget.ArrayAdapter +import android.widget.Button +import android.widget.ListView +import androidx.appcompat.app.AppCompatActivity +import kotlinx.coroutines.* +import kotlinx.coroutines.flow.FlowCollector + + +class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() { + + private val flow = getFirebaseInstance().collection("testdata") + .asFlow() + + @InternalCoroutinesApi + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + launch { + flow.collect(object : FlowCollector { + override suspend fun emit(value: QuerySnapshot) { + findViewById(R.id.games).adapter = + ArrayAdapter( + this@MainActivity, + android.R.layout.simple_list_item_1, + value.documents.map { it.data?.get("name") as String? } + .filterNotNull() + ) + + } + }) + } + + findViewById