diff --git a/.github/workflows/assembleFlavors.yml b/.github/workflows/assembleFlavors.yml index aef46d6786..99ad4b168f 100644 --- a/.github/workflows/assembleFlavors.yml +++ b/.github/workflows/assembleFlavors.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - flavor: [ Generic, Gplay ] + flavor: [ Generic, Gplay, Huawei ] steps: - uses: actions/checkout@v2 - name: set up JDK 11 diff --git a/build.gradle b/build.gradle index dafa10e6e6..344a81323a 100644 --- a/build.gradle +++ b/build.gradle @@ -164,6 +164,11 @@ android { applicationId 'com.nextcloud.client' dimension "default" } + + huawei { + applicationId 'com.nextcloud.client' + dimension "default" + } versionDev { applicationId "com.nextcloud.android.beta" diff --git a/fastlane/Fastfile b/fastlane/Fastfile index adaeec0a52..8be36a98e2 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -94,6 +94,9 @@ lane :makeReleases do SignedRelease(flavor:"Gplay") sh("cp ../build/outputs/apk/gplay/release/*.apk ../release/") + + SignedRelease(flavor:"Huawei") + sh("cp ../build/outputs/apk/huawei/release/*.apk ../release/") end desc "Create GPlay release" @@ -108,6 +111,12 @@ lane :createGenericRelease do |options| sh("mv ../build/outputs/apk/generic/release/*.apk ../release/") end +desc "Create Huawei release" +lane :createHuaweiRelease do |options| + SignedRelease(flavor:"Huawei") + sh("mv ../build/outputs/apk/huawei/release/*.apk ../release/") +end + desc "Create Dev release" lane :createDevRelease do |options| SignedRelease(flavor:"VersionDev") @@ -131,7 +140,7 @@ private_lane :uploadToHuawei_Final do |options| client_id: ENV["FASTLANE_NEXTCLOUD_HUAWEI_CLIENT_ID"], client_secret: ENV["FASTLANE_NEXTCLOUD_HUAWEI_CLIENT_SECRET"], app_id: ENV["FASTLANE_NEXTCLOUD_HUAWEI_APP_ID"], - apk_path: "release/nextcloud-" + options["versionCode"] + ".apk", + apk_path: "release/huawei-release-" + options["versionCode"] + ".apk", submit_for_review: true, ) end diff --git a/src/huawei/AndroidManifest.xml b/src/huawei/AndroidManifest.xml new file mode 100644 index 0000000000..23773856ba --- /dev/null +++ b/src/huawei/AndroidManifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + diff --git a/src/huawei/java/com/nextcloud/client/di/VariantComponentsModule.java b/src/huawei/java/com/nextcloud/client/di/VariantComponentsModule.java new file mode 100644 index 0000000000..cd2f5ef69a --- /dev/null +++ b/src/huawei/java/com/nextcloud/client/di/VariantComponentsModule.java @@ -0,0 +1,31 @@ +/* + * Nextcloud Android client application + * + * @author Chris Narkiewicz + * Copyright (C) 2919 Chris Narkiewicz + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or 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 . + */ +package com.nextcloud.client.di; + +import com.owncloud.android.ui.activity.HuaweiCommunityActivity; + +import dagger.Module; +import dagger.android.ContributesAndroidInjector; + +@Module +abstract class VariantComponentsModule { + @ContributesAndroidInjector + abstract HuaweiCommunityActivity participateActivity(); +} diff --git a/src/huawei/java/com/owncloud/android/ui.activity/HuaweiCommunityActivity.kt b/src/huawei/java/com/owncloud/android/ui.activity/HuaweiCommunityActivity.kt new file mode 100644 index 0000000000..46ce50b819 --- /dev/null +++ b/src/huawei/java/com/owncloud/android/ui.activity/HuaweiCommunityActivity.kt @@ -0,0 +1,32 @@ +/* + * Nextcloud Android client application + * + * @author Tobias Kaminsky + * Copyright (C) 2021 Nextcloud + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or 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 . + */ +package com.owncloud.android.ui.activity + +import android.view.View + +/** + * Activity providing information about ways to participate in the app's development. + */ +class HuaweiCommunityActivity : CommunityActivity() { + override fun setupContent() { + super.setupContent() + binding.communityReleaseCandidatePlaystore.visibility = View.GONE + } +} diff --git a/src/huawei/java/com/owncloud/android/utils/PushUtils.java b/src/huawei/java/com/owncloud/android/utils/PushUtils.java new file mode 100644 index 0000000000..2ae3f798e8 --- /dev/null +++ b/src/huawei/java/com/owncloud/android/utils/PushUtils.java @@ -0,0 +1,58 @@ +/** + * Nextcloud Android client application + * + * @author Mario Danic + * @author Chris Narkiewicz Copyright (C) 2017 Mario Danic Copyright (C) 2019 Chris Narkiewicz + *

+ * 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 + * . + */ + +package com.owncloud.android.utils; + +import android.content.Context; + +import com.nextcloud.client.account.UserAccountManager; +import com.nextcloud.client.preferences.AppPreferencesImpl; +import com.owncloud.android.MainApp; +import com.owncloud.android.datamodel.SignatureVerification; + +import java.security.Key; + +public final class PushUtils { + public static final String KEY_PUSH = "push"; + + private PushUtils() { + } + + public static void pushRegistrationToServer(final UserAccountManager accountManager, final String pushToken) { + // do nothing + } + + public static void reinitKeys(UserAccountManager accountManager) { + Context context = MainApp.getAppContext(); + AppPreferencesImpl.fromContext(context).setKeysReInitEnabled(); + } + + public static Key readKeyFromFile(boolean readPublicKey) { + return null; + } + + public static SignatureVerification verifySignature( + final Context context, + final UserAccountManager accountManager, + final byte[] signatureBytes, + final byte[] subjectBytes + ) { + return null; + } + +} diff --git a/src/huawei/java/com/owncloud/android/utils/SecurityUtils.java b/src/huawei/java/com/owncloud/android/utils/SecurityUtils.java new file mode 100644 index 0000000000..f3d6ac234b --- /dev/null +++ b/src/huawei/java/com/owncloud/android/utils/SecurityUtils.java @@ -0,0 +1,20 @@ +/** + * Nextcloud Android client application + * + * @author Mario Danic Copyright (C) 2018 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 + * . + */ +package com.owncloud.android.utils; + +public class SecurityUtils { +} diff --git a/src/huawei/res/values/bools.xml b/src/huawei/res/values/bools.xml new file mode 100644 index 0000000000..ace4d8552d --- /dev/null +++ b/src/huawei/res/values/bools.xml @@ -0,0 +1,23 @@ + + + false + diff --git a/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java b/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java index 11ad51cf26..ba6cdb6898 100644 --- a/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/CommunityActivity.java @@ -39,7 +39,7 @@ import com.owncloud.android.utils.theme.ThemeColorUtils; */ public class CommunityActivity extends DrawerActivity { - private CommunityLayoutBinding binding; + protected CommunityLayoutBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -59,7 +59,7 @@ public class CommunityActivity extends DrawerActivity { setupContent(); } - private void setupContent() { + protected void setupContent() { binding.communityReleaseCandidateText.setMovementMethod(LinkMovementMethod.getInstance()); TextView contributeIrcView = binding.communityContributeIrcText; diff --git a/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java b/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java index 4e4dcfcf6f..c2f0290cee 100644 --- a/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java @@ -132,6 +132,9 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio } private void setupPushWarning() { + if (!getResources().getBoolean(R.bool.show_push_warning)) { + return; + } if (snackbar != null) { if (!snackbar.isShown()) { snackbar.show(); diff --git a/src/main/res/values/bools.xml b/src/main/res/values/bools.xml index 1e15f53708..2b7e733acf 100644 --- a/src/main/res/values/bools.xml +++ b/src/main/res/values/bools.xml @@ -19,4 +19,5 @@ false + true