Add flavors

This commit is contained in:
Thomas 2020-05-04 11:33:58 +02:00
parent d8f209d110
commit 33001db0a0
6 changed files with 61 additions and 59 deletions

View File

@ -4,7 +4,6 @@ android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "app.fedilab.nitterizeme"
minSdkVersion 15
targetSdkVersion 29
versionCode 16
@ -13,6 +12,29 @@ android {
}
lintOptions {
disable 'MissingTranslation'
checkReleaseBuilds false
abortOnError false
}
flavorDimensions "default"
productFlavors {
full {
applicationId "app.fedilab.nitterizeme"
buildConfigField "boolean", "full", "true"
sourceSets {
main {
manifest.srcFile "src/full/AndroidManifest.xml"
}
}
}
lite {
applicationId "app.fedilab.nitterizemelite"
buildConfigField "boolean", "full", "false"
sourceSets {
main {
manifest.srcFile "src/lite/AndroidManifest.xml"
}
}
}
}
buildTypes {
release {

View File

@ -10,7 +10,7 @@
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="@string/app_name_lite"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
@ -19,7 +19,7 @@
<activity
android:name=".activities.MainActivity"
android:label="@string/app_name"
android:label="@string/app_name_lite"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -70,34 +70,6 @@
<data android:host="youtube-nocookie.com" />
<!-- INVIDIOUS INSTANCES -->
<data android:host="invidio.us" />
<data android:host="invidious.snopyta.org" />
<data android:host="invidiou.sh" />
<data android:host="invidious.toot.koeln" />
<data android:host="invidious.ggc-project.de" />
<data android:host="invidious.13ad.de" />
<data android:host="yewtu.be" />
<!-- NITTER INSTANCES -->
<data android:host="nitter.net" />
<data android:host="nitter.snopyta.org" />
<data android:host="nitter.42l.fr" />
<data android:host="nitter.nixnet.services" />
<data android:host="nitter.13ad.de" />
<data android:host="tw.openalgeria.org" />
<data android:host="nitter.pussthecat.org" />
<data android:host="nitter.mastodont.cat" />
<data android:host="nitter.dark.fail" />
<data android:host="nitter.tedomum.net" />
<!-- BIBLIOGRAM INSTANCES -->
<data android:host="bibliogram.art" />
<data android:host="bibliogram.snopyta.org" />
<data android:host="bibliogram.dsrev.ru" />
<data android:host="bibliogram.pussthecat.org" />
<data android:host="*" />
<data android:pathPattern=".*" />
<data android:scheme="https" />
<data android:scheme="http" />
@ -137,9 +109,6 @@
<data android:host="youtube-nocookie.com" />
<data android:host="*" />
<data android:mimeType="text/plain" />
</intent-filter>
@ -191,7 +160,7 @@
<activity
android:name=".activities.AppsPickerActivity"
android:noHistory="true"
android:theme="@style/Theme.AppCompat.Translucent"/>
android:theme="@style/Theme.AppCompat.Translucent" />
<activity
android:name=".activities.InstanceActivity"
android:excludeFromRecents="true"
@ -199,22 +168,22 @@
<activity
android:name=".activities.AboutActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:label="@string/app_name_lite"
android:theme="@style/AppTheme" />
<activity
android:name=".activities.CheckAppActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:label="@string/app_name_lite"
android:theme="@style/AppTheme" />
<activity
android:name=".activities.DefaultAppActivity"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:label="@string/app_name_lite"
android:theme="@style/AppTheme" />
<activity
android:name=".activities.WebviewPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:label="@string/app_name_lite"
android:launchMode="singleTask"
android:theme="@style/AppTheme" />
</application>

View File

@ -31,6 +31,7 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Objects;
import app.fedilab.nitterizeme.BuildConfig;
import app.fedilab.nitterizeme.R;
import app.fedilab.nitterizeme.adapters.AppInfoAdapter;
import app.fedilab.nitterizeme.entities.AppInfo;
@ -110,8 +111,11 @@ public class CheckAppActivity extends AppCompatActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
domains = new String[twitter_domains.length + youtube_domains.length + shortener_domains.length + instagram_domains.length + invidious_instances.length + nitter_instances.length + bibliogram_instances.length];
if (BuildConfig.full) {
domains = new String[twitter_domains.length + youtube_domains.length + shortener_domains.length + instagram_domains.length + invidious_instances.length + nitter_instances.length + bibliogram_instances.length];
} else {
domains = new String[twitter_domains.length + youtube_domains.length + shortener_domains.length + instagram_domains.length];
}
int i = 0;
for (String host : twitter_domains) {
domains[i] = host;
@ -129,17 +133,19 @@ public class CheckAppActivity extends AppCompatActivity {
domains[i] = host;
i++;
}
for (String host : invidious_instances) {
domains[i] = host;
i++;
}
for (String host : nitter_instances) {
domains[i] = host;
i++;
}
for (String host : bibliogram_instances) {
domains[i] = host;
i++;
if (BuildConfig.full) {
for (String host : invidious_instances) {
domains[i] = host;
i++;
}
for (String host : nitter_instances) {
domains[i] = host;
i++;
}
for (String host : bibliogram_instances) {
domains[i] = host;
i++;
}
}
list_apps = findViewById(R.id.list_apps);

View File

@ -44,6 +44,7 @@ import com.google.android.material.textfield.TextInputEditText;
import java.util.List;
import java.util.Objects;
import app.fedilab.nitterizeme.BuildConfig;
import app.fedilab.nitterizeme.R;
import static app.fedilab.nitterizeme.helpers.Utils.KILL_ACTIVITY;
@ -510,12 +511,15 @@ public class MainActivity extends AppCompatActivity {
bibliogram_instance.setText(bibliogramHost);
current_instance_bibliogram.setText(bibliogramHost);
}
List<ResolveInfo> resolveInfos = getPackageManager().queryIntentActivities(new Intent(Intent.ACTION_VIEW, Uri.parse("https://fedilab.app")), PackageManager.MATCH_DEFAULT_ONLY);
String thisPackageName = getApplicationContext().getPackageName();
ConstraintLayout display_indications = findViewById(R.id.display_indications);
if (resolveInfos.size() == 1 && resolveInfos.get(0).activityInfo.packageName.compareTo(thisPackageName) == 0) {
display_indications.setVisibility(View.VISIBLE);
if (BuildConfig.full) {
List<ResolveInfo> resolveInfos = getPackageManager().queryIntentActivities(new Intent(Intent.ACTION_VIEW, Uri.parse("https://fedilab.app")), PackageManager.MATCH_DEFAULT_ONLY);
String thisPackageName = getApplicationContext().getPackageName();
if (resolveInfos.size() == 1 && resolveInfos.get(0).activityInfo.packageName.compareTo(thisPackageName) == 0) {
display_indications.setVisibility(View.VISIBLE);
} else {
display_indications.setVisibility(View.GONE);
}
} else {
display_indications.setVisibility(View.GONE);
}

View File

@ -298,9 +298,9 @@ public class Utils {
}
newUrl = scheme + invidiousHost + "/watch?v=" + youtubeId + "&local=true";
} else {
if( !url.contains("/channel/") ) {
if (!url.contains("/channel/")) {
newUrl = scheme + invidiousHost + "/" + youtubeId + "&local=true";
}else{
} else {
newUrl = scheme + invidiousHost + "/" + youtubeId;
}
}

View File

@ -1,5 +1,6 @@
<resources>
<string name="app_name" translatable="false">UntrackMe</string>
<string name="app_name_lite" translatable="false">UntrackMe Lite</string>
<string name="action_settings">Settings</string>
<string name="action_about">About</string>
<string name="developer">Developer</string>