├── .gitignore ├── .idea └── runConfigurations.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── google-services.json ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── tapglue │ │ └── example │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── tapglue │ │ │ └── example │ │ │ ├── MainActivity.java │ │ │ └── PasswordHasher.java │ └── res │ │ ├── layout │ │ ├── activity_main.xml │ │ └── content_main.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── tapglue │ └── example │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle ├── tapglue-android-sdk ├── .gitignore ├── build.gradle ├── distribution │ ├── bintray.gradle │ └── maven.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── tapglue │ │ └── android │ │ ├── CommentIntegrationTest.java │ │ ├── ConnectionIntegrationTest.java │ │ ├── FeedIntegrationTest.java │ │ ├── IntegrationObserver.java │ │ ├── LikeIntegrationTest.java │ │ ├── LoginIntegrationTest.java │ │ ├── PasswordHasher.java │ │ ├── PostIntegrationTest.java │ │ ├── RxLoginIntegrationTest.java │ │ └── TestData.java │ ├── integration-test │ └── java │ │ └── com │ │ └── tapglue │ │ └── tapgluesdk │ │ └── TapglueIntegrationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── tapglue │ │ │ └── android │ │ │ ├── Configuration.java │ │ │ ├── RxPage.java │ │ │ ├── RxTapglue.java │ │ │ ├── RxWrapper.java │ │ │ ├── Tapglue.java │ │ │ ├── TapglueSchedulers.java │ │ │ ├── entities │ │ │ ├── Comment.java │ │ │ ├── Connection.java │ │ │ ├── ConnectionList.java │ │ │ ├── Event.java │ │ │ ├── Follow.java │ │ │ ├── Friend.java │ │ │ ├── Like.java │ │ │ ├── NewsFeed.java │ │ │ ├── Post.java │ │ │ ├── Reaction.java │ │ │ └── User.java │ │ │ ├── http │ │ │ ├── ApiPage.java │ │ │ ├── Base64Encoder.java │ │ │ ├── ClientFactory.java │ │ │ ├── CommentsFeed.java │ │ │ ├── ConnectionsFeed.java │ │ │ ├── ErrorFeed.java │ │ │ ├── ErrorInterceptor.java │ │ │ ├── EventFeedToList.java │ │ │ ├── EventListFeed.java │ │ │ ├── FlattenableFeed.java │ │ │ ├── HeaderInterceptor.java │ │ │ ├── LikesFeed.java │ │ │ ├── LikesFeedToList.java │ │ │ ├── Network.java │ │ │ ├── PaginatedService.java │ │ │ ├── PaginationInterceptor.java │ │ │ ├── PostFeedToList.java │ │ │ ├── PostListFeed.java │ │ │ ├── RawNewsFeed.java │ │ │ ├── ServiceFactory.java │ │ │ ├── TapglueError.java │ │ │ ├── TapglueService.java │ │ │ ├── UsersFeed.java │ │ │ └── payloads │ │ │ │ ├── EmailLoginPayload.java │ │ │ │ ├── EmailSearchPayload.java │ │ │ │ ├── SocialConnections.java │ │ │ │ ├── SocialSearchPayload.java │ │ │ │ └── UsernameLoginPayload.java │ │ │ ├── internal │ │ │ ├── NotificationServiceIdStore.java │ │ │ ├── SessionStore.java │ │ │ ├── Store.java │ │ │ ├── UUIDStore.java │ │ │ └── UserStore.java │ │ │ └── sims │ │ │ ├── DevicePayload.java │ │ │ ├── NotificationServiceIdListener.java │ │ │ ├── SimsIdListenerService.java │ │ │ ├── SimsMessagingService.java │ │ │ ├── SimsService.java │ │ │ ├── SimsServiceFactory.java │ │ │ └── TapglueSims.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── tapglue │ └── android │ ├── ConfigurationTest.java │ ├── RxTapglueTest.java │ ├── RxWrapperTest.java │ ├── TapglueSchedulersTest.java │ ├── TapglueTest.java │ ├── http │ ├── ClientFactoryTest.java │ ├── CommentsFeedTest.java │ ├── ConnectionFeedTest.java │ ├── ErrorInterceptorTest.java │ ├── EventListFeedTest.java │ ├── HeaderInterceptorTest.java │ ├── LikesFeedTest.java │ ├── NetworkTest.java │ ├── PostFeedToListTest.java │ ├── RawNewsFeedTest.java │ ├── ServiceFactoryTest.java │ └── payloads │ │ ├── EmailLoginPayloadTest.java │ │ ├── EmailSearchPayloadTest.java │ │ ├── SocialConnectionsTest.java │ │ └── UsernameLoginPayloadTest.java │ ├── internal │ ├── NotificationServiceIdStoreTest.java │ ├── SessionStoreTest.java │ ├── StoreTest.java │ ├── TestEntity.java │ ├── UUIDStoreTest.java │ └── UserStoreTest.java │ └── sims │ └── TapglueSimsTest.java └── v1 ├── LICENSE ├── README.md ├── app ├── .gitignore ├── README.md ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── tapglue │ │ └── tapgluetests │ │ └── ActivityTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── tapglue │ │ │ └── tapgluetests │ │ │ ├── TestActivity.java │ │ │ ├── TestApplication.java │ │ │ └── TestController.java │ └── res │ │ ├── layout │ │ └── activity_test.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── tapglue │ └── tapgluetests │ └── ExampleUnitTest.java ├── build.gradle ├── circle.yml ├── gradle.properties ├── gradle ├── lint.xml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── install_deps.sh ├── run_tests.sh ├── settings.gradle └── tapglue-android-sdk ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── vcs.xml └── workspace.xml ├── README.md ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── proguard-rules.pro ├── src ├── androidTest │ └── java │ │ └── com │ │ └── tapglue │ │ ├── ApplicationTest.java │ │ ├── networking │ │ └── TGCustomCacheObjectTest.java │ │ └── utils │ │ └── TGPasswordHasherTest.java ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── tapglue │ │ ├── Tapglue.java │ │ ├── managers │ │ ├── AbstractTGManager.java │ │ ├── TGConnectionManager.java │ │ ├── TGConnectionManagerImpl.java │ │ ├── TGEventManager.java │ │ ├── TGEventManagerImpl.java │ │ ├── TGFeedManager.java │ │ ├── TGFeedManagerImpl.java │ │ ├── TGPostManager.java │ │ ├── TGPostManagerImpl.java │ │ ├── TGRecommendationManager.java │ │ ├── TGRecommendationManagerImpl.java │ │ ├── TGUserManager.java │ │ └── TGUserManagerImpl.java │ │ ├── model │ │ ├── TGAttachment.java │ │ ├── TGBaseObject.java │ │ ├── TGBaseObjectWithId.java │ │ ├── TGComment.java │ │ ├── TGCommentsList.java │ │ ├── TGConnection.java │ │ ├── TGError.java │ │ ├── TGErrorList.java │ │ ├── TGEvent.java │ │ ├── TGEventObject.java │ │ ├── TGEventsList.java │ │ ├── TGFeed.java │ │ ├── TGFeedCount.java │ │ ├── TGImage.java │ │ ├── TGLike.java │ │ ├── TGLikesList.java │ │ ├── TGLoginUser.java │ │ ├── TGPendingConnections.java │ │ ├── TGPost.java │ │ ├── TGPostsList.java │ │ ├── TGRecommendedUsers.java │ │ ├── TGSearchCriteria.java │ │ ├── TGSocialConnections.java │ │ ├── TGUser.java │ │ ├── TGUsersList.java │ │ ├── TGVisibility.java │ │ └── queries │ │ │ ├── TGQuery.java │ │ │ ├── TGQueryObjectField.java │ │ │ ├── TGQueryScalarField.java │ │ │ └── TGQueryTGObject.java │ │ ├── networking │ │ ├── TGApi.java │ │ ├── TGCacheRequest.java │ │ ├── TGCustomCacheObject.java │ │ ├── TGNetworkManager.java │ │ ├── TGRequest.java │ │ ├── TGRequests.java │ │ ├── TGRequestsImpl.java │ │ └── requests │ │ │ ├── TGRequestCallback.java │ │ │ ├── TGRequestErrorType.java │ │ │ └── TGRequestType.java │ │ └── utils │ │ ├── TGErrorUtil.java │ │ ├── TGLog.java │ │ └── TGPasswordHasher.java └── test │ └── java │ └── com │ └── tapglue │ └── ExampleUnitTest.java └── tapglue-android-sdk ├── README.md ├── android_sdk.iml ├── build.gradle ├── proguard-rules.pro ├── src ├── androidTest │ └── java │ │ └── com │ │ └── tapglue │ │ ├── ApplicationTest.java │ │ ├── networking │ │ └── TGCustomCacheObjectTest.java │ │ └── utils │ │ └── TGPasswordHasherTest.java ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── tapglue │ │ ├── Tapglue.java │ │ ├── managers │ │ ├── AbstractTGManager.java │ │ ├── TGConnectionManager.java │ │ ├── TGConnectionManagerImpl.java │ │ ├── TGEventManager.java │ │ ├── TGEventManagerImpl.java │ │ ├── TGFeedManager.java │ │ ├── TGFeedManagerImpl.java │ │ ├── TGPostManager.java │ │ ├── TGPostManagerImpl.java │ │ ├── TGRecommendationManager.java │ │ ├── TGRecommendationManagerImpl.java │ │ ├── TGUserManager.java │ │ └── TGUserManagerImpl.java │ │ ├── model │ │ ├── TGAttachment.java │ │ ├── TGBaseObject.java │ │ ├── TGBaseObjectWithId.java │ │ ├── TGComment.java │ │ ├── TGCommentsList.java │ │ ├── TGConnection.java │ │ ├── TGError.java │ │ ├── TGErrorList.java │ │ ├── TGEvent.java │ │ ├── TGEventObject.java │ │ ├── TGEventsList.java │ │ ├── TGFeed.java │ │ ├── TGFeedCount.java │ │ ├── TGImage.java │ │ ├── TGLike.java │ │ ├── TGLikesList.java │ │ ├── TGLoginUser.java │ │ ├── TGPendingConnections.java │ │ ├── TGPost.java │ │ ├── TGPostsList.java │ │ ├── TGRecommendedUsers.java │ │ ├── TGSearchCriteria.java │ │ ├── TGSocialConnections.java │ │ ├── TGUser.java │ │ ├── TGUsersList.java │ │ ├── TGVisibility.java │ │ └── queries │ │ │ ├── TGQuery.java │ │ │ ├── TGQueryObjectField.java │ │ │ ├── TGQueryScalarField.java │ │ │ └── TGQueryTGObject.java │ │ ├── networking │ │ ├── TGApi.java │ │ ├── TGCacheRequest.java │ │ ├── TGCustomCacheObject.java │ │ ├── TGNetworkManager.java │ │ ├── TGRequest.java │ │ ├── TGRequests.java │ │ ├── TGRequestsImpl.java │ │ └── requests │ │ │ ├── TGRequestCallback.java │ │ │ ├── TGRequestErrorType.java │ │ │ └── TGRequestType.java │ │ └── utils │ │ ├── TGErrorUtil.java │ │ ├── TGLog.java │ │ └── TGPasswordHasher.java └── test │ └── java │ └── com │ └── tapglue │ └── ExampleUnitTest.java └── tapglue.iml /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | */build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | .idea/workspace.xml 35 | .idea/modules.xml 36 | .idea/misc.xml 37 | .idea/gradle.xml 38 | .idea/compiler.xml 39 | .idea/shelf/ 40 | .idea/libraries/ 41 | .idea/copyright/ 42 | .idea/.name 43 | .idea/*.xml 44 | .idea/** 45 | app/app.iml 46 | tapglue-android-sdk/tapglue-android-sdk.iml 47 | *.iml 48 | 49 | #file system 50 | .DS_Store 51 | sdk/.DS_Store 52 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.getkeepsafe.dexcount' 3 | 4 | android { 5 | compileSdkVersion 23 6 | buildToolsVersion "23.0.3" 7 | 8 | defaultConfig { 9 | applicationId "com.tapglue.example" 10 | minSdkVersion 15 11 | targetSdkVersion 23 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | testCompile 'junit:junit:4.12' 26 | compile 'com.android.support:appcompat-v7:23.2.1' 27 | compile 'com.android.support:design:23.2.1' 28 | compile 'io.reactivex:rxandroid:1.1.0' 29 | compile 'io.reactivex:rxjava:1.1.2' 30 | compile project(':tapglue-android-sdk') 31 | } 32 | apply plugin: 'com.google.gms.google-services' 33 | -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "658935390011", 4 | "firebase_url": "https://sims-example.firebaseio.com", 5 | "project_id": "sims-example", 6 | "storage_bucket": "sims-example.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:658935390011:android:cb409d7eaa838d78", 12 | "android_client_info": { 13 | "package_name": "com.tapglue.example" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "658935390011-ibqkngilb0ebkh08fevm4e3a82s4r7vf.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyBUg3-0IqoP5B4TycFL_mM3HQejo1wQJTA" 25 | } 26 | ], 27 | "services": { 28 | "analytics_service": { 29 | "status": 1 30 | }, 31 | "appinvite_service": { 32 | "status": 1, 33 | "other_platform_oauth_client": [] 34 | }, 35 | "ads_service": { 36 | "status": 2 37 | } 38 | } 39 | } 40 | ], 41 | "configuration_version": "1" 42 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/John/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/tapglue/example/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.tapglue.example; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 23 | 24 | 25 | 26 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapglue/android_sdk/4e5c5c77e888c68e00835cdf19703223a41cd306/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapglue/android_sdk/4e5c5c77e888c68e00835cdf19703223a41cd306/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapglue/android_sdk/4e5c5c77e888c68e00835cdf19703223a41cd306/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapglue/android_sdk/4e5c5c77e888c68e00835cdf19703223a41cd306/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapglue/android_sdk/4e5c5c77e888c68e00835cdf19703223a41cd306/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | > 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Example 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /v1/app/src/test/java/com/tapglue/tapgluetests/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.tapgluetests; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.assertEquals; 23 | 24 | /** 25 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 26 | */ 27 | public class ExampleUnitTest { 28 | @Test 29 | public void addition_isCorrect() throws Exception { 30 | assertEquals(4, 2 + 2); 31 | } 32 | } -------------------------------------------------------------------------------- /v1/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 19 | 20 | buildscript { 21 | repositories { 22 | jcenter() 23 | } 24 | dependencies { 25 | classpath 'com.android.tools.build:gradle:2.2.2' 26 | 27 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.5' 28 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' 29 | } 30 | } 31 | 32 | project.ext { 33 | project.ext.preDexLibs = project.properties['preDexEnable'].equals('true') 34 | if (project.hasProperty('disablePreDex')) { 35 | project.ext.preDexLibs = false 36 | } 37 | 38 | println('PREDEX ' + (project.ext.preDexLibs ? 'ENABLED' : 'DISABLED')) 39 | } 40 | 41 | allprojects { 42 | repositories { 43 | jcenter() 44 | } 45 | 46 | project.plugins.whenPluginAdded { plugin -> 47 | if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) { 48 | project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs 49 | } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) { 50 | project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs 51 | } 52 | } 53 | } 54 | 55 | task clean(type: Delete) { 56 | delete rootProject.buildDir 57 | } 58 | -------------------------------------------------------------------------------- /v1/circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | environment: 3 | _JAVA_OPTIONS: "-Xms512m -Xmx1024m" 4 | GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xms512m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError"' 5 | java: 6 | version: oraclejdk8 7 | dependencies: 8 | pre: 9 | - sudo chown -R ubuntu:ubuntu /usr/local/android-sdk-linux 10 | override: 11 | - ./install_deps.sh 12 | cache_directories: 13 | - /usr/local/android-sdk-linux 14 | test: 15 | override: 16 | - emulator -avd tapglue -no-audio -no-window : 17 | background: true 18 | parallel: true 19 | - ./gradlew clean -PdisablePreDex --stacktrace 20 | - ./gradlew assembleDebug -PdisablePreDex --stacktrace 21 | - ./gradlew assembleDebugAndroidTest -PdisablePreDex --stacktrace 22 | - circle-android wait-for-boot 23 | - adb kill-server 24 | - adb devices 25 | - adb install -r app/build/outputs/apk/app-debug.apk 26 | - adb install -r app/build/outputs/apk/app-debug-androidTest-unaligned.apk 27 | - ./run_tests.sh 28 | -------------------------------------------------------------------------------- /v1/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # 17 | 18 | # Project-wide Gradle settings. 19 | 20 | # IDE (e.g. Android Studio) users: 21 | # Gradle settings configured through the IDE *will override* 22 | # any settings specified in this file. 23 | 24 | # For more details on how to configure your build environment visit 25 | # http://www.gradle.org/docs/current/userguide/build_environment.html 26 | 27 | # Specifies the JVM arguments used for the daemon process. 28 | # The setting is particularly useful for tweaking memory settings. 29 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 30 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 31 | 32 | # When configured, Gradle will run in incubating parallel mode. 33 | # This option should only be used with decoupled projects. More details, visit 34 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 35 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /v1/gradle/lint.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /v1/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapglue/android_sdk/4e5c5c77e888c68e00835cdf19703223a41cd306/v1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /v1/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jan 18 11:46:06 CET 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /v1/install_deps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ ! -d ${ANDROID_HOME}/build-tools/23.0.2 ]; then 4 | echo y | android update sdk --no-ui --all --filter "tool" 5 | echo y | android update sdk --no-ui --all --filter "build-tools-23.0.2" 6 | fi 7 | 8 | echo n | android create avd -n tapglue -f -t android-23 -------------------------------------------------------------------------------- /v1/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | adb kill-server 6 | adb devices 7 | (adb logcat > logcat.out) & 8 | LOGCAT_PID=$! 9 | adb shell am start -n com.tapglue.tapgluetests/.TestActivity 10 | sleep 60 11 | kill -9 ${LOGCAT_PID} 12 | cat logcat.out | grep -i 'Tests finished correctly' 13 | -------------------------------------------------------------------------------- /v1/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | include ':app', ':tapglue-android-sdk' 19 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/.name: -------------------------------------------------------------------------------- 1 | tapglue-android-sdk -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tapglue/android_sdk/4e5c5c77e888c68e00835cdf19703223a41cd306/v1/tapglue-android-sdk/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 7 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -dontwarn retrofit.** 19 | -keep class retrofit.** { *; } 20 | -keepattributes Signature 21 | -keepattributes Exceptions -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/androidTest/java/com/tapglue/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue; 19 | 20 | import android.app.Application; 21 | import android.test.ApplicationTestCase; 22 | 23 | /** 24 | * Testing Fundamentals 25 | */ 26 | 27 | public class ApplicationTest extends ApplicationTestCase { 28 | public ApplicationTest() { 29 | super(Application.class); 30 | } 31 | } -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/androidTest/java/com/tapglue/utils/TGPasswordHasherTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.utils; 19 | 20 | import android.test.suitebuilder.annotation.SmallTest; 21 | 22 | import junit.framework.TestCase; 23 | 24 | public class TGPasswordHasherTest extends TestCase { 25 | 26 | @SmallTest 27 | public void test01() { 28 | assertEquals(TGPasswordHasher.hashPassword("password"), "89b1af261b009d79687506151b0367edabaae9ae"); 29 | assertEquals(TGPasswordHasher.hashPassword("LongPasswordWithMoreText123"), "21cf9aa2a27f3bd5b9dce6b9b4cd903d2997c314"); 30 | assertEquals(TGPasswordHasher.hashPassword("viJyFK%XuW=&K6mEh8mgA>eVjMAMFUzGcnn7yv"), "19b38a4d4fd0fbb198828da47f6585523d472feb"); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/managers/AbstractTGManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import com.tapglue.Tapglue; 21 | 22 | abstract class AbstractTGManager { 23 | final Tapglue instance; 24 | 25 | AbstractTGManager(Tapglue instance) { 26 | this.instance = instance; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/managers/TGEventManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.model.TGEvent; 23 | import com.tapglue.model.TGEventObject; 24 | import com.tapglue.networking.requests.TGRequestCallback; 25 | 26 | public interface TGEventManager { 27 | /** 28 | * Create event with selected type 29 | * 30 | * @param type 31 | * @param callback 32 | */ 33 | void createEvent(@NonNull String type, @NonNull final TGRequestCallback callback); 34 | 35 | /** 36 | * Create event with selected type and object 37 | * 38 | * @param type 39 | * @param object 40 | * @param callback 41 | */ 42 | void createEvent(@NonNull String type, @NonNull TGEventObject object, @NonNull final TGRequestCallback callback); 43 | 44 | /** 45 | * Create event with selected type and object ID 46 | * 47 | * @param type 48 | * @param objectId 49 | * @param callback 50 | */ 51 | void createEvent(@NonNull String type, @NonNull String objectId, @NonNull final TGRequestCallback callback); 52 | 53 | /** 54 | * Create event with custom params 55 | * 56 | * @param event 57 | * @param callback 58 | */ 59 | void createEvent(@NonNull TGEvent event, @NonNull final TGRequestCallback callback); 60 | 61 | /** 62 | * Delete an event by ID 63 | * 64 | * @param id 65 | * @param callback 66 | */ 67 | void removeEvent(@NonNull Long id, @NonNull final TGRequestCallback callback); 68 | } 69 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/managers/TGRecommendationManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationPeriod; 23 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationType; 24 | import com.tapglue.model.TGUsersList; 25 | import com.tapglue.networking.requests.TGRequestCallback; 26 | 27 | public interface TGRecommendationManager { 28 | /** 29 | * Get recommended users 30 | * 31 | * @param type 32 | * @param period 33 | * @param callback 34 | */ 35 | void getUsers(TGRecommendationType type, TGRecommendationPeriod period, @NonNull final TGRequestCallback callback); 36 | } 37 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/managers/TGRecommendationManagerImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.Tapglue; 23 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationPeriod; 24 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationType; 25 | import com.tapglue.model.TGUsersList; 26 | import com.tapglue.networking.requests.TGRequestCallback; 27 | import com.tapglue.networking.requests.TGRequestErrorType; 28 | 29 | public class TGRecommendationManagerImpl extends AbstractTGManager implements TGRecommendationManager { 30 | 31 | public TGRecommendationManagerImpl(Tapglue tgInstance) { 32 | super(tgInstance); 33 | } 34 | 35 | /** 36 | * Get the recommended active users for the last day 37 | * 38 | * @param callback 39 | */ 40 | public void getUsers(TGRecommendationType type, TGRecommendationPeriod period, @NonNull final TGRequestCallback callback) { 41 | if (instance.getUserManager().getCurrentUser() == null) { 42 | callback.onRequestError(new TGRequestErrorType(TGRequestErrorType.ErrorType.USER_NOT_LOGGED_IN)); 43 | return; 44 | } 45 | 46 | instance.createRequest().getRecommendedUsers(type, period, callback); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGBaseObjectWithId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | /** 27 | * Base for all API-synchronized objects containing ID 28 | */ 29 | public abstract class TGBaseObjectWithId, IDTYPE> extends TGBaseObject { 30 | 31 | @Expose 32 | @SerializedName("id") 33 | private IDTYPE id; 34 | 35 | TGBaseObjectWithId(@NonNull TGCacheObjectType type) { 36 | super(type); 37 | } 38 | 39 | /** 40 | * Get ID used for network connections 41 | * 42 | * @return ID 43 | */ 44 | @NonNull 45 | final public IDTYPE getID() { 46 | return id; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGCommentsList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | 21 | import com.google.gson.annotations.Expose; 22 | import com.google.gson.annotations.SerializedName; 23 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 24 | 25 | import java.util.List; 26 | 27 | public class TGCommentsList extends TGBaseObject { 28 | @Expose 29 | @SerializedName("comments") 30 | private List comments; 31 | 32 | @Expose 33 | @SerializedName("comments_count") 34 | private Integer commentsCount; 35 | 36 | @Expose 37 | @SerializedName("post") 38 | private TGPost post; 39 | 40 | public TGCommentsList() { 41 | super(TGCacheObjectType.CommentsList); 42 | } 43 | 44 | /** 45 | * Get comments 46 | * 47 | * @return List with comments 48 | */ 49 | public List getComments() { 50 | return comments; 51 | } 52 | 53 | /** 54 | * Get amount of comments 55 | * 56 | * @return Comments counter 57 | */ 58 | public Integer getCommentsCount() { 59 | return commentsCount; 60 | } 61 | 62 | /** 63 | * Get post which comments are in list 64 | * 65 | * @return Post 66 | */ 67 | public TGPost getPost() { 68 | return post; 69 | } 70 | 71 | @NonNull 72 | @Override 73 | protected TGCommentsList getThis() { 74 | return this; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | public class TGError extends TGBaseObject { 27 | /** 28 | * Error code 29 | */ 30 | 31 | @Expose 32 | @SerializedName("code") 33 | private Long errorCode; 34 | 35 | @Expose 36 | @SerializedName("message") 37 | private String message; 38 | 39 | public TGError() { 40 | super(TGCacheObjectType.Error); 41 | } 42 | 43 | /** 44 | * Get error code 45 | * 46 | * @return Error code 47 | */ 48 | final public Long getErrorCode() { 49 | return errorCode; 50 | } 51 | 52 | 53 | /** 54 | * Get error message from server 55 | * 56 | * @return 57 | */ 58 | final public String getMessage() { 59 | return message; 60 | } 61 | 62 | @NonNull 63 | @Override 64 | protected TGError getThis() { 65 | return this; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGErrorList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | import java.util.List; 27 | 28 | public class TGErrorList extends TGBaseObject { 29 | 30 | @Expose 31 | @SerializedName("errors") 32 | private List errorList; 33 | 34 | public TGErrorList() { 35 | super(TGCacheObjectType.Error); 36 | } 37 | 38 | /** 39 | * Get list of error 40 | * 41 | * @return List of errors 42 | */ 43 | public List getErrors() { 44 | return errorList; 45 | } 46 | 47 | @NonNull 48 | @Override 49 | protected TGErrorList getThis() { 50 | return this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGFeedCount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | public class TGFeedCount extends TGBaseObject { 27 | @Expose 28 | @SerializedName("unread_events_count") 29 | private Long unreadCounter; 30 | 31 | public TGFeedCount() { 32 | super(TGCacheObjectType.FeedCount); 33 | } 34 | 35 | @NonNull 36 | @Override 37 | protected TGFeedCount getThis() { 38 | return this; 39 | } 40 | 41 | /** 42 | * Get amount of unread events from feed 43 | * 44 | * @return 45 | */ 46 | public Long getUnreadCount() { 47 | return unreadCounter; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGLike.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | 21 | import com.google.gson.annotations.Expose; 22 | import com.google.gson.annotations.SerializedName; 23 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 24 | 25 | public class TGLike extends TGBaseObjectWithId { 26 | @Expose 27 | @SerializedName("post_id") 28 | private String postId; 29 | 30 | @Expose 31 | @SerializedName("user_id") 32 | private String userId; 33 | 34 | public TGLike() { 35 | super(TGCacheObjectType.Like); 36 | } 37 | 38 | /** 39 | * Get ID of post 40 | * 41 | * @return post id 42 | */ 43 | public String getPostId() { 44 | return postId; 45 | } 46 | 47 | /** 48 | * Set ID of post Setting this won't change server value - use only for ui updates if needed 49 | * 50 | * @param postId 51 | * 52 | * @return 53 | */ 54 | @NonNull 55 | public TGLike setPostId(String postId) { 56 | this.postId = postId; 57 | return this; 58 | } 59 | 60 | @NonNull 61 | @Override 62 | protected TGLike getThis() { 63 | return this; 64 | } 65 | 66 | /** 67 | * Get ID of user 68 | * 69 | * @return 70 | */ 71 | public String getUserId() { 72 | return userId; 73 | } 74 | 75 | /** 76 | * Set id of user assigned to like Setting this won't change server value - use only for ui 77 | * updates if needed 78 | * 79 | * @param userId 80 | * 81 | * @return 82 | */ 83 | @NonNull 84 | public TGLike setUserId(String userId) { 85 | this.userId = userId; 86 | return this; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGLikesList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | 21 | import com.google.gson.annotations.Expose; 22 | import com.google.gson.annotations.SerializedName; 23 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 24 | 25 | import java.util.List; 26 | 27 | public class TGLikesList extends TGBaseObject { 28 | @Expose 29 | @SerializedName("likes") 30 | private List likes; 31 | 32 | @Expose 33 | @SerializedName("likes_count") 34 | private Integer likesCount; 35 | 36 | @Expose 37 | @SerializedName("post") 38 | private TGPost post; 39 | 40 | public TGLikesList() { 41 | super(TGCacheObjectType.LikesList); 42 | } 43 | 44 | /** 45 | * Get list of likes 46 | * 47 | * @return Likes details 48 | */ 49 | public List getLikes() { 50 | return likes; 51 | } 52 | 53 | /** 54 | * Get amount of likes 55 | * 56 | * @return Likes counter 57 | */ 58 | public Integer getLikesCount() { 59 | return likesCount; 60 | } 61 | 62 | /** 63 | * Get post to which likes are assigned to 64 | * 65 | * @return Post 66 | */ 67 | public TGPost getPost() { 68 | return post; 69 | } 70 | 71 | @NonNull 72 | @Override 73 | protected TGLikesList getThis() { 74 | return this; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGLoginUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject; 25 | 26 | public class TGLoginUser> extends TGBaseObjectWithId { 27 | @Expose 28 | @SerializedName("email") 29 | String email; 30 | 31 | @NonNull 32 | @Expose 33 | @SerializedName("password") 34 | String password; 35 | 36 | @Expose 37 | @SerializedName("user_name") 38 | String userName; 39 | 40 | public TGLoginUser(String userName, String email, @NonNull String password) { 41 | super(TGCustomCacheObject.TGCacheObjectType.LoginUser); 42 | this.userName = userName; 43 | this.email = email; 44 | this.password = password; 45 | } 46 | 47 | /** 48 | * Get user email 49 | * 50 | * @return user email 51 | */ 52 | public String getEmail() { 53 | return email; 54 | } 55 | 56 | /** 57 | * Get user password 58 | * 59 | * @return user password 60 | */ 61 | @NonNull 62 | public String getPassword() { 63 | return password; 64 | } 65 | 66 | @NonNull 67 | @Override 68 | protected T getThis() { 69 | return (T) this; 70 | } 71 | 72 | /** 73 | * Get user name 74 | * 75 | * @return user name 76 | */ 77 | public String getUserName() { 78 | return userName; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGPostsList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | 21 | import com.google.gson.annotations.Expose; 22 | import com.google.gson.annotations.SerializedName; 23 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 24 | 25 | import java.util.List; 26 | 27 | public class TGPostsList extends TGBaseObject { 28 | @Expose 29 | @SerializedName("posts") 30 | private List posts; 31 | 32 | @Expose 33 | @SerializedName("posts_count") 34 | private Integer postsCount; 35 | 36 | public TGPostsList() { 37 | super(TGCacheObjectType.PostList); 38 | } 39 | 40 | /** 41 | * Get posts count 42 | * 43 | * @return Posts Count 44 | */ 45 | public Integer getCount() { 46 | return postsCount; 47 | } 48 | 49 | /** 50 | * Get posts 51 | * 52 | * @return Posts 53 | */ 54 | public List getPosts() { 55 | return posts; 56 | } 57 | 58 | @NonNull 59 | @Override 60 | protected TGPostsList getThis() { 61 | return this; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGUsersList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | import java.util.List; 27 | 28 | public class TGUsersList extends TGBaseObject { 29 | 30 | @Expose 31 | @SerializedName("users") 32 | private List users; 33 | 34 | public TGUsersList(@NonNull TGCacheObjectType type) { 35 | super(type); 36 | } 37 | 38 | public TGUsersList() { 39 | super(TGCacheObjectType.ConnectionUserList); 40 | } 41 | 42 | @NonNull 43 | @Override 44 | protected TGUsersList getThis() { 45 | return this; 46 | } 47 | 48 | /** 49 | * Get list of connection users 50 | * 51 | * @return List of connection users 52 | */ 53 | public List getUsers() { 54 | return users; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/TGVisibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | import android.support.annotation.Nullable; 21 | 22 | public enum TGVisibility { 23 | // TODO document these 24 | Private(10), Connections(20), Public(30), Global(40); 25 | 26 | private final int value; 27 | 28 | @NonNull 29 | public static TGVisibility fromValue(@Nullable Integer valueToFind) { 30 | if (valueToFind == null) { 31 | return Private; 32 | } 33 | for (TGVisibility value : values()) { 34 | if (value.asValue().intValue() == valueToFind.intValue()) { 35 | return value; 36 | } 37 | } 38 | return Private; 39 | } 40 | 41 | TGVisibility(int realValue) { 42 | value = realValue; 43 | } 44 | 45 | public Integer asValue() { 46 | return value; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/model/queries/TGQueryObjectField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model.queries; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | class TGQueryObjectField { 23 | 24 | @NonNull 25 | private transient String name = ""; 26 | 27 | @NonNull 28 | String getName() { 29 | return name; 30 | } 31 | 32 | TGQueryObjectField setName(@NonNull String name) { 33 | this.name = name; 34 | return this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/networking/TGCacheRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.networking; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.model.TGBaseObject; 23 | import com.tapglue.networking.requests.TGRequestCallback; 24 | import com.tapglue.networking.requests.TGRequestErrorType; 25 | import com.tapglue.networking.requests.TGRequestType; 26 | 27 | class TGCacheRequest { 28 | private static final TGRequestCallback dummyCallback = new TGRequestCallback() { 29 | @Override 30 | public boolean callbackIsEnabled() { 31 | return true; 32 | } 33 | 34 | @Override 35 | public void onRequestError(TGRequestErrorType cause) { 36 | 37 | } 38 | 39 | @Override 40 | public void onRequestFinished(Object output, boolean changeDoneOnline) { 41 | 42 | } 43 | }; 44 | 45 | /** 46 | * Request object 47 | */ 48 | private final T object; 49 | 50 | /** 51 | * Request type 52 | */ 53 | private final TGRequestType type; 54 | 55 | public TGCacheRequest(@NonNull TGRequest req) { 56 | type = req.getRequestType(); 57 | object = req.getObject(); 58 | } 59 | 60 | /** 61 | * Convert cache request to standard request Those requests will always receive generic 62 | * callback 63 | * method, that is never outdated, but it also won't do any changes in UI due to always 64 | * outdated 65 | * old callbacks 66 | * 67 | * @return Converted Tapglue request 68 | */ 69 | @NonNull 70 | public TGRequest toTGRequest() { 71 | return new TGRequest(object, type, true, dummyCallback); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/networking/requests/TGRequestCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.networking.requests; 19 | 20 | public interface TGRequestCallback { 21 | /** 22 | * Information if request callback is not outdated / is active 23 | */ 24 | boolean callbackIsEnabled(); 25 | 26 | /** 27 | * Request couldn't be finished At most cases this will happen when no internet connection is 28 | * available, and request would require to be done live 29 | * 30 | * @param cause Cause of error 31 | */ 32 | void onRequestError(TGRequestErrorType cause); 33 | 34 | /** 35 | * Request was finished with success 36 | * 37 | * @param output Return object or status object 38 | * @param changeDoneOnline Flag with information if request was done online or just queued in 39 | * cache 40 | */ 41 | void onRequestFinished(OBJECT output, boolean changeDoneOnline); 42 | } 43 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/networking/requests/TGRequestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.networking.requests; 19 | 20 | /** 21 | * Request types supported by factory 22 | */ 23 | public enum TGRequestType { 24 | CREATE, READ, UPDATE, DELETE, LOGIN, LOGOUT, SEARCH 25 | } 26 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/main/java/com/tapglue/utils/TGLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.utils; 19 | 20 | import android.support.annotation.NonNull; 21 | import android.util.Log; 22 | 23 | public class TGLog { 24 | 25 | private static final String LOG_TAG = "Tapglue"; 26 | 27 | /** 28 | * Should logger do its work? 29 | */ 30 | private boolean isEnabled = false; 31 | 32 | public TGLog(boolean enabled) { 33 | isEnabled = enabled; 34 | } 35 | 36 | /** 37 | * Log information 38 | * 39 | * @param what What should be logged 40 | */ 41 | public void log(String what) { 42 | if (!isEnabled) { return; } 43 | Log.d(LOG_TAG, what); 44 | } 45 | 46 | /** 47 | * Log error 48 | * 49 | * @param t Throwable to log 50 | */ 51 | public void logE(@NonNull Throwable t) { 52 | if (!isEnabled) { return; } 53 | Log.e(LOG_TAG, t.getMessage()); 54 | t.printStackTrace(); 55 | } 56 | 57 | /** 58 | * Log warning 59 | * 60 | * @param what What should be logged 61 | */ 62 | public void logW(String what) { 63 | Log.w(LOG_TAG, what); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/src/test/java/com/tapglue/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.assertEquals; 23 | 24 | /** 25 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 26 | */ 27 | public class ExampleUnitTest { 28 | @Test 29 | public void addition_isCorrect() throws Exception { 30 | assertEquals(4, 2 + 2); 31 | } 32 | } -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -dontwarn retrofit.** 19 | -keep class retrofit.** { *; } 20 | -keepattributes Signature 21 | -keepattributes Exceptions -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/androidTest/java/com/tapglue/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue; 19 | 20 | import android.app.Application; 21 | import android.test.ApplicationTestCase; 22 | 23 | /** 24 | * Testing Fundamentals 25 | */ 26 | 27 | public class ApplicationTest extends ApplicationTestCase { 28 | public ApplicationTest() { 29 | super(Application.class); 30 | } 31 | } -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/androidTest/java/com/tapglue/utils/TGPasswordHasherTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.utils; 19 | 20 | import android.test.suitebuilder.annotation.SmallTest; 21 | 22 | import junit.framework.TestCase; 23 | 24 | public class TGPasswordHasherTest extends TestCase { 25 | 26 | @SmallTest 27 | public void test01() { 28 | assertEquals(TGPasswordHasher.hashPassword("password"), "89b1af261b009d79687506151b0367edabaae9ae"); 29 | assertEquals(TGPasswordHasher.hashPassword("LongPasswordWithMoreText123"), "21cf9aa2a27f3bd5b9dce6b9b4cd903d2997c314"); 30 | assertEquals(TGPasswordHasher.hashPassword("viJyFK%XuW=&K6mEh8mgA>eVjMAMFUzGcnn7yv"), "19b38a4d4fd0fbb198828da47f6585523d472feb"); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/managers/AbstractTGManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import com.tapglue.Tapglue; 21 | 22 | abstract class AbstractTGManager { 23 | final Tapglue instance; 24 | 25 | AbstractTGManager(Tapglue instance) { 26 | this.instance = instance; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/managers/TGEventManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.model.TGEvent; 23 | import com.tapglue.model.TGEventObject; 24 | import com.tapglue.networking.requests.TGRequestCallback; 25 | 26 | public interface TGEventManager { 27 | /** 28 | * Create event with selected type 29 | * 30 | * @param type 31 | * @param callback 32 | */ 33 | void createEvent(@NonNull String type, @NonNull final TGRequestCallback callback); 34 | 35 | /** 36 | * Create event with selected type and object 37 | * 38 | * @param type 39 | * @param object 40 | * @param callback 41 | */ 42 | void createEvent(@NonNull String type, @NonNull TGEventObject object, @NonNull final TGRequestCallback callback); 43 | 44 | /** 45 | * Create event with selected type and object ID 46 | * 47 | * @param type 48 | * @param objectId 49 | * @param callback 50 | */ 51 | void createEvent(@NonNull String type, @NonNull String objectId, @NonNull final TGRequestCallback callback); 52 | 53 | /** 54 | * Create event with custom params 55 | * 56 | * @param event 57 | * @param callback 58 | */ 59 | void createEvent(@NonNull TGEvent event, @NonNull final TGRequestCallback callback); 60 | 61 | /** 62 | * Delete an event by ID 63 | * 64 | * @param id 65 | * @param callback 66 | */ 67 | void removeEvent(@NonNull Long id, @NonNull final TGRequestCallback callback); 68 | } 69 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/managers/TGRecommendationManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationPeriod; 23 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationType; 24 | import com.tapglue.model.TGUsersList; 25 | import com.tapglue.networking.requests.TGRequestCallback; 26 | 27 | public interface TGRecommendationManager { 28 | /** 29 | * Get recommended users 30 | * 31 | * @param type 32 | * @param period 33 | * @param callback 34 | */ 35 | void getUsers(TGRecommendationType type, TGRecommendationPeriod period, @NonNull final TGRequestCallback callback); 36 | } 37 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/managers/TGRecommendationManagerImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.managers; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.Tapglue; 23 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationPeriod; 24 | import com.tapglue.model.TGRecommendedUsers.TGRecommendationType; 25 | import com.tapglue.model.TGUsersList; 26 | import com.tapglue.networking.requests.TGRequestCallback; 27 | import com.tapglue.networking.requests.TGRequestErrorType; 28 | 29 | public class TGRecommendationManagerImpl extends AbstractTGManager implements TGRecommendationManager { 30 | 31 | public TGRecommendationManagerImpl(Tapglue tgInstance) { 32 | super(tgInstance); 33 | } 34 | 35 | /** 36 | * Get the recommended active users for the last day 37 | * 38 | * @param callback 39 | */ 40 | public void getUsers(TGRecommendationType type, TGRecommendationPeriod period, @NonNull final TGRequestCallback callback) { 41 | if (instance.getUserManager().getCurrentUser() == null) { 42 | callback.onRequestError(new TGRequestErrorType(TGRequestErrorType.ErrorType.USER_NOT_LOGGED_IN)); 43 | return; 44 | } 45 | 46 | instance.createRequest().getRecommendedUsers(type, period, callback); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGBaseObjectWithId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | /** 27 | * Base for all API-synchronized objects containing ID 28 | */ 29 | public abstract class TGBaseObjectWithId, IDTYPE> extends TGBaseObject { 30 | 31 | @Expose 32 | @SerializedName("id") 33 | private IDTYPE id; 34 | 35 | TGBaseObjectWithId(@NonNull TGCacheObjectType type) { 36 | super(type); 37 | } 38 | 39 | /** 40 | * Get ID used for network connections 41 | * 42 | * @return ID 43 | */ 44 | @NonNull 45 | final public IDTYPE getID() { 46 | return id; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGCommentsList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | 21 | import com.google.gson.annotations.Expose; 22 | import com.google.gson.annotations.SerializedName; 23 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 24 | 25 | import java.util.List; 26 | 27 | public class TGCommentsList extends TGBaseObject { 28 | @Expose 29 | @SerializedName("comments") 30 | private List comments; 31 | 32 | @Expose 33 | @SerializedName("comments_count") 34 | private Integer commentsCount; 35 | 36 | @Expose 37 | @SerializedName("post") 38 | private TGPost post; 39 | 40 | public TGCommentsList() { 41 | super(TGCacheObjectType.CommentsList); 42 | } 43 | 44 | /** 45 | * Get comments 46 | * 47 | * @return List with comments 48 | */ 49 | public List getComments() { 50 | return comments; 51 | } 52 | 53 | /** 54 | * Get amount of comments 55 | * 56 | * @return Comments counter 57 | */ 58 | public Integer getCommentsCount() { 59 | return commentsCount; 60 | } 61 | 62 | /** 63 | * Get post which comments are in list 64 | * 65 | * @return Post 66 | */ 67 | public TGPost getPost() { 68 | return post; 69 | } 70 | 71 | @NonNull 72 | @Override 73 | protected TGCommentsList getThis() { 74 | return this; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | public class TGError extends TGBaseObject { 27 | /** 28 | * Error code 29 | */ 30 | 31 | @Expose 32 | @SerializedName("code") 33 | private Long errorCode; 34 | 35 | @Expose 36 | @SerializedName("message") 37 | private String message; 38 | 39 | public TGError() { 40 | super(TGCacheObjectType.Error); 41 | } 42 | 43 | /** 44 | * Get error code 45 | * 46 | * @return Error code 47 | */ 48 | final public Long getErrorCode() { 49 | return errorCode; 50 | } 51 | 52 | 53 | /** 54 | * Get error message from server 55 | * 56 | * @return 57 | */ 58 | final public String getMessage() { 59 | return message; 60 | } 61 | 62 | @NonNull 63 | @Override 64 | protected TGError getThis() { 65 | return this; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGErrorList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | import java.util.List; 27 | 28 | public class TGErrorList extends TGBaseObject { 29 | 30 | @Expose 31 | @SerializedName("errors") 32 | private List errorList; 33 | 34 | public TGErrorList() { 35 | super(TGCacheObjectType.Error); 36 | } 37 | 38 | /** 39 | * Get list of error 40 | * 41 | * @return List of errors 42 | */ 43 | public List getErrors() { 44 | return errorList; 45 | } 46 | 47 | @NonNull 48 | @Override 49 | protected TGErrorList getThis() { 50 | return this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGFeedCount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | public class TGFeedCount extends TGBaseObject { 27 | @Expose 28 | @SerializedName("unread_events_count") 29 | private Long unreadCounter; 30 | 31 | public TGFeedCount() { 32 | super(TGCacheObjectType.FeedCount); 33 | } 34 | 35 | @NonNull 36 | @Override 37 | protected TGFeedCount getThis() { 38 | return this; 39 | } 40 | 41 | /** 42 | * Get amount of unread events from feed 43 | * 44 | * @return 45 | */ 46 | public Long getUnreadCount() { 47 | return unreadCounter; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGLikesList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | 21 | import com.google.gson.annotations.Expose; 22 | import com.google.gson.annotations.SerializedName; 23 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 24 | 25 | import java.util.List; 26 | 27 | public class TGLikesList extends TGBaseObject { 28 | @Expose 29 | @SerializedName("likes") 30 | private List likes; 31 | 32 | @Expose 33 | @SerializedName("likes_count") 34 | private Integer likesCount; 35 | 36 | @Expose 37 | @SerializedName("post") 38 | private TGPost post; 39 | 40 | public TGLikesList() { 41 | super(TGCacheObjectType.LikesList); 42 | } 43 | 44 | /** 45 | * Get list of likes 46 | * 47 | * @return Likes details 48 | */ 49 | public List getLikes() { 50 | return likes; 51 | } 52 | 53 | /** 54 | * Get amount of likes 55 | * 56 | * @return Likes counter 57 | */ 58 | public Integer getLikesCount() { 59 | return likesCount; 60 | } 61 | 62 | /** 63 | * Get post to which likes are assigned to 64 | * 65 | * @return Post 66 | */ 67 | public TGPost getPost() { 68 | return post; 69 | } 70 | 71 | @NonNull 72 | @Override 73 | protected TGLikesList getThis() { 74 | return this; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGLoginUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject; 25 | 26 | public class TGLoginUser> extends TGBaseObjectWithId { 27 | @Expose 28 | @SerializedName("email") 29 | String email; 30 | 31 | @NonNull 32 | @Expose 33 | @SerializedName("password") 34 | String password; 35 | 36 | @Expose 37 | @SerializedName("user_name") 38 | String userName; 39 | 40 | public TGLoginUser(String userName, String email, @NonNull String password) { 41 | super(TGCustomCacheObject.TGCacheObjectType.LoginUser); 42 | this.userName = userName; 43 | this.email = email; 44 | this.password = password; 45 | } 46 | 47 | /** 48 | * Get user email 49 | * 50 | * @return user email 51 | */ 52 | public String getEmail() { 53 | return email; 54 | } 55 | 56 | /** 57 | * Get user password 58 | * 59 | * @return user password 60 | */ 61 | @NonNull 62 | public String getPassword() { 63 | return password; 64 | } 65 | 66 | @NonNull 67 | @Override 68 | protected T getThis() { 69 | return (T) this; 70 | } 71 | 72 | /** 73 | * Get user name 74 | * 75 | * @return user name 76 | */ 77 | public String getUserName() { 78 | return userName; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGPostsList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | 21 | import com.google.gson.annotations.Expose; 22 | import com.google.gson.annotations.SerializedName; 23 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 24 | 25 | import java.util.List; 26 | 27 | public class TGPostsList extends TGBaseObject { 28 | @Expose 29 | @SerializedName("posts") 30 | private List posts; 31 | 32 | @Expose 33 | @SerializedName("posts_count") 34 | private Integer postsCount; 35 | 36 | public TGPostsList() { 37 | super(TGCacheObjectType.PostList); 38 | } 39 | 40 | /** 41 | * Get posts count 42 | * 43 | * @return Posts Count 44 | */ 45 | public Integer getCount() { 46 | return postsCount; 47 | } 48 | 49 | /** 50 | * Get posts 51 | * 52 | * @return Posts 53 | */ 54 | public List getPosts() { 55 | return posts; 56 | } 57 | 58 | @NonNull 59 | @Override 60 | protected TGPostsList getThis() { 61 | return this; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGUsersList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.google.gson.annotations.Expose; 23 | import com.google.gson.annotations.SerializedName; 24 | import com.tapglue.networking.TGCustomCacheObject.TGCacheObjectType; 25 | 26 | import java.util.List; 27 | 28 | public class TGUsersList extends TGBaseObject { 29 | 30 | @Expose 31 | @SerializedName("users") 32 | private List users; 33 | 34 | public TGUsersList(@NonNull TGCacheObjectType type) { 35 | super(type); 36 | } 37 | 38 | public TGUsersList() { 39 | super(TGCacheObjectType.ConnectionUserList); 40 | } 41 | 42 | @NonNull 43 | @Override 44 | protected TGUsersList getThis() { 45 | return this; 46 | } 47 | 48 | /** 49 | * Get list of connection users 50 | * 51 | * @return List of connection users 52 | */ 53 | public List getUsers() { 54 | return users; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/TGVisibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.tapglue.model; 18 | 19 | import android.support.annotation.NonNull; 20 | import android.support.annotation.Nullable; 21 | 22 | public enum TGVisibility { 23 | // TODO document these 24 | Private(10), Connections(20), Public(30), Global(40); 25 | 26 | private final int value; 27 | 28 | @NonNull 29 | public static TGVisibility fromValue(@Nullable Integer valueToFind) { 30 | if (valueToFind == null) { 31 | return Private; 32 | } 33 | for (TGVisibility value : values()) { 34 | if (value.asValue().intValue() == valueToFind.intValue()) { 35 | return value; 36 | } 37 | } 38 | return Private; 39 | } 40 | 41 | TGVisibility(int realValue) { 42 | value = realValue; 43 | } 44 | 45 | public Integer asValue() { 46 | return value; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/model/queries/TGQueryObjectField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.model.queries; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | class TGQueryObjectField { 23 | 24 | @NonNull 25 | private transient String name = ""; 26 | 27 | @NonNull 28 | String getName() { 29 | return name; 30 | } 31 | 32 | TGQueryObjectField setName(@NonNull String name) { 33 | this.name = name; 34 | return this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/networking/TGCacheRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.networking; 19 | 20 | import android.support.annotation.NonNull; 21 | 22 | import com.tapglue.model.TGBaseObject; 23 | import com.tapglue.networking.requests.TGRequestCallback; 24 | import com.tapglue.networking.requests.TGRequestErrorType; 25 | import com.tapglue.networking.requests.TGRequestType; 26 | 27 | class TGCacheRequest { 28 | private static final TGRequestCallback dummyCallback = new TGRequestCallback() { 29 | @Override 30 | public boolean callbackIsEnabled() { 31 | return true; 32 | } 33 | 34 | @Override 35 | public void onRequestError(TGRequestErrorType cause) { 36 | 37 | } 38 | 39 | @Override 40 | public void onRequestFinished(Object output, boolean changeDoneOnline) { 41 | 42 | } 43 | }; 44 | 45 | /** 46 | * Request object 47 | */ 48 | private final T object; 49 | 50 | /** 51 | * Request type 52 | */ 53 | private final TGRequestType type; 54 | 55 | public TGCacheRequest(@NonNull TGRequest req) { 56 | type = req.getRequestType(); 57 | object = req.getObject(); 58 | } 59 | 60 | /** 61 | * Convert cache request to standard request Those requests will always receive generic 62 | * callback 63 | * method, that is never outdated, but it also won't do any changes in UI due to always 64 | * outdated 65 | * old callbacks 66 | * 67 | * @return Converted Tapglue request 68 | */ 69 | @NonNull 70 | public TGRequest toTGRequest() { 71 | return new TGRequest(object, type, true, dummyCallback); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/networking/requests/TGRequestCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.networking.requests; 19 | 20 | public interface TGRequestCallback { 21 | /** 22 | * Information if request callback is not outdated / is active 23 | */ 24 | boolean callbackIsEnabled(); 25 | 26 | /** 27 | * Request couldn't be finished At most cases this will happen when no internet connection is 28 | * available, and request would require to be done live 29 | * 30 | * @param cause Cause of error 31 | */ 32 | void onRequestError(TGRequestErrorType cause); 33 | 34 | /** 35 | * Request was finished with success 36 | * 37 | * @param output Return object or status object 38 | * @param changeDoneOnline Flag with information if request was done online or just queued in 39 | * cache 40 | */ 41 | void onRequestFinished(OBJECT output, boolean changeDoneOnline); 42 | } 43 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/networking/requests/TGRequestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.networking.requests; 19 | 20 | /** 21 | * Request types supported by factory 22 | */ 23 | public enum TGRequestType { 24 | CREATE, READ, UPDATE, DELETE, LOGIN, LOGOUT, SEARCH 25 | } 26 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/utils/TGLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue.utils; 19 | 20 | import android.support.annotation.NonNull; 21 | import android.util.Log; 22 | 23 | public class TGLog { 24 | 25 | private static final String LOG_TAG = "Tapglue"; 26 | 27 | /** 28 | * Should logger do its work? 29 | */ 30 | private boolean isEnabled = false; 31 | 32 | public TGLog(boolean enabled) { 33 | isEnabled = enabled; 34 | } 35 | 36 | /** 37 | * Log information 38 | * 39 | * @param what What should be logged 40 | */ 41 | public void log(String what) { 42 | if (!isEnabled) { return; } 43 | Log.d(LOG_TAG, what); 44 | } 45 | 46 | /** 47 | * Log error 48 | * 49 | * @param t Throwable to log 50 | */ 51 | public void logE(@NonNull Throwable t) { 52 | if (!isEnabled) { return; } 53 | Log.e(LOG_TAG, t.getMessage()); 54 | t.printStackTrace(); 55 | } 56 | 57 | /** 58 | * Log warning 59 | * 60 | * @param what What should be logged 61 | */ 62 | public void logW(String what) { 63 | Log.w(LOG_TAG, what); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /v1/tapglue-android-sdk/tapglue-android-sdk/src/test/java/com/tapglue/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Tapglue (https://www.tapglue.com/). All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.tapglue; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.assertEquals; 23 | 24 | /** 25 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 26 | */ 27 | public class ExampleUnitTest { 28 | @Test 29 | public void addition_isCorrect() throws Exception { 30 | assertEquals(4, 2 + 2); 31 | } 32 | } --------------------------------------------------------------------------------