Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
chore:events removal (#1621)
Browse files Browse the repository at this point in the history
* dismanteled a few internals

* remvoed internals

* remvoed internals

* removed the event downloading

* removed event type downloading

* removed internals

* removed internals

* removed internals

* removed internals

* removed internals

* remvoed empty repos

* removed now unused api calls

* removed internals

* remvoed internals

* remvoed card

* remvoed internals

* remvoed internals

* remvoed internals

* removed the rest of the code which is not the db

* deleted all asociated layouts

* removed the barcode scanner

* WTF????
  • Loading branch information
CommanderStorm authored Sep 20, 2023
1 parent cd13ff2 commit 95f9971
Show file tree
Hide file tree
Showing 66 changed files with 7 additions and 3,494 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ dependencies {
// UI
implementation 'com.github.mtotschnig:StickyListHeaders:2.8.0'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'me.dm7.barcodescanner:zxing:1.9.13'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation 'me.dm7.barcodescanner:zxing:1.9.13' // unused, but removal leads to build errors
implementation 'com.journeyapps:zxing-android-embedded:3.6.0' // unused, but removal leads to build errors
implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0'
implementation 'com.github.thellmund.Android-Week-View:core:4.1.6'
implementation 'de.hdodenhof:circleimageview:3.1.0'
Expand Down
43 changes: 1 addition & 42 deletions app/src/main/java/de/tum/in/tumcampusapp/api/app/ApiHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,12 @@

import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Build;

import com.franmontiel.persistentcookiejar.PersistentCookieJar;
import com.franmontiel.persistentcookiejar.cache.SetCookieCache;
import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.Writer;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.journeyapps.barcodescanner.BarcodeEncoder;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import java.util.concurrent.TimeUnit;

import de.tum.in.tumcampusapp.BuildConfig;
Expand Down Expand Up @@ -99,36 +90,4 @@ private static Interceptor getDeviceInterceptor(final Context c) {
};
}

/**
* encodes an url
*
* @param pUrl input url
* @return encoded url
*/
public static String encodeUrl(String pUrl) {
try {
return URLEncoder.encode(pUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}

/**
* Creates an offline QR-Code
*
* @param message to be encoded
* @return QR-Code or null if there was an error
*/
public static Bitmap createQRCode(String message) {
Writer multiFormatWriter = new MultiFormatWriter();
try {
BitMatrix bitMatrix = multiFormatWriter.encode(message, BarcodeFormat.QR_CODE, 400, 400);
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
return barcodeEncoder.createBitmap(bitMatrix);
} catch (WriterException e) {
Utils.log(e);
return null;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import de.tum.in.tumcampusapp.api.app.model.DeviceUploadFcmToken;
import de.tum.in.tumcampusapp.api.app.model.ObfuscatedIdsUpload;
import de.tum.in.tumcampusapp.api.app.model.TUMCabeStatus;
import de.tum.in.tumcampusapp.api.app.model.TUMCabeVerification;
import de.tum.in.tumcampusapp.api.app.model.UploadStatus;
import de.tum.in.tumcampusapp.component.tumui.feedback.model.Feedback;
import de.tum.in.tumcampusapp.component.tumui.feedback.model.FeedbackResult;
Expand All @@ -19,15 +18,9 @@
import de.tum.in.tumcampusapp.component.ui.news.model.NewsAlert;
import de.tum.in.tumcampusapp.component.ui.openinghour.model.Location;
import de.tum.in.tumcampusapp.component.ui.studyroom.model.StudyRoomGroup;
import de.tum.in.tumcampusapp.component.ui.ticket.model.Event;
import de.tum.in.tumcampusapp.component.ui.ticket.model.Ticket;
import de.tum.in.tumcampusapp.component.ui.ticket.model.TicketType;
import de.tum.in.tumcampusapp.component.ui.ticket.payload.TicketReservationResponse;
import de.tum.in.tumcampusapp.component.ui.ticket.payload.TicketStatus;
import de.tum.in.tumcampusapp.component.ui.tufilm.model.Kino;
import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.Single;
import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
Expand All @@ -43,7 +36,6 @@
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_CAFETERIAS;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_CHAT_MEMBERS;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_DEVICE;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_EVENTS;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_FEEDBACK;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_KINOS;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_LOCATIONS;
Expand All @@ -52,7 +44,6 @@
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_NOTIFICATIONS;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_OPENING_HOURS;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_STUDY_ROOMS;
import static de.tum.in.tumcampusapp.api.app.TUMCabeClient.API_TICKET;

public interface TUMCabeAPIService {
@POST(API_CHAT_MEMBERS)
Expand Down Expand Up @@ -112,41 +103,6 @@ public interface TUMCabeAPIService {
@GET(API_STUDY_ROOMS)
Call<List<StudyRoomGroup>> getStudyRoomGroups();

// TICKET SALE

// Getting Event information

@GET(API_EVENTS + "list")
@Deprecated
/// This endpoint won't be avaliable in the v2 backend
Observable<List<Event>> getEvents();

// Getting Ticket information
@POST(API_EVENTS + API_TICKET + "my")
@Deprecated
/// This endpoint won't be avaliable in the v2 backend
Observable<List<Ticket>> getTickets(@Body TUMCabeVerification verification);

@POST(API_EVENTS + API_TICKET + "{ticketID}")
@Deprecated
/// This endpoint won't be avaliable in the v2 backend
Call<Ticket> getTicket(@Path("ticketID") int ticketID, @Body TUMCabeVerification verification);

@GET(API_EVENTS + API_TICKET + "type/{eventID}")
@Deprecated
/// This endpoint won't be avaliable in the v2 backend
Observable<List<TicketType>> getTicketTypes(@Path("eventID") int eventID);

// Ticket reservation
@POST(API_EVENTS + API_TICKET + "reserve/multiple")
@Deprecated
/// This endpoint won't be avaliable in the v2 backend
Call<TicketReservationResponse> reserveTicket(@Body TUMCabeVerification verification);

@GET(API_EVENTS + API_TICKET + "status/{event}")
@Deprecated
/// This endpoint won't be avaliable in the v2 backend
Single<List<TicketStatus>> getTicketStats(@Path("event") int event);

// Opening Hours
@GET(API_OPENING_HOURS + "{language}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,14 @@
import de.tum.in.tumcampusapp.component.ui.barrierfree.model.BarrierFreeMoreInfo;
import de.tum.in.tumcampusapp.component.ui.cafeteria.model.Cafeteria;
import de.tum.in.tumcampusapp.component.ui.chat.model.ChatMember;
import de.tum.in.tumcampusapp.component.ui.chat.model.ChatMessage;
import de.tum.in.tumcampusapp.component.ui.chat.model.ChatRoom;
import de.tum.in.tumcampusapp.component.ui.news.model.News;
import de.tum.in.tumcampusapp.component.ui.news.model.NewsAlert;
import de.tum.in.tumcampusapp.component.ui.news.model.NewsSources;
import de.tum.in.tumcampusapp.component.ui.openinghour.model.Location;
import de.tum.in.tumcampusapp.component.ui.studyroom.model.StudyRoomGroup;
import de.tum.in.tumcampusapp.component.ui.ticket.model.Event;
import de.tum.in.tumcampusapp.component.ui.ticket.model.Ticket;
import de.tum.in.tumcampusapp.component.ui.ticket.model.TicketType;
import de.tum.in.tumcampusapp.component.ui.ticket.payload.TicketReservationResponse;
import de.tum.in.tumcampusapp.component.ui.ticket.payload.TicketStatus;
import de.tum.in.tumcampusapp.component.ui.tufilm.model.Kino;
import de.tum.in.tumcampusapp.utils.Const;
import de.tum.in.tumcampusapp.utils.Utils;
import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.Single;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
Expand All @@ -54,7 +44,6 @@
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.http.Body;

/**
* Proxy class for Retrofit client to our API hosted @app.tum.de
Expand All @@ -68,22 +57,14 @@ public final class TUMCabeClient {
static final String API_BARRIER_FREE = "barrierfree/";
static final String API_BARRIER_FREE_CONTACT = "contacts/";
static final String API_BARRIER_FREE_MORE_INFO = "moreInformation/";
static final String API_ROOM_FINDER = "roomfinder/room/";
static final String API_ROOM_FINDER_COORDINATES = "coordinates/";
static final String API_ROOM_FINDER_AVAILABLE_MAPS = "availableMaps/";
static final String API_ROOM_FINDER_SCHEDULE = "scheduleById/";
static final String API_FEEDBACK = "feedback/";
static final String API_CAFETERIAS = "mensen/";
static final String API_KINOS = "kino/";
static final String API_NEWS = "news/";
static final String API_EVENTS = "event/";
static final String API_TICKET = "ticket/";
static final String API_STUDY_ROOMS = "studyroom/list";
private static final String API_HOSTNAME = Const.API_HOSTNAME;
private static final String API_BASEURL = "/Api/";
private static final String API_CHAT = "chat/";
static final String API_CHAT_ROOMS = API_CHAT + "rooms/";
static final String API_CHAT_MEMBERS = API_CHAT + "members/";
static final String API_CHAT_MEMBERS = "chat/members/";
static final String API_OPENING_HOURS = "openingtimes/";

private static TUMCabeClient instance;
Expand Down Expand Up @@ -225,52 +206,6 @@ public Call<List<StudyRoomGroup>> getStudyRoomGroups() {
return service.getStudyRoomGroups();
}

// TICKET SALE

// Getting event information
@Deprecated
/// This endpoint won't be avaliable in the v2 backend
public Observable<List<Event>> fetchEvents() {
return service.getEvents();
}

// Getting ticket information

@Deprecated
/// This endpoint won't be avaliable in the v2 backend
public Observable<List<Ticket>> fetchTickets(Context context) throws NoPrivateKey {
TUMCabeVerification verification = getVerification(context, null);
return service.getTickets(verification);
}

@Deprecated
/// This endpoint won't be avaliable in the v2 backend
public Call<Ticket> fetchTicket(Context context, int ticketID) throws NoPrivateKey {
TUMCabeVerification verification = getVerification(context, null);
return service.getTicket(ticketID, verification);
}

@Deprecated
/// This endpoint won't be avaliable in the v2 backend
public Observable<List<TicketType>> fetchTicketTypes(int eventID) {
return service.getTicketTypes(eventID);
}

// Ticket reservation

@Deprecated
/// This endpoint won't be avaliable in the v2 backend
public void reserveTicket(TUMCabeVerification verification,
Callback<TicketReservationResponse> cb) {
service.reserveTicket(verification).enqueue(cb);
}

@Deprecated
/// This endpoint won't be avaliable in the v2 backend
public Single<List<TicketStatus>> fetchTicketStats(int event) {
return service.getTicketStats(event);
}

public List<Location> fetchOpeningHours(String language) throws IOException {
return service.getOpeningHours(language)
.execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ abstract class ActivityForDownloadingExternal(layoutId: Int) : ProgressActivity<
*
* @param forceDownload If we should throw away cached data and re-download instead.
*/
protected fun requestDownload(forceDownload: CacheControl) {
private fun requestDownload(forceDownload: CacheControl) {
if (!NetUtils.isConnected(this)) {
Utils.showToast(this, R.string.no_internet_connection)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import de.tum.`in`.tumcampusapp.component.ui.news.TopNewsCard
import de.tum.`in`.tumcampusapp.component.ui.onboarding.LoginPromptCard
import de.tum.`in`.tumcampusapp.component.ui.overview.card.Card
import de.tum.`in`.tumcampusapp.component.ui.overview.card.CardViewHolder
import de.tum.`in`.tumcampusapp.component.ui.ticket.EventCard
import de.tum.`in`.tumcampusapp.component.ui.transportation.MVVCard
import de.tum.`in`.tumcampusapp.component.ui.updatenote.UpdateNoteCard
import java.util.*
Expand All @@ -39,7 +38,6 @@ class CardAdapter(private val interactionListener: CardInteractionListener) : Re
CardManager.CardTypes.SUPPORT.id -> return SupportCard.inflateViewHolder(viewGroup, interactionListener)
CardManager.CardTypes.LOGIN.id -> return LoginPromptCard.inflateViewHolder(viewGroup, interactionListener)
CardManager.CardTypes.TOP_NEWS.id -> return TopNewsCard.inflateViewHolder(viewGroup, interactionListener)
CardManager.CardTypes.EVENT.id -> return EventCard.inflateViewHolder(viewGroup, interactionListener)
CardManager.CardTypes.UPDATE_NOTE.id -> return UpdateNoteCard.inflateViewHolder(viewGroup, interactionListener)
else -> throw UnsupportedOperationException()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ object CardManager {
LOGIN(R.layout.card_login_prompt, R.string.login_default_sharedpref_shown),
EDUROAM_FIX(R.layout.card_eduroam_fix, R.string.eduroam_fix_default_sharedpref_shown),
TOP_NEWS(R.layout.card_top_news, R.string.top_news_default_sharedpref_shown),
EVENT(R.layout.card_events_item, R.string.event_default_sharedpref_shown),
UPDATE_NOTE(R.layout.card_update_note, R.string.update_note_default_sharedpref_shown)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import de.tum.`in`.tumcampusapp.component.ui.news.TopNewsCard
import de.tum.`in`.tumcampusapp.component.ui.onboarding.LoginPromptCard
import de.tum.`in`.tumcampusapp.component.ui.overview.card.Card
import de.tum.`in`.tumcampusapp.component.ui.overview.card.ProvidesCard
import de.tum.`in`.tumcampusapp.component.ui.ticket.EventCardsProvider
import de.tum.`in`.tumcampusapp.component.ui.transportation.TransportController
import de.tum.`in`.tumcampusapp.component.ui.updatenote.UpdateNoteCard
import de.tum.`in`.tumcampusapp.utils.Utils
Expand All @@ -25,10 +24,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import javax.inject.Inject

class CardsRepository @Inject constructor(
private val context: Context,
private val eventCardsProvider: EventCardsProvider
) {
class CardsRepository @Inject constructor(private val context: Context) {

private var cards = MutableLiveData<List<Card>>()

Expand Down Expand Up @@ -77,7 +73,6 @@ class CardsRepository @Inject constructor(
add(CafeteriaManager(context))
add(TransportController(context))
add(NewsController(context))
add(eventCardsProvider)
}

providers.forEach { provider ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package de.tum.`in`.tumcampusapp.component.ui.overview.card

import android.content.Context
import android.view.Gravity
import android.view.MenuItem
import android.view.View
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.PopupMenu
import androidx.recyclerview.widget.RecyclerView
import de.tum.`in`.tumcampusapp.R
import de.tum.`in`.tumcampusapp.component.other.navigation.NavigationManager
import de.tum.`in`.tumcampusapp.component.other.settings.SettingsActivity
import de.tum.`in`.tumcampusapp.component.ui.overview.CardInteractionListener

open class CardViewHolder @JvmOverloads constructor(
Expand All @@ -23,49 +16,4 @@ open class CardViewHolder @JvmOverloads constructor(
private val context: Context by lazy { itemView.context }

protected val activity: AppCompatActivity by lazy { context as AppCompatActivity }

init {
itemView.setOnClickListener {
val destination = currentCard?.getNavigationDestination() ?: return@setOnClickListener
NavigationManager.open(activity, destination)
}

val moreIcon = itemView.findViewById<ImageView>(R.id.cardMoreIcon)
moreIcon?.setOnClickListener { openOptionsPopup(it) }
}

private fun openOptionsPopup(anchorView: View) {
val card = currentCard ?: return

PopupMenu(context, anchorView, Gravity.END).apply {
menuInflater.inflate(card.optionsMenuResId, menu)
setOnMenuItemClickListener { onOptionSelected(it) }
show()
}
}

private fun onOptionSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.open_card_setting -> openCardSettings()
R.id.always_hide_card -> alwaysHideCard()
}

return true
}

private fun openCardSettings() {
val resId = currentCard?.cardType?.showCardPreferenceStringRes ?: return
val key = context.getString(resId)
val intent = SettingsActivity.newIntent(context, key)
context.startActivity(intent)
}

private fun alwaysHideCard() {
if (adapterPosition != RecyclerView.NO_POSITION) {
listener?.onAlwaysHideCard(adapterPosition)
}

currentCard?.hideAlways()
currentCard?.discard()
}
}
Loading

0 comments on commit 95f9971

Please sign in to comment.