Finished the tusky-api server.

main
Vavassor 8 years ago
parent 5e93e5d99c
commit 5d68c6df8f
  1. 4
      app/src/main/java/com/keylesspalace/tusky/MainActivity.java
  2. 9
      app/src/main/java/com/keylesspalace/tusky/MyFirebaseInstanceIdService.java
  3. 2
      app/src/main/res/values/strings.xml

@ -177,12 +177,12 @@ public class MainActivity extends BaseActivity {
tuskyAPI.register(getBaseUrl(), getAccessToken(), FirebaseInstanceId.getInstance().getToken()).enqueue(new Callback<ResponseBody>() { tuskyAPI.register(getBaseUrl(), getAccessToken(), FirebaseInstanceId.getInstance().getToken()).enqueue(new Callback<ResponseBody>() {
@Override @Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Log.d(TAG, "tusky-api reponse: " + response.message());
} }
@Override @Override
public void onFailure(Call<ResponseBody> call, Throwable t) { public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.d(TAG, "tusky-api failure: " + t.getMessage());
} }
}); });
} }

@ -13,6 +13,7 @@ import retrofit2.Response;
import retrofit2.Retrofit; import retrofit2.Retrofit;
public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService { public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService {
private static final String TAG = "MyFirebaseInstanceIdService";
private TuskyAPI tuskyAPI; private TuskyAPI tuskyAPI;
@ -37,23 +38,23 @@ public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService {
tuskyAPI.unregister("https://" + domain, accessToken).enqueue(new Callback<ResponseBody>() { tuskyAPI.unregister("https://" + domain, accessToken).enqueue(new Callback<ResponseBody>() {
@Override @Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Log.d(TAG, response.message());
} }
@Override @Override
public void onFailure(Call<ResponseBody> call, Throwable t) { public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.d(TAG, t.getMessage());
} }
}); });
tuskyAPI.register("https://" + domain, accessToken, refreshedToken).enqueue(new Callback<ResponseBody>() { tuskyAPI.register("https://" + domain, accessToken, refreshedToken).enqueue(new Callback<ResponseBody>() {
@Override @Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Log.d(TAG, response.message());
} }
@Override @Override
public void onFailure(Call<ResponseBody> call, Throwable t) { public void onFailure(Call<ResponseBody> call, Throwable t) {
Log.d(TAG, t.getMessage());
} }
}); });
} }

@ -129,7 +129,7 @@
<string name="search">Search accounts…</string> <string name="search">Search accounts…</string>
<string name="toggle_nsfw">NSFW</string> <string name="toggle_nsfw">NSFW</string>
<string name="action_mention">Mention</string> <string name="action_mention">Mention</string>
<string name="tusky_api_url">http://tuskynotify.keylesspalace.com</string> <string name="tusky_api_url">https://tuskynotifier.keylesspalace.com</string>
<string name="notification_mention_format">%s mentioned you</string> <string name="notification_mention_format">%s mentioned you</string>
</resources> </resources>

Loading…
Cancel
Save