versionDev as flavor

This commit is contained in:
tobiasKaminsky 2017-04-13 09:14:19 +02:00
parent 4a2191dc83
commit 86340913a8
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
19 changed files with 323 additions and 15 deletions

View file

@ -1,6 +1,6 @@
pipeline: pipeline:
test: test:
image: nextcloudci/android:android-28 image: nextcloudci/android:android-31
commands: commands:
# uncomment gplay for Gplay, Modified only # uncomment gplay for Gplay, Modified only
- sh -c "if [ '$FLAVOUR' != 'Generic' ]; then sed -i '/.*com.google.*/s/^.*\\/\\///g' build.gradle; fi" - sh -c "if [ '$FLAVOUR' != 'Generic' ]; then sed -i '/.*com.google.*/s/^.*\\/\\///g' build.gradle; fi"
@ -29,7 +29,7 @@ pipeline:
- LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/opt/android-sdk-linux/tools/lib64/gles_mesa/ - LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:/opt/android-sdk-linux/tools/lib64/gles_mesa/
lint: lint:
image: nextcloudci/android:android-28 image: nextcloudci/android:android-31
commands: commands:
# needs gplay # needs gplay
- sed -i '/.*com.google.*/s/^.*\\/\\///g' build.gradle - sed -i '/.*com.google.*/s/^.*\\/\\///g' build.gradle

View file

@ -105,6 +105,13 @@ android {
applicationId 'com.custom.client' applicationId 'com.custom.client'
dimension "default" dimension "default"
} }
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20171113
versionName "20171113"
}
} }
configurations { configurations {
@ -186,7 +193,8 @@ android {
dependencies { dependencies {
/// dependencies for app building /// dependencies for app building
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'
compile 'com.github.nextcloud:android-library:1.0.32' implementation 'com.github.nextcloud:android-library:1.0.32'
versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
implementation "com.android.support:support-v4:${supportLibraryVersion}" implementation "com.android.support:support-v4:${supportLibraryVersion}"
implementation "com.android.support:design:${supportLibraryVersion}" implementation "com.android.support:design:${supportLibraryVersion}"
implementation 'com.jakewharton:disklrucache:2.0.2' implementation 'com.jakewharton:disklrucache:2.0.2'

View file

@ -6,7 +6,7 @@
</issue> </issue>
<issue id="UnusedResources"> <issue id="UnusedResources">
<ignore regexp="store_short_desc|store_full_desc" /> <ignore regexp="store_short_desc|store_full_desc|store_short_dev_desc|store_full_dev_desc" />
</issue> </issue>
<issue id="MissingQuantity"> <issue id="MissingQuantity">

43
scripts/buildDev Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
date=$(date +%Y%m%d)
# use current date for version code/name
sed -i "/versionDev/,/\}/ s/versionCode .*/versionCode $date/" build.gradle
sed -i "/versionDev/,/\}/ s/versionName .*/versionName \"$date\"/" build.gradle
# build signed apk
./gradlew assembleVersionDevRelease >> /tmp/dev.log 2>&1
if [ $? != 0 ] ; then
echo "Build error!"
exit 1
fi
# sign
source ~/.gradle/devVersionSecrets
apksigner sign --ks-pass env:VERSION_DEV_STORE_PASSWORD \
--key-pass env:VERSION_DEV_KEY_PASSWORD \
--ks $VERSION_DEV_STORE_FILE \
--out ~/apks/nextcloud-dev-$date.apk \
./build/outputs/apk/versionDev/release/android-versionDev-release-unsigned.apk
# use the current date
mkdir -p ~/apks
echo $date > ~/apks/latest
ln -s nextcloud-dev-$date.apk latest.apk
mv latest.apk ~/apks/
# remove all but the latest 5 apks
/bin/ls -t ~/apks/*.apk | awk 'NR>6' | xargs rm -f
git add .
git commit -m "daily dev $date"
git push
git tag dev-$date
git push origin dev-$date
# remove all but the latest 5 tags
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git push --delete origin
git tag|grep dev | sort -r | awk 'NR>5' | xargs -n 1 git tag -d

View file

@ -56,6 +56,7 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import android.widget.Toast;
import com.owncloud.android.BuildConfig; import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp; import com.owncloud.android.MainApp;
@ -70,12 +71,14 @@ import com.owncloud.android.lib.common.ExternalLinkType;
import com.owncloud.android.lib.common.OwnCloudAccount; import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.asynctasks.LoadingVersionNumberTask;
import com.owncloud.android.utils.AnalyticsUtils; import com.owncloud.android.utils.AnalyticsUtils;
import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.MimeTypeUtil; import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.ThemeUtils; import com.owncloud.android.utils.ThemeUtils;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException;
/** /**
* An Activity that allows the user to change the application's settings. * An Activity that allows the user to change the application's settings.
@ -161,6 +164,64 @@ public class Preferences extends PreferenceActivity
// About // About
setupAboutCategory(accentColor, appVersion); setupAboutCategory(accentColor, appVersion);
// Dev
setupDevCategory(accentColor, preferenceScreen);
}
private void setupDevCategory(int accentColor, PreferenceScreen preferenceScreen) {
// Dev category
PreferenceCategory preferenceCategoryDev = (PreferenceCategory) findPreference("dev_category");
if (getResources().getBoolean(R.bool.is_beta)) {
preferenceCategoryDev.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_category_dev),
accentColor));
/* Link to dev apks */
Preference pDevLink = findPreference("dev_link");
if (pDevLink != null) {
pDevLink.setOnPreferenceClickListener(preference -> {
Integer latestVersion = -1;
Integer currentVersion = -1;
try {
currentVersion = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
String url = getString(R.string.dev_latest);
LoadingVersionNumberTask loadTask = new LoadingVersionNumberTask();
loadTask.execute(url);
latestVersion = loadTask.get();
} catch (InterruptedException | ExecutionException | NameNotFoundException e) {
Log_OC.e(TAG, "Error detecting app version", e);
}
if (latestVersion == -1 || currentVersion == -1) {
Toast.makeText(getApplicationContext(), "No information available!", Toast.LENGTH_SHORT).show();
}
if (latestVersion > currentVersion) {
String devApkLink = (String) getText(R.string.dev_link) + latestVersion + ".apk";
Uri uriUrl = Uri.parse(devApkLink);
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
return true;
} else {
Toast.makeText(getApplicationContext(), "No new version available!", Toast.LENGTH_SHORT).show();
return true;
}
});
}
/* Link to dev changelog */
Preference pChangelogLink = findPreference("changelog_link");
if (pChangelogLink != null) {
pChangelogLink.setOnPreferenceClickListener(preference -> {
String devChangelogLink = getString(R.string.dev_changelog);
Uri uriUrl = Uri.parse(devChangelogLink);
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
return true;
});
}
} else {
preferenceScreen.removePreference(preferenceCategoryDev);
}
} }
private void setupAboutCategory(int accentColor, String appVersion) { private void setupAboutCategory(int accentColor, String appVersion) {

View file

@ -0,0 +1,54 @@
/*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2017 Tobias Kaminsky
* Copyright (C) 2017 Nextcloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.ui.asynctasks;
import android.os.AsyncTask;
import com.owncloud.android.lib.common.utils.Log_OC;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
/**
* Class for loading the version number
*/
public class LoadingVersionNumberTask extends AsyncTask<String, Void, Integer> {
private static final String TAG = LoadingVersionNumberTask.class.getSimpleName();
protected Integer doInBackground(String... args) {
try {
URL url = new URL(args[0]);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
Integer latestVersion = Integer.parseInt(in.readLine());
in.close();
return latestVersion;
} catch (IOException e) {
Log_OC.e(TAG, "Error loading version number", e);
}
return -1;
}
}

View file

@ -93,6 +93,7 @@
android:drawablePadding="@dimen/alternate_half_padding" android:drawablePadding="@dimen/alternate_half_padding"
android:inputType="textUri" android:inputType="textUri"
android:paddingRight="@dimen/alternate_padding_right" android:paddingRight="@dimen/alternate_padding_right"
android:paddingEnd="@dimen/alternate_padding_right"
android:textColor="@color/login_text_color" android:textColor="@color/login_text_color"
android:textColorHint="@color/login_text_color"> android:textColorHint="@color/login_text_color">
@ -105,8 +106,9 @@
android:id="@+id/testServerButton" android:id="@+id/testServerButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right" android:layout_gravity="center_vertical|end"
android:layout_marginRight="@dimen/alternate_half_padding" android:layout_marginRight="@dimen/alternate_half_padding"
android:layout_marginEnd="@dimen/alternate_half_padding"
android:padding="@dimen/zero" android:padding="@dimen/zero"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/arrow_right" android:src="@drawable/arrow_right"
@ -117,16 +119,16 @@
/> />
<ImageButton <ImageButton
android:id="@+id/embeddedRefreshButton" android:id="@+id/embeddedRefreshButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right" android:layout_gravity="center_vertical|end"
android:layout_marginRight="@dimen/alternate_half_padding" android:layout_marginRight="@dimen/alternate_half_padding"
android:padding="@dimen/zero" android:padding="@dimen/zero"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_action_refresh" android:src="@drawable/ic_action_refresh"
android:visibility="gone" android:visibility="gone"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:contentDescription="@string/auth_refresh_button" android:contentDescription="@string/auth_refresh_button"
/> />
</FrameLayout> </FrameLayout>

View file

@ -145,6 +145,11 @@
<!-- Push server url --> <!-- Push server url -->
<string name="push_server_url" translatable="false"></string> <string name="push_server_url" translatable="false"></string>
<!-- Dev settings -->
<string name="dev_link">https://download.nextcloud.com/android/dev/nextcloud-dev-</string>
<string name="dev_latest">https://download.nextcloud.com/android/dev/latest</string>
<string name="dev_changelog">https://github.com/nextcloud/android/raw/dev/CHANGELOG.md</string>
</resources> </resources>

View file

@ -715,4 +715,9 @@
<string name="store_short_desc">The Nextcloud Android app gives you access to all your files in your Nextcloud</string> <string name="store_short_desc">The Nextcloud Android app gives you access to all your files in your Nextcloud</string>
<string name="store_full_desc">The copyleft libre software Nextcloud Android app, gives you access to all the files in your Nextcloud.\n\nFeatures:\n* Easy, modern interface, suited to the theme of your server\n* Upload files to your Nextcloud server\n* Share them with others\n* Keep your favorite files and folders synced\n* Search across all folders on your server\n* Auto Upload for photos and videos taken by your device\n* Keep up to date with notifications\n* Multi-account support\n* Secure access to your data with fingerprint or PIN\n* Integration with DAVdroid for easy setup of calendar &amp; Contacts synchronization\n\nPlease report all issues at https://github.com/nextcloud/android/issues and discuss this app at https://help.nextcloud.com/c/clients/android\n\nNew to Nextcloud? Nextcloud is a private file sync &amp; share and communication server. It is libre software, and you can host it yourself or pay a company to do it for you. That way, you are in control of your photos, your calendar and contact data, your documents and everything else.\n\nCheck out Nextcloud at https://nextcloud.com</string> <string name="store_full_desc">The copyleft libre software Nextcloud Android app, gives you access to all the files in your Nextcloud.\n\nFeatures:\n* Easy, modern interface, suited to the theme of your server\n* Upload files to your Nextcloud server\n* Share them with others\n* Keep your favorite files and folders synced\n* Search across all folders on your server\n* Auto Upload for photos and videos taken by your device\n* Keep up to date with notifications\n* Multi-account support\n* Secure access to your data with fingerprint or PIN\n* Integration with DAVdroid for easy setup of calendar &amp; Contacts synchronization\n\nPlease report all issues at https://github.com/nextcloud/android/issues and discuss this app at https://help.nextcloud.com/c/clients/android\n\nNew to Nextcloud? Nextcloud is a private file sync &amp; share and communication server. It is libre software, and you can host it yourself or pay a company to do it for you. That way, you are in control of your photos, your calendar and contact data, your documents and everything else.\n\nCheck out Nextcloud at https://nextcloud.com</string>
<string name="store_short_dev_desc">The Nextcloud Dev app is a development snapshot and can be installed parallel.</string>
<string name="store_full_dev_desc">The Open Source Nextcloud Android app allows you to access all your files on your Nextcloud.\nThis is a dev version of the official Nextcloud app and includes brand-new, untested features which might lead to instabilities and data loss. The app is designed for users willing to test the new features and to report bugs if they occur. Do not use it for your productive work!\n\nThe dev version can be installed alongside the official Nextcloud app which is available at F-Droid, too. Once a day it is checked if the source code was updated, so there can be longer pauses between builds.</string>
<string name="prefs_category_dev">Dev</string>
</resources> </resources>

View file

@ -83,4 +83,14 @@
<Preference android:title="@string/about_title" android:id="@+id/about_app" android:key="about_app" /> <Preference android:title="@string/about_title" android:id="@+id/about_app" android:key="about_app" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/prefs_category_dev" android:key="dev_category">
<Preference android:id="@+id/dev_link"
android:title="Download latest dev version"
android:key="dev_link" />
<Preference android:id="@+id/changelog_link"
android:title="Changelog dev version"
android:key="changelog_link" />
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View file

@ -0,0 +1,35 @@
{
"project_info": {
"project_number": "",
"project_id": ""
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "",
"android_client_info": {
"package_name": "com.nextcloud.android.beta"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": ""
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}

View file

@ -0,0 +1,33 @@
/*
* Nextcloud Android client application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.utils;
import android.app.Activity;
public class AnalyticsUtils {
public static void setCurrentScreenName(Activity activity, String s, String s1) {
// do nothing
}
public static void disableAnalytics() {
// do nothing
}
}

View file

@ -0,0 +1,29 @@
/**
* Nextcloud Android client application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.owncloud.android.utils;
public class PushUtils {
public static final String KEY_PUSH = "push";
public static void pushRegistrationToServer() {
// do nothing
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Beta indicator -->
<bool name="is_beta">true</bool>
<!-- App name and other strings-->
<string name="app_name">Nextcloud dev</string>
<string name="account_type">nextcloud.beta</string> <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
<string name="authority">org.nextcloud.beta.provider</string> <!-- better if was the app package with ".provider" appended ; it identifies the provider -->
<string name="users_and_groups_search_authority">org.nextcloud.beta.android.providers.UsersAndGroupsSearchProvider</string>
<string name="users_and_groups_share_with">org.nextcloud.beta.android.providers.UsersAndGroupsSearchProvider.action.SHARE_WITH</string>
<string name="document_provider_authority">org.nextcloud.beta.documents</string>
<string name="file_provider_authority">org.nextcloud.beta.files</string>
<string name="image_cache_provider_authority">org.nextcloud.beta.android.providers.imageCache</string>
<string name="default_display_name_for_root_folder">Nextcloud dev</string>
<bool name="logger_enabled">true</bool>
<!--Destination mail for sending log files -->
<string name="mail_logger">android@nextcloud.com</string>
</resources>