Skip to content

Commit ab1ced9

Browse files
authored
Merge pull request #36 from hansemannn/update-play-services
feat(android): update firebase to latest
2 parents d293585 + 615d6be commit ab1ced9

11 files changed

+59
-31
lines changed

android/.project

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66
</projects>
77
<buildSpec>
88
<buildCommand>
9-
<name>com.appcelerator.titanium.core.builder</name>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
1010
<arguments>
1111
</arguments>
1212
</buildCommand>
1313
<buildCommand>
14-
<name>com.aptana.ide.core.unifiedBuilder</name>
14+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
1515
<arguments>
1616
</arguments>
1717
</buildCommand>
1818
<buildCommand>
19-
<name>org.eclipse.jdt.core.javabuilder</name>
19+
<name>com.appcelerator.titanium.core.builder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.aptana.ide.core.unifiedBuilder</name>
2025
<arguments>
2126
</arguments>
2227
</buildCommand>
@@ -25,5 +30,6 @@
2530
<nature>org.eclipse.jdt.core.javanature</nature>
2631
<nature>com.appcelerator.titanium.mobile.module.nature</nature>
2732
<nature>com.aptana.projects.webnature</nature>
33+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
2834
</natures>
2935
</projectDescription>

android/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ repositories {
77
}
88

99
dependencies {
10-
compile 'com.google.firebase:firebase-iid:15.0.0'
11-
compile 'com.google.firebase:firebase-common:15.0.0'
10+
compile 'com.google.firebase:firebase-core:16.0.8'
11+
compile 'com.google.firebase:firebase-iid:17.1.1'
12+
compile 'com.google.firebase:firebase-common:16.1.0'
1213
}
1314

1415
configurations.all {
-14.2 KB
Binary file not shown.
72.4 KB
Binary file not shown.

android/lib/firebase-core-16.0.8.aar

765 Bytes
Binary file not shown.

android/lib/firebase-iid-11.0.4.aar

-31.8 KB
Binary file not shown.

android/lib/firebase-iid-17.1.1.aar

69.4 KB
Binary file not shown.
6.5 KB
Binary file not shown.
Binary file not shown.

android/manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# this is your module manifest and used by Titanium
33
# during compilation, packaging, distribution, etc.
44
#
5-
version: 3.0.2
5+
version: 4.0.0
66
apiversion: 4
77
architectures: arm64-v8a armeabi-v7a x86
88
description: titanium-firebase-core

android/src/firebase/core/TitaniumFirebaseCoreModule.java

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
*/
99
package firebase.core;
1010

11+
import android.annotation.SuppressLint;
12+
import android.annotation.TargetApi;
1113
import android.os.AsyncTask;
14+
import android.os.Build;
1215

1316
import org.appcelerator.kroll.KrollModule;
1417
import org.appcelerator.kroll.KrollFunction;
18+
import org.appcelerator.kroll.KrollObject;
1519
import org.appcelerator.kroll.annotations.Kroll;
1620
import org.appcelerator.titanium.TiApplication;
1721
import org.appcelerator.kroll.common.Log;
@@ -152,6 +156,7 @@ public boolean configure(@Kroll.argument(optional = true) KrollDict param)
152156
}
153157
}
154158

159+
@TargetApi(Build.VERSION_CODES.CUPCAKE)
155160
@Kroll.method
156161
public void deleteInstanceId(final KrollFunction callback)
157162
{
@@ -181,36 +186,14 @@ protected void onPostExecute(IOException error)
181186
.execute();
182187
}
183188

189+
@TargetApi(Build.VERSION_CODES.CUPCAKE)
184190
@Kroll.method
185191
public void deleteToken(final String authorizedEntity, final String scope, final KrollFunction callback)
186192
{
187-
new AsyncTask<Void, Void, IOException>() {
188-
protected IOException doInBackground(Void... v)
189-
{
190-
try {
191-
FirebaseInstanceId.getInstance().deleteToken(authorizedEntity, scope);
192-
return null;
193-
} catch (IOException e) {
194-
e.printStackTrace();
195-
return e;
196-
}
197-
}
198-
protected void onPostExecute(IOException error)
199-
{
200-
if (callback != null) {
201-
HashMap args = new HashMap<>();
202-
args.put("success", error == null);
203-
if (error != null) {
204-
args.put("error", error.getLocalizedMessage());
205-
}
206-
callback.call(getKrollObject(), args);
207-
}
208-
}
209-
}
210-
.execute();
193+
new TiBackgroundTask (authorizedEntity, scope, callback, getKrollObject()).execute();
211194
}
212195

213-
public String loadJSONFromAsset(String filename)
196+
private String loadJSONFromAsset(String filename)
214197
{
215198
String json = null;
216199

@@ -227,4 +210,42 @@ public String loadJSONFromAsset(String filename)
227210
}
228211
return json;
229212
}
213+
214+
@TargetApi(Build.VERSION_CODES.CUPCAKE)
215+
private static class TiBackgroundTask extends AsyncTask<Void, Void, IOException>
216+
{
217+
private final String authorizedEntity;
218+
private final String scope;
219+
private final KrollFunction callback;
220+
private final KrollObject krollObject;
221+
222+
public TiBackgroundTask (final String authorizedEntity, final String scope, final KrollFunction callback, final KrollObject krollObject) {
223+
this.authorizedEntity = authorizedEntity;
224+
this.scope = scope;
225+
this.callback = callback;
226+
this.krollObject = krollObject;
227+
}
228+
229+
protected IOException doInBackground(Void... v)
230+
{
231+
try {
232+
FirebaseInstanceId.getInstance().deleteToken(authorizedEntity, scope);
233+
return null;
234+
} catch (IOException e) {
235+
e.printStackTrace();
236+
return e;
237+
}
238+
}
239+
protected void onPostExecute(IOException error)
240+
{
241+
if (callback != null) {
242+
HashMap args = new HashMap<>();
243+
args.put("success", error == null);
244+
if (error != null) {
245+
args.put("error", error.getLocalizedMessage());
246+
}
247+
callback.call(krollObject, args);
248+
}
249+
}
250+
}
230251
}

0 commit comments

Comments
 (0)