Skip to content

Commit 6e30235

Browse files
author
Pawel Szymanski
committed
Merge branch 'develop'
2 parents 0304d8a + 1a83c81 commit 6e30235

271 files changed

Lines changed: 13532 additions & 4968 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 417 additions & 51 deletions
Large diffs are not rendered by default.

api/build.gradle

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
jcenter()
5-
maven { url "http://dl.bintray.com/pixplicity/maven" }
6-
}
7-
8-
dependencies {
9-
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
10-
}
11-
}
12-
13-
repositories {
14-
mavenCentral()
15-
}
16-
171
apply plugin: 'com.android.library'
182
apply plugin: 'com.neenbedankt.android-apt'
193
apply plugin: 'me.tatarka.retrolambda'
4+
apply plugin: 'groovyx.android'
205

216
android {
22-
compileSdkVersion 23
23-
buildToolsVersion "23.0.2"
7+
compileSdkVersion 24
8+
buildToolsVersion "24.0.3"
249

2510
defaultConfig {
2611
minSdkVersion 14
27-
targetSdkVersion 23
12+
targetSdkVersion 24
2813
versionCode 1
2914
versionName "1.0"
15+
16+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3017
}
3118

3219
compileOptions {
@@ -40,30 +27,42 @@ android {
4027
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
4128
}
4229
}
30+
31+
packagingOptions {
32+
exclude 'META-INF/services/org.codehaus.groovy.transform.ASTTransformation'
33+
exclude 'LICENSE.txt'
34+
}
4335
}
4436

4537
dependencies {
4638
compile fileTree(dir: 'libs', include: ['*.jar'])
47-
testCompile 'junit:junit:4.12'
48-
compile 'com.android.support:appcompat-v7:23.1.1'
49-
compile 'com.amazonaws:aws-android-sdk-core:2.1.4'
50-
compile 'com.amazonaws:aws-android-sdk-s3:2.1.4'
51-
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
52-
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
53-
compile 'com.squareup.okhttp3:okhttp:3.2.0'
54-
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
55-
compile 'com.google.dagger:dagger:2.0.2'
56-
apt 'com.google.dagger:dagger-compiler:2.0.2'
39+
compile 'com.android.support:support-annotations:24.2.1'
40+
compile 'com.squareup.retrofit2:retrofit:2.1.0'
41+
compile 'com.squareup.retrofit2:converter-jackson:2.1.0'
42+
compile 'com.squareup.okhttp3:okhttp:3.3.0'
43+
compile 'com.squareup.okhttp3:logging-interceptor:3.3.0'
44+
compile 'com.google.dagger:dagger:2.7'
45+
apt 'com.google.dagger:dagger-compiler:2.7'
5746
compile 'javax.annotation:javax.annotation-api:1.2'
58-
compile 'io.reactivex:rxjava:1.1.2'
59-
compile 'io.reactivex:rxandroid:1.1.0'
6047
compile 'com.pixplicity.easyprefs:library:1.8.1@aar'
48+
compile 'com.github.jasminb:jsonapi-converter:0.4'
49+
50+
testCompile 'junit:junit:4.12'
6151
testCompile 'org.mockito:mockito-core:1.10.8'
6252
testCompile 'org.robolectric:robolectric:3.0'
6353

64-
testCompile "org.powermock:powermock-module-junit4:1.6.4"
65-
testCompile "org.powermock:powermock-module-junit4-rule:1.6.4"
66-
testCompile "org.powermock:powermock-api-mockito:1.6.4"
67-
testCompile "org.powermock:powermock-classloading-xstream:1.6.4"
68-
54+
testCompile "org.powermock:powermock-module-junit4:1.6.5"
55+
testCompile "org.powermock:powermock-module-junit4-rule:1.6.5"
56+
testCompile "org.powermock:powermock-api-mockito:1.6.5"
57+
testCompile "org.powermock:powermock-classloading-xstream:1.6.5"
58+
59+
testCompile 'org.codehaus.groovy:groovy:2.4.7:grooid'
60+
testCompile "com.andrewreitz:spock-android:1.2.1"
61+
testCompile 'com.android.support.test:testing-support-lib:0.1'
62+
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
63+
exclude group: 'org.codehaus.groovy'
64+
exclude group: 'junit'
65+
}
66+
testCompile 'cglib:cglib-nodep:3.2.4'
67+
testCompile 'org.objenesis:objenesis:2.2'
6968
}

api/src/androidTest/java/com/creatubbles/api/ApplicationTest.java

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
package com.creatubbles.api;
2+
3+
import com.creatubbles.api.exception.InvalidParametersException;
4+
import com.creatubbles.api.model.ObjectType;
5+
import com.creatubbles.api.model.Operation;
6+
7+
/**
8+
* Created by Janek on 04.11.2016.
9+
*/
10+
11+
public final class AbilityOperationVerifier {
12+
13+
public static void verify(ObjectType objectType, Operation operation) {
14+
if (objectType == null || operation == null) {
15+
throw new InvalidParametersException("Ability and operation can't be null!");
16+
}
17+
switch (objectType) {
18+
case CREATION:
19+
verifyCreation(operation);
20+
break;
21+
case GALLERY:
22+
verifyGallery(operation);
23+
break;
24+
case USER:
25+
verifyUser(operation);
26+
break;
27+
case ACCOUNT:
28+
verifyAccount(operation);
29+
break;
30+
case COMMENT:
31+
verifyComment(operation);
32+
break;
33+
case BUBBLE:
34+
verifyBubble(operation);
35+
break;
36+
default:
37+
throw new InvalidParametersException("Invalid objectType!");
38+
}
39+
40+
}
41+
42+
private static void verifyCreation(Operation operation) {
43+
if (operation != Operation.EDIT &&
44+
operation != Operation.REPORT &&
45+
operation != Operation.SEE_REFLECTION_TEXT &&
46+
operation != Operation.SEE_REFLECTION_VIDEO &&
47+
operation != Operation.SHARE) {
48+
throw new InvalidParametersException("Invalid operation for Creation object!");
49+
}
50+
}
51+
52+
private static void verifyGallery(Operation operation) {
53+
if (operation != Operation.EDIT &&
54+
operation != Operation.SHARE &&
55+
operation != Operation.SUBMIT_TO) {
56+
throw new InvalidParametersException("Invalid operation for Gallery object!");
57+
}
58+
}
59+
60+
private static void verifyUser(Operation operation) {
61+
if (operation != Operation.EDIT &&
62+
operation != Operation.SWITCH &&
63+
operation != Operation.SWITCH_WITHOUT_PASSWORD &&
64+
operation != Operation.SHARE &&
65+
operation != Operation.CUSTOMIZE) {
66+
throw new InvalidParametersException("Invalid operation for User object!");
67+
}
68+
}
69+
70+
private static void verifyAccount(Operation operation) {
71+
if (operation != Operation.EDIT &&
72+
operation != Operation.SWITCH &&
73+
operation != Operation.SHARE &&
74+
operation != Operation.CUSTOMIZE &&
75+
operation != Operation.SHARE_FULLY) {
76+
throw new InvalidParametersException("Invalid operation for Account object!");
77+
}
78+
}
79+
80+
private static void verifyComment(Operation operation) {
81+
if (operation != Operation.REPORT &&
82+
operation != Operation.DECLINE &&
83+
operation != Operation.APPROVE &&
84+
operation != Operation.DELETE) {
85+
throw new InvalidParametersException("Invalid operation for Comment object!");
86+
}
87+
}
88+
89+
private static void verifyBubble(Operation operation) {
90+
if (operation != Operation.DESTROY) {
91+
throw new InvalidParametersException("Invalid operation for Bubble object!");
92+
}
93+
}
94+
95+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package com.creatubbles.api;
2+
3+
import android.app.Application;
4+
import android.support.annotation.NonNull;
5+
6+
import com.creatubbles.api.exception.InvalidParametersException;
7+
8+
9+
/**
10+
* Created by Janek on 11.10.2016.
11+
*/
12+
13+
public class Configuration {
14+
15+
static final String INVALID_CLIENT_ID_MESSAGE = "ClientId can't be null!";
16+
static final String INVALID_CLIENT_SECRET_MESSAGE = "ClientSecret can't be null!";
17+
static final String INVALID_BASE_URL_MESSAGE = "BaseUrl can't be null!";
18+
static final String INVALID_APPLICATION_CONTEXT_MESSAGE = "Application Context can't be null!";
19+
20+
private final String clientId;
21+
private final String clientSecret;
22+
private final String baseUrl;
23+
private final Application context;
24+
private final Locale locale;
25+
26+
public Configuration(@NonNull Builder builder) {
27+
this.clientId = builder.clientId;
28+
this.clientSecret = builder.clientSecret;
29+
this.baseUrl = builder.baseUrl;
30+
this.context = builder.context;
31+
this.locale = builder.locale;
32+
}
33+
34+
public static class Builder {
35+
36+
String clientId;
37+
String clientSecret;
38+
String baseUrl;
39+
Application context;
40+
Locale locale;
41+
42+
public Builder clientId(@NonNull String clientId) {
43+
this.clientId = clientId;
44+
return this;
45+
}
46+
47+
public Builder clientSecret(@NonNull String clientSecret) {
48+
this.clientSecret = clientSecret;
49+
return this;
50+
}
51+
52+
public Builder baseUrl(@NonNull String baseUrl) {
53+
this.baseUrl = baseUrl;
54+
return this;
55+
}
56+
57+
public Builder application(@NonNull Application application) {
58+
this.context = application;
59+
return this;
60+
}
61+
62+
public Builder locale(@NonNull Locale locale) {
63+
this.locale = locale;
64+
return this;
65+
}
66+
67+
@NonNull
68+
public Configuration build() {
69+
if (clientId == null) {
70+
throw new InvalidParametersException(INVALID_CLIENT_ID_MESSAGE);
71+
} else if (clientSecret == null) {
72+
throw new InvalidParametersException(INVALID_CLIENT_SECRET_MESSAGE);
73+
} else if (baseUrl == null) {
74+
throw new InvalidParametersException(INVALID_BASE_URL_MESSAGE);
75+
} else if (context == null) {
76+
throw new InvalidParametersException(INVALID_APPLICATION_CONTEXT_MESSAGE);
77+
} else {
78+
return new Configuration(this);
79+
}
80+
}
81+
}
82+
83+
public String getClientId() {
84+
return clientId;
85+
}
86+
87+
public String getClientSecret() {
88+
return clientSecret;
89+
}
90+
91+
public String getBaseUrl() {
92+
return baseUrl;
93+
}
94+
95+
public Application getContext() {
96+
return context;
97+
}
98+
99+
public Locale getLocale() {
100+
return locale;
101+
}
102+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.creatubbles.api;
2+
3+
import android.support.annotation.NonNull;
4+
5+
import com.creatubbles.api.di.modules.ApiModule;
6+
import com.creatubbles.api.exception.InitializationException;
7+
8+
/**
9+
* Created by Janek on 11.10.2016.
10+
*/
11+
12+
public final class CreatubblesApi {
13+
14+
private static Configuration apiConfiguration = null;
15+
16+
public static void initialize(@NonNull Configuration configuration) {
17+
if (configuration == null) {
18+
throw new NullPointerException("Configuration can't be null");
19+
}
20+
if (apiConfiguration != null) {
21+
throw new InitializationException("Can't initialize CreatubblesApi twice!");
22+
} else {
23+
apiConfiguration = configuration;
24+
ApiModule.initialize(apiConfiguration);
25+
}
26+
27+
}
28+
29+
public static void reset() {
30+
apiConfiguration = null;
31+
}
32+
}

api/src/main/java/com/creatubbles/api/EndPoints.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,27 @@
44
* Created by Janek on 05.02.2016.
55
*/
66
public class EndPoints {
7-
public static final String URL_BASE = "https://www.creatubbles.com/api/v2/";
87

9-
// TODO add your stagging server url
10-
public static String URL_BASE_STAGING = null;
11-
12-
//API v2
138
public static final String GALLERIES = "galleries";
9+
public static final String FEATURED_GALLERIES = "featured_galleries";
1410
public static final String CREATORS = "creators";
1511
public static final String OAUTH_TOKEN = "oauth/token";
1612
public static final String USERS = "users";
1713
public static final String CREATIONS = "creations";
18-
public static final String CREATIONS_UPLOADS = "creations/{id}/uploads";
19-
public static final String PING_CREATIONS_UPLOADS = "uploads/{id}";
14+
public static final String UPLOADS = "uploads";
2015
public static final String LANDING_URLS = "landing_urls";
21-
22-
public static boolean SET_STAGING = false;
16+
public static final String GALLERY_SUBMISSIONS = "gallery_submissions";
17+
public static final String CONTENTS = "contents";
18+
public static final String BUBBLES = "bubbles";
19+
public static final String COMMENTS = "comments";
20+
public static final String NOTIFICATIONS = "notifications";
21+
public static final String GROUPS = "groups";
22+
public static final String PARTNER_APPLICATIONS = "partner_applications";
23+
public static final String SCHOOLS = "schools";
24+
public static final String AVATAR_SUGGESTIONS = "avatar_suggestions";
25+
public static final String USER_AVATAR = "user_avatar";
26+
public static final String SWITCH_USERS = "user_switch/users";
27+
public static final String CREATOR_BUILDER_JOBS = "creator_builder_jobs";
28+
public static final String ACTIVITIES = "activities";
29+
public static final String ABILITIES = "abilities";
2330
}

0 commit comments

Comments
 (0)