소스 검색

Start call on click + some signaling settings

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 년 전
부모
커밋
00eac7549e

+ 4 - 0
app/src/main/java/com/nextcloud/talk/api/NcApi.java

@@ -30,6 +30,7 @@ import com.nextcloud.talk.api.models.json.rooms.RoomOverall;
 import com.nextcloud.talk.api.models.json.rooms.RoomsOverall;
 import com.nextcloud.talk.api.models.json.sharees.ShareesOverall;
 import com.nextcloud.talk.api.models.json.signaling.SignalingOverall;
+import com.nextcloud.talk.api.models.json.signaling.settings.SignalingSettingsOverall;
 import com.nextcloud.talk.api.models.json.userprofile.UserProfileOverall;
 
 import java.util.Map;
@@ -159,6 +160,9 @@ public interface NcApi {
     @POST
     Observable<GenericOverall> pingCall(@Header("Authorization") String authorization, @Url String url);
 
+    @GET
+    Observable<SignalingSettingsOverall> getSignalingSettings(@Header("Authorization") String authorization, @Url
+            String url);
     /*
         QueryMap items are as follows:
             - "messages" : "message"

+ 5 - 0
app/src/main/java/com/nextcloud/talk/api/helpers/api/ApiHelper.java

@@ -130,6 +130,11 @@ public class ApiHelper {
         return baseUrl + ocsApiVersion + spreedApiVersion + "/signaling";
     }
 
+    public static String getUrlForSignalingSettings(String baseUrl) {
+        return getUrlForSignaling(baseUrl) + "/settings";
+    }
+
+
     public static String getUrlForUserProfile(String baseUrl) {
         return baseUrl + ocsApiVersion + "/cloud/user";
     }

+ 0 - 1
app/src/main/java/com/nextcloud/talk/api/models/json/signaling/SignalingOverall.java

@@ -30,5 +30,4 @@ import lombok.Data;
 public class SignalingOverall {
     @JsonField(name = "ocs")
     SignalingOCS ocs;
-
 }

+ 39 - 0
app/src/main/java/com/nextcloud/talk/api/models/json/signaling/settings/IceServer.java

@@ -0,0 +1,39 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.talk.api.models.json.signaling.settings;
+
+import com.bluelinelabs.logansquare.annotation.JsonField;
+import com.bluelinelabs.logansquare.annotation.JsonObject;
+
+import lombok.Data;
+
+@Data
+@JsonObject
+public class IceServer {
+    @JsonField(name = "url")
+    String url;
+
+    @JsonField(name = "username")
+    String username;
+
+    @JsonField(name = "credential")
+    String credential;
+}

+ 38 - 0
app/src/main/java/com/nextcloud/talk/api/models/json/signaling/settings/Settings.java

@@ -0,0 +1,38 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.talk.api.models.json.signaling.settings;
+
+import com.bluelinelabs.logansquare.annotation.JsonField;
+import com.bluelinelabs.logansquare.annotation.JsonObject;
+
+import java.util.List;
+
+import lombok.Data;
+
+@Data
+@JsonObject
+public class Settings {
+    @JsonField(name = "stunservers")
+    List<IceServer> stunServers;
+
+    @JsonField(name = "turnservers")
+    List<IceServer> turnServers;
+}

+ 34 - 0
app/src/main/java/com/nextcloud/talk/api/models/json/signaling/settings/SignalingSettingsOcs.java

@@ -0,0 +1,34 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.talk.api.models.json.signaling.settings;
+
+import com.bluelinelabs.logansquare.annotation.JsonField;
+import com.bluelinelabs.logansquare.annotation.JsonObject;
+import com.nextcloud.talk.api.models.json.generic.GenericOCS;
+
+import lombok.Data;
+
+@Data
+@JsonObject
+public class SignalingSettingsOcs extends GenericOCS {
+    @JsonField(name = "data")
+    Settings settings;
+}

+ 34 - 0
app/src/main/java/com/nextcloud/talk/api/models/json/signaling/settings/SignalingSettingsOverall.java

@@ -0,0 +1,34 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Mario Danic
+ * Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.talk.api.models.json.signaling.settings;
+
+import com.bluelinelabs.logansquare.annotation.JsonField;
+import com.bluelinelabs.logansquare.annotation.JsonObject;
+import com.nextcloud.talk.api.models.json.signaling.SignalingOCS;
+
+import lombok.Data;
+
+@Data
+@JsonObject
+public class SignalingSettingsOverall {
+    @JsonField(name = "ocs")
+    SignalingOCS ocs;
+}

+ 14 - 4
app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java

@@ -22,6 +22,7 @@ package com.nextcloud.talk.controllers;
 
 import android.app.SearchManager;
 import android.content.Context;
+import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
 import android.support.annotation.NonNull;
@@ -44,12 +45,13 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
 import android.view.inputmethod.EditorInfo;
-import android.widget.Toast;
 
 import com.bluelinelabs.conductor.RouterTransaction;
 import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
 import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler;
+import com.bluelinelabs.conductor.internal.NoOpControllerChangeHandler;
 import com.nextcloud.talk.R;
+import com.nextcloud.talk.activities.CallActivity;
 import com.nextcloud.talk.adapters.items.UserItem;
 import com.nextcloud.talk.api.NcApi;
 import com.nextcloud.talk.api.helpers.api.ApiHelper;
@@ -60,8 +62,11 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
 import com.nextcloud.talk.controllers.base.BaseController;
 import com.nextcloud.talk.models.RetrofitBucket;
 import com.nextcloud.talk.persistence.entities.UserEntity;
+import com.nextcloud.talk.utils.bundle.BundleBuilder;
 import com.nextcloud.talk.utils.database.user.UserUtils;
 
+import org.parceler.Parcels;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -450,9 +455,14 @@ public class ContactsController extends BaseController implements SearchView.OnQ
 
                         @Override
                         public void onNext(RoomOverall roomOverall) {
-                            Toast.makeText(getActivity(), String.format(getResources().getString(R.string
-                                    .nc_contacts_click), userItem.getModel().getName())
-                                    ,Toast.LENGTH_SHORT).show();
+                            overridePushHandler(new NoOpControllerChangeHandler());
+                            overridePopHandler(new NoOpControllerChangeHandler());
+                            Intent callIntent = new Intent(getActivity(), CallActivity.class);
+                            BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
+                            bundleBuilder.putString("roomToken", roomOverall.getOcs().getRoomId());
+                            bundleBuilder.putParcelable("userEntity", Parcels.wrap(userEntity));
+                            callIntent.putExtras(bundleBuilder.build());
+                            startActivity(callIntent);
                         }
 
                         @Override

+ 0 - 1
app/src/main/res/values/strings.xml

@@ -75,7 +75,6 @@
     <!-- Contacts -->
     <string name="nc_one_contact_selected">contact selected</string>
     <string name="nc_more_contacts_selected">contacts selected</string>
-    <string name="nc_contacts_click">Call with %1$s was created</string>
 
 
 </resources>