Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Upcoming Events Feature - FIX #199

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Houseclub/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ android {
targetSdkVersion 30
versionCode 9
versionName "1.0.8"

Properties properties = new Properties()
if (project.rootProject.file('local.properties').canRead()) {
properties.load(project.rootProject.file("local.properties").newDataInputStream())
}

buildConfigField "String", "INSTAGRAM_APP_ID", '"'+properties.getProperty("instagramAppId")+'"'
}
buildTypes {
release {
Expand Down
17 changes: 11 additions & 6 deletions Houseclub/src/main/java/me/grishka/houseclub/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Fragment;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
Expand All @@ -24,9 +25,12 @@
import me.grishka.houseclub.api.ClubhouseSession;
import me.grishka.houseclub.api.methods.CheckWaitlistStatus;
import me.grishka.houseclub.api.methods.GetChannel;
import me.grishka.houseclub.api.methods.GetClub;
import me.grishka.houseclub.api.methods.GetEvent;
import me.grishka.houseclub.api.methods.JoinChannel;
import me.grishka.houseclub.api.model.Channel;
import me.grishka.houseclub.api.model.Club;
import me.grishka.houseclub.fragments.ClubFragment;
import me.grishka.houseclub.fragments.HomeFragment;
import me.grishka.houseclub.fragments.InChannelFragment;
import me.grishka.houseclub.fragments.LoginFragment;
Expand All @@ -35,14 +39,14 @@

public class MainActivity extends FragmentStackActivity{

private Channel channelToJoin;
private String channelToJoin;
private static final int PERMISSION_RESULT=270;

@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);

SharedPreferences prefs=getPreferences(MODE_PRIVATE);

if(!prefs.getBoolean("warningShown", false)){
new AlertDialog.Builder(this)
.setTitle(R.string.warning)
Expand Down Expand Up @@ -94,6 +98,7 @@ public void onError(ErrorResponse error){
}
}else{
showFragment(new LoginFragment());

}
}

Expand Down Expand Up @@ -157,7 +162,7 @@ public void onSuccess(final Channel result){
.setPositiveButton(R.string.join, new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialogInterface, int i){
joinChannel(result);
joinChannel(result.channel);
}
})
.setNegativeButton(R.string.cancel, null)
Expand All @@ -172,10 +177,10 @@ public void onError(ErrorResponse error){
.exec();
}

public void joinChannel(Channel chan){
public void joinChannel(String chan){
if(VoiceService.getInstance()!=null){
Channel current=VoiceService.getInstance().getChannel();
if(current.channel.equals(chan.channel)){
if(current.channel.equals(chan)){
Bundle extras=new Bundle();
extras.putBoolean("_can_go_back", true);
InChannelFragment fragment=new InChannelFragment();
Expand All @@ -186,7 +191,7 @@ public void joinChannel(Channel chan){
VoiceService.getInstance().leaveChannel();
}
if(checkSelfPermission(Manifest.permission.RECORD_AUDIO)==PackageManager.PERMISSION_GRANTED){
new JoinChannel(chan.channel)
new JoinChannel(chan)
.wrapProgress(this)
.setCallback(new Callback<Channel>(){
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ public class ClubhouseAPIController{

private static final Uri API_URL=Uri.parse("https://www.clubhouseapi.com/api");
// private static final Uri API_URL=Uri.parse("http://192.168.0.51:8080/");
private static final String API_BUILD_ID="304";
private static final String API_BUILD_VERSION="0.1.28";
private static final String API_UA="clubhouse/"+API_BUILD_ID+" (iPhone; iOS 13.5.1; Scale/3.00)";
public static final String API_BUILD_ID="304";
public static final String API_BUILD_VERSION="0.1.28";
public static final String API_UA="clubhouse/"+API_BUILD_ID+" (iPhone; iOS 13.5.1; Scale/3.00)";

public static final String PUBNUB_PUB_KEY = "pub-c-6878d382-5ae6-4494-9099-f930f938868b";
public static final String PUBNUB_SUB_KEY = "sub-c-a4abea84-9ca3-11ea-8e71-f2b83ac9263d";

public static final String TWITTER_ID = "NyJhARWVYU1X3qJZtC2154xSI";
public static final String TWITTER_SECRET = "ylFImLBFaOE362uwr4jut8S8gXGWh93S1TUKbkfh7jDIPse02o";

public static final String INSTAGRAM_ID = "1352866981588597";
public static final String INSTAGRAM_CALLBACK = "https://www.joinclubhouse.com/callback/instagram";

public static final String AGORA_KEY = "938de3e8055e42b281bb8c6f69c21f78";
public static final String SENTRY_KEY = "[email protected]/5245095";
public static final String INSTABUG_KEY = "4e53155da9b00728caa5249f2e35d6b3";
Expand Down Expand Up @@ -150,6 +153,12 @@ public void run(){
if(DEBUG)
Log.i(TAG, "Raw response: "+respStr);
BaseResponse br=gson.fromJson(respStr, BaseResponse.class);

String error;
if (!br.errorMessage.isEmpty()) error=br.errorMessage;
else error="ERROR with code " +resp.code();
br.errorMessage = error;

req.onError(new ClubhouseErrorResponse(br));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import me.grishka.houseclub.api.ClubhouseAPIRequest;

public class AudienceReply extends ClubhouseAPIRequest<BaseResponse>{

public AudienceReply(String channel, boolean raise){
super("POST", "audience_reply", BaseResponse.class);
requestBody=new Body(channel, raise, !raise);
Expand All @@ -19,4 +20,5 @@ public Body(String channel, boolean raiseHands, boolean unraiseHands){
this.unraiseHands=unraiseHands;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.grishka.houseclub.api.methods;

import me.grishka.houseclub.api.BaseResponse;
import me.grishka.houseclub.api.ClubhouseAPIRequest;

public class FollowClub extends ClubhouseAPIRequest<BaseResponse>{
public FollowClub(int clubId){
super("POST", "follow_club", BaseResponse.class);
requestBody=new Body(clubId);
}

private static class Body{
public int clubId, source=4;

public Body(int clubId){
this.clubId=clubId;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.grishka.houseclub.api.methods;

import java.util.List;

import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.Club;
import me.grishka.houseclub.api.model.Topic;

public class GetClub extends ClubhouseAPIRequest<GetClub.Response>{

public GetClub(int id){
super("POST", "get_club", Response.class);
requestBody=new Body(id);
}

private static class Body{
public int club_id;
public Body(int club_id){ this.club_id=club_id; }
}

public static class Response{
public Club club;
public boolean is_admin;
public boolean is_member;
public boolean is_follower;
public List<Topic> topics;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package me.grishka.houseclub.api.methods;

import java.util.List;

import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.Event;

public class GetEvents extends ClubhouseAPIRequest<GetEvents.Response> {
public GetEvents(){
super("GET", "get_events", Response.class);
}

public static class Response{
public List<Event> events;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.grishka.houseclub.api.methods;

import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.Club;
import me.grishka.houseclub.api.model.FullUser;

public class GetProfile extends ClubhouseAPIRequest<GetProfile.Response>{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package me.grishka.houseclub.api.methods;

import me.grishka.houseclub.api.BaseResponse;
import me.grishka.houseclub.api.ClubhouseAPIRequest;

public class InviteToRoom extends ClubhouseAPIRequest<BaseResponse>{

public InviteToRoom(String channel, int user_id){
super("POST", "invite_to_existing_channel", BaseResponse.class);
requestBody=new Body(channel, user_id);
}

private static class Body{
public String channel;
public int user_id;

public Body(String channel, int user_id){
this.channel=channel;
this.user_id=user_id;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package me.grishka.houseclub.api.methods;

import java.util.List;

import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.Club;

public class SearchClubs extends ClubhouseAPIRequest<SearchClubs.Response> {
public SearchClubs(String query) {
super("POST", "search_clubs", Response.class);
requestBody = new Body(query);
}

private static class Body {
public String query;

public Body(String query) {
this.query = query;
}
}

public static class Response{
public List<Club> clubs;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package me.grishka.houseclub.api.methods;

import java.util.List;

import me.grishka.houseclub.api.ClubhouseAPIRequest;
import me.grishka.houseclub.api.model.FullUser;

public class SearchPeople extends ClubhouseAPIRequest<SearchPeople.Resp> {
public SearchPeople(String query) {
super("POST", "search_users", Resp.class);
requestBody = new Body(query);
}

private static class Body {
public String query;

public Body(String query) {
this.query = query;
}
}

public static class Resp {
public List<FullUser> users;
public int count;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.grishka.houseclub.api.methods;

import me.grishka.houseclub.api.BaseResponse;
import me.grishka.houseclub.api.ClubhouseAPIRequest;

public class UnfollowClub extends ClubhouseAPIRequest<BaseResponse>{
public UnfollowClub(int clubId){
super("POST", "unfollow_club", BaseResponse.class);
requestBody=new Body(clubId);
}

private static class Body{
public int clubId, source=4;

public Body(int clubId){
this.clubId=clubId;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package me.grishka.houseclub.api.methods;

import me.grishka.houseclub.api.BaseResponse;
import me.grishka.houseclub.api.ClubhouseAPIRequest;

public class UpdateInstagram extends ClubhouseAPIRequest<BaseResponse>{
public static String REDIRECT_INSTAGRAM_URL = "https://www.joinclubhouse.com/callback/instagram";
public UpdateInstagram(String code) {
super("POST", "update_instagram_username", BaseResponse.class);
requestBody = new Body(code);
}

private static class Body{
public String code;
Body(String code){
this.code = code;
}
}
}
Loading