mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-02-17 04:20:45 +01:00
New instance acad + matomo (acad flavor only)
This commit is contained in:
parent
14cde8e625
commit
5eedadef47
@ -40,7 +40,7 @@ android {
|
|||||||
}
|
}
|
||||||
//boolean full_instances if set to false means TubeAcad
|
//boolean full_instances if set to false means TubeAcad
|
||||||
productFlavors {
|
productFlavors {
|
||||||
fdroid_acad {
|
fdroid_peertube_apps_educ {
|
||||||
applicationId "app.fedilab.fedilabtube"
|
applicationId "app.fedilab.fedilabtube"
|
||||||
resValue "string", "app_name", "TubeAcad"
|
resValue "string", "app_name", "TubeAcad"
|
||||||
resValue "string", "app_id", "app.fedilab.fedilabtube"
|
resValue "string", "app_id", "app.fedilab.fedilabtube"
|
||||||
@ -51,7 +51,7 @@ android {
|
|||||||
buildConfigField "boolean", "sepia_search", "false"
|
buildConfigField "boolean", "sepia_search", "false"
|
||||||
buildConfigField "boolean", "instance_switcher", "true"
|
buildConfigField "boolean", "instance_switcher", "true"
|
||||||
}
|
}
|
||||||
google_acad {
|
google_peertube_apps_educ {
|
||||||
applicationId "app.fedilab.fedilabtube"
|
applicationId "app.fedilab.fedilabtube"
|
||||||
resValue "string", "app_name", "TubeAcad"
|
resValue "string", "app_name", "TubeAcad"
|
||||||
resValue "string", "app_id", "app.fedilab.fedilabtube"
|
resValue "string", "app_id", "app.fedilab.fedilabtube"
|
||||||
@ -110,11 +110,11 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
fdroid_acad {
|
fdroid_peertube_apps_educ {
|
||||||
res.srcDirs = ['src/main/res', 'src/acad/res']
|
res.srcDirs = ['src/main/res', 'src/acad/res']
|
||||||
java.srcDirs = ['src/main/java', 'src/acad/java']
|
java.srcDirs = ['src/main/java', 'src/acad/java']
|
||||||
}
|
}
|
||||||
google_acad {
|
google_peertube_apps_educ {
|
||||||
res.srcDirs = ['src/main/res', 'src/acad/res']
|
res.srcDirs = ['src/main/res', 'src/acad/res']
|
||||||
java.srcDirs = ['src/main/java', 'src/acad/java']
|
java.srcDirs = ['src/main/java', 'src/acad/java']
|
||||||
}
|
}
|
||||||
@ -196,8 +196,8 @@ dependencies {
|
|||||||
implementation 'org.slf4j:slf4j-simple:1.7.30'
|
implementation 'org.slf4j:slf4j-simple:1.7.30'
|
||||||
|
|
||||||
|
|
||||||
fdroid_acadImplementation 'org.matomo.sdk:tracker:4.1.2'
|
fdroid_peertube_apps_educImplementation 'org.matomo.sdk:tracker:4.1.2'
|
||||||
google_acadImplementation 'org.matomo.sdk:tracker:4.1.2'
|
google_peertube_apps_educImplementation 'org.matomo.sdk:tracker:4.1.2'
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -15,18 +15,21 @@ package app.fedilab.fedilabtube;
|
|||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.matomo.sdk.Matomo;
|
import org.matomo.sdk.Matomo;
|
||||||
import org.matomo.sdk.Tracker;
|
import org.matomo.sdk.Tracker;
|
||||||
import org.matomo.sdk.TrackerBuilder;
|
import org.matomo.sdk.TrackerBuilder;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class FedilabTube extends BaseFedilabTube {
|
public class FedilabTube extends BaseFedilabTube {
|
||||||
|
|
||||||
private Tracker mMatomoTracker;
|
private Tracker mMatomoTracker;
|
||||||
|
|
||||||
public synchronized Tracker getTracker() {
|
public synchronized Tracker getTracker() {
|
||||||
if (mMatomoTracker != null) return mMatomoTracker;
|
if (mMatomoTracker != null) return mMatomoTracker;
|
||||||
mMatomoTracker = TrackerBuilder.createDefault("https://wa.phm.education.gouv.fr/snp/", 11).build(Matomo.getInstance(this));
|
mMatomoTracker = TrackerBuilder.createDefault("https://wa.phm.education.gouv.fr/snp/matomo.php", 11).build(Matomo.getInstance(this));
|
||||||
return mMatomoTracker;
|
return mMatomoTracker;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,6 +17,4 @@ package app.fedilab.fedilabtube;
|
|||||||
|
|
||||||
|
|
||||||
public class FedilabTube extends BaseFedilabTube {
|
public class FedilabTube extends BaseFedilabTube {
|
||||||
|
|
||||||
public void getTracker() {}
|
|
||||||
}
|
}
|
@ -15,19 +15,27 @@ package app.fedilab.fedilabtube;
|
|||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings({"unused", "RedundantSuppression"})
|
||||||
public class Matomo {
|
public class Matomo {
|
||||||
|
|
||||||
public static void sendScreen(Context _mcontext, String path, String title) {}
|
public static void sendScreen(Context _mcontext, String path, String title) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendEvent(Context _mcontext, String category, String action, String label, float value) {}
|
public static void sendEvent(Context _mcontext, String category, String action, String label, float value) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void sendValue(Context _mcontext, String path, int index, String dimensionValue) {}
|
public static void sendValue(Context _mcontext, String path, int index, String dimensionValue) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void trackInstall(Context _mcontext) {}
|
public static void trackInstall(Context _mcontext) {
|
||||||
|
//Do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,12 +197,15 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
private final BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
= item -> {
|
= item -> {
|
||||||
int itemId = item.getItemId();
|
int itemId = item.getItemId();
|
||||||
|
String type = null;
|
||||||
if (itemId == R.id.navigation_discover) {
|
if (itemId == R.id.navigation_discover) {
|
||||||
setTitleCustom(R.string.title_discover);
|
setTitleCustom(R.string.title_discover);
|
||||||
binding.viewpager.setCurrentItem(0);
|
binding.viewpager.setCurrentItem(0);
|
||||||
|
type = HelperAcadInstance.DISCOVER;
|
||||||
} else if (itemId == R.id.navigation_subscription) {
|
} else if (itemId == R.id.navigation_subscription) {
|
||||||
binding.viewpager.setCurrentItem(1);
|
binding.viewpager.setCurrentItem(1);
|
||||||
setTitleCustom(R.string.subscriptions);
|
setTitleCustom(R.string.subscriptions);
|
||||||
|
type = HelperAcadInstance.SUBSCRIPTIONS;
|
||||||
} else if (itemId == R.id.navigation_trending) {
|
} else if (itemId == R.id.navigation_trending) {
|
||||||
setTitleCustom(R.string.title_trending);
|
setTitleCustom(R.string.title_trending);
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
@ -210,15 +213,22 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
} else {
|
} else {
|
||||||
binding.viewpager.setCurrentItem(1);
|
binding.viewpager.setCurrentItem(1);
|
||||||
}
|
}
|
||||||
|
type = HelperAcadInstance.TRENDING;
|
||||||
} else if (itemId == R.id.navigation_most_liked) {
|
} else if (itemId == R.id.navigation_most_liked) {
|
||||||
setTitleCustom(R.string.title_most_liked);
|
setTitleCustom(R.string.title_most_liked);
|
||||||
binding.viewpager.setCurrentItem(2);
|
binding.viewpager.setCurrentItem(2);
|
||||||
|
type = HelperAcadInstance.MOSTLIKED;
|
||||||
} else if (itemId == R.id.navigation_recently_added) {
|
} else if (itemId == R.id.navigation_recently_added) {
|
||||||
setTitleCustom(R.string.title_recently_added);
|
setTitleCustom(R.string.title_recently_added);
|
||||||
binding.viewpager.setCurrentItem(3);
|
binding.viewpager.setCurrentItem(3);
|
||||||
|
type = HelperAcadInstance.RECENTLY_ADDED;
|
||||||
} else if (itemId == R.id.navigation_local) {
|
} else if (itemId == R.id.navigation_local) {
|
||||||
setTitleCustom(R.string.title_local);
|
setTitleCustom(R.string.title_local);
|
||||||
binding.viewpager.setCurrentItem(4);
|
binding.viewpager.setCurrentItem(4);
|
||||||
|
type = HelperAcadInstance.LOCAL;
|
||||||
|
}
|
||||||
|
if (type != null) {
|
||||||
|
Matomo.sendScreen(MainActivity.this, "TIMELINE", type);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -385,6 +395,8 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
}
|
}
|
||||||
binding.viewpager.setOffscreenPageLimit(5);
|
binding.viewpager.setOffscreenPageLimit(5);
|
||||||
|
|
||||||
|
Matomo.sendEvent(MainActivity.this, "UTILISATEUR", "DEMARRAGE", HelperInstance.getLiveInstance(MainActivity.this), Helper.isLoggedIn(MainActivity.this) ? 1 : 0);
|
||||||
|
|
||||||
|
|
||||||
binding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
binding.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -405,6 +417,7 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
toolbar.setOnClickListener(v -> {
|
toolbar.setOnClickListener(v -> {
|
||||||
if (binding.viewpager.getAdapter() == null) {
|
if (binding.viewpager.getAdapter() == null) {
|
||||||
return;
|
return;
|
||||||
@ -771,13 +784,16 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
String type = null;
|
||||||
|
String action = "TIMELINE";
|
||||||
if (item.getItemId() == R.id.action_change_instance) {
|
if (item.getItemId() == R.id.action_change_instance) {
|
||||||
if (BuildConfig.full_instances) {
|
if (BuildConfig.full_instances) {
|
||||||
showRadioButtonDialogFullInstances(MainActivity.this, false);
|
showRadioButtonDialogFullInstances(MainActivity.this, false);
|
||||||
} else {
|
} else {
|
||||||
showRadioButtonDialog();
|
showRadioButtonDialog();
|
||||||
}
|
}
|
||||||
return true;
|
action = "CHANGE_INSTANCE";
|
||||||
|
type = "";
|
||||||
} else if (item.getItemId() == R.id.action_settings) {
|
} else if (item.getItemId() == R.id.action_settings) {
|
||||||
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
|
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
@ -793,32 +809,30 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_upload) {
|
} else if (item.getItemId() == R.id.action_upload) {
|
||||||
Intent intent = new Intent(MainActivity.this, PeertubeUploadActivity.class);
|
Intent intent = new Intent(MainActivity.this, PeertubeUploadActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_myvideos) {
|
} else if (item.getItemId() == R.id.action_myvideos) {
|
||||||
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("type", TimelineVM.TimelineType.MY_VIDEOS);
|
bundle.putSerializable("type", TimelineVM.TimelineType.MY_VIDEOS);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
type = HelperAcadInstance.MYVIDEOS;
|
||||||
} else if (item.getItemId() == R.id.action_history) {
|
} else if (item.getItemId() == R.id.action_history) {
|
||||||
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("type", TimelineVM.TimelineType.HISTORY);
|
bundle.putSerializable("type", TimelineVM.TimelineType.HISTORY);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
type = HelperAcadInstance.HISTORY;
|
||||||
} else if (item.getItemId() == R.id.action_most_liked) {
|
} else if (item.getItemId() == R.id.action_most_liked) {
|
||||||
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
Intent intent = new Intent(MainActivity.this, VideosTimelineActivity.class);
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("type", TimelineVM.TimelineType.MOST_LIKED);
|
bundle.putSerializable("type", TimelineVM.TimelineType.MOST_LIKED);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
type = HelperAcadInstance.MOSTLIKED;
|
||||||
} else if (item.getItemId() == R.id.action_playlist) {
|
} else if (item.getItemId() == R.id.action_playlist) {
|
||||||
Intent intent;
|
Intent intent;
|
||||||
if (Helper.isLoggedIn(MainActivity.this)) {
|
if (Helper.isLoggedIn(MainActivity.this)) {
|
||||||
@ -827,15 +841,12 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
intent = new Intent(MainActivity.this, AllLocalPlaylistsActivity.class);
|
intent = new Intent(MainActivity.this, AllLocalPlaylistsActivity.class);
|
||||||
}
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_sepia_search) {
|
} else if (item.getItemId() == R.id.action_sepia_search) {
|
||||||
Intent intent = new Intent(MainActivity.this, SepiaSearchActivity.class);
|
Intent intent = new Intent(MainActivity.this, SepiaSearchActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_about) {
|
} else if (item.getItemId() == R.id.action_about) {
|
||||||
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
|
||||||
} else if (item.getItemId() == R.id.action_incognito) {
|
} else if (item.getItemId() == R.id.action_incognito) {
|
||||||
item.setChecked(!item.isChecked());
|
item.setChecked(!item.isChecked());
|
||||||
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
@ -854,8 +865,10 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
|
|||||||
}).start();
|
}).start();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (type != null) {
|
||||||
return super.onOptionsItemSelected(item);
|
Matomo.sendScreen(MainActivity.this, action, type);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
peertube = apiResponse.getPeertubes().get(0);
|
peertube = apiResponse.getPeertubes().get(0);
|
||||||
Matomo.sendScreen(PeertubeActivity.this, "video", peertube.getOriginUrl());
|
Matomo.sendScreen(PeertubeActivity.this, "VIDEO_REGARDEE", peertube.getUuid());
|
||||||
if (peertube.isNsfw()) {
|
if (peertube.isNsfw()) {
|
||||||
binding.videoSensitive.setVisibility(View.VISIBLE);
|
binding.videoSensitive.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
@ -2021,8 +2021,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
|||||||
}
|
}
|
||||||
} else if (peertube.isCommentsEnabled() && statusAction == REPLY) {
|
} else if (peertube.isCommentsEnabled() && statusAction == REPLY) {
|
||||||
if (apiResponse.getComments() != null && apiResponse.getComments().size() > 0) {
|
if (apiResponse.getComments() != null && apiResponse.getComments().size() > 0) {
|
||||||
commentsThread.add(position, apiResponse.getComments().get(0));
|
commentsThread.add(position + 1, apiResponse.getComments().get(0));
|
||||||
commentReplyListAdapter.notifyItemInserted(position);
|
commentReplyListAdapter.notifyItemInserted(position + 1);
|
||||||
}
|
}
|
||||||
} else if (statusAction == RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT) {
|
} else if (statusAction == RetrofitPeertubeAPI.ActionType.REPORT_ACCOUNT) {
|
||||||
Toasty.success(PeertubeActivity.this, getString(R.string.successful_report), Toasty.LENGTH_LONG).show();
|
Toasty.success(PeertubeActivity.this, getString(R.string.successful_report), Toasty.LENGTH_LONG).show();
|
||||||
|
@ -43,7 +43,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import app.fedilab.fedilabtube.BuildConfig;
|
import app.fedilab.fedilabtube.BuildConfig;
|
||||||
import app.fedilab.fedilabtube.MainActivity;
|
import app.fedilab.fedilabtube.MainActivity;
|
||||||
import app.fedilab.fedilabtube.Matomo;
|
|
||||||
import app.fedilab.fedilabtube.R;
|
import app.fedilab.fedilabtube.R;
|
||||||
import app.fedilab.fedilabtube.client.APIResponse;
|
import app.fedilab.fedilabtube.client.APIResponse;
|
||||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||||
@ -129,7 +128,6 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
|||||||
endDate = bundle.getString("endDate", null);
|
endDate = bundle.getString("endDate", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Matomo.sendScreen(getContext(), "timeline", String.valueOf(type));
|
|
||||||
if (channel != null) {
|
if (channel != null) {
|
||||||
channelId = channel.getAcct();
|
channelId = channel.getAcct();
|
||||||
} else if (account != null) {
|
} else if (account != null) {
|
||||||
|
@ -23,6 +23,15 @@ public class HelperAcadInstance {
|
|||||||
|
|
||||||
public static Map<String, String> instances_themes;
|
public static Map<String, String> instances_themes;
|
||||||
|
|
||||||
|
public static String LOCAL = "LOCALES";
|
||||||
|
public static String DISCOVER = "DECOUVRIR";
|
||||||
|
public static String MOSTLIKED = "PLUS_APPRECIEES";
|
||||||
|
public static String RECENTLY_ADDED = "AJOUTE_RECEMMENT";
|
||||||
|
public static String TRENDING = "TENDANCE";
|
||||||
|
public static String HISTORY = "HISTORIQUE";
|
||||||
|
public static String SUBSCRIPTIONS = "ABONNEMENTS";
|
||||||
|
public static String MYVIDEOS = "VIDEOS";
|
||||||
|
|
||||||
//List of available emails
|
//List of available emails
|
||||||
public static String[] valideEmails = {
|
public static String[] valideEmails = {
|
||||||
"ac-aix-marseille.fr",
|
"ac-aix-marseille.fr",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user