Эх сурвалжийг харах

moved to common package

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 2 жил өмнө
parent
commit
9f49e0dbc4

+ 1 - 0
app/src/generic/java/com/owncloud/android/app_review/InAppReviewHelperImpl.kt

@@ -23,6 +23,7 @@ package com.owncloud.android.app_review
 
 import androidx.appcompat.app.AppCompatActivity
 import com.nextcloud.client.preferences.AppPreferences
+import com.nextcloud.app_review.InAppReviewHelper
 
 class InAppReviewHelperImpl(appPreferences: AppPreferences) :
     InAppReviewHelper {

+ 11 - 5
app/src/gplay/java/com/owncloud/android/app_review/InAppReviewHelperImpl.kt

@@ -19,7 +19,7 @@
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
 
-package com.nmc.android.app_review
+package com.owncloud.android.app_review
 
 import androidx.appcompat.app.AppCompatActivity
 import com.google.android.gms.tasks.Task
@@ -28,9 +28,11 @@ import com.google.android.play.core.review.ReviewInfo
 import com.google.android.play.core.review.ReviewManager
 import com.google.android.play.core.review.ReviewManagerFactory
 import com.google.android.play.core.review.model.ReviewErrorCode
+import com.nextcloud.app_review.AppReviewShownModel
+import com.nextcloud.app_review.InAppReviewHelper
 import com.nextcloud.client.preferences.AppPreferences
-import com.nmc.android.utils.getFormattedStringDate
-import com.nmc.android.utils.isCurrentYear
+import com.nextcloud.utils.getFormattedStringDate
+import com.nextcloud.utils.isCurrentYear
 import com.owncloud.android.lib.common.utils.Log_OC
 
 //Reference: https://developer.android.com/guide/playcore/in-app-review
@@ -68,10 +70,14 @@ class InAppReviewHelperImpl(val appPreferences: AppPreferences) : InAppReviewHel
         appReviewShownModel?.let {
             if (it.appRestartCount >= MIN_APP_RESTARTS_REQ
                 && currentTimeMills.isCurrentYear(it.firstShowYear)
-                && it.reviewShownCount < MAX_DISPLAY_PER_YEAR) {
+                && it.reviewShownCount < MAX_DISPLAY_PER_YEAR
+            ) {
                 doAppReview(activity)
             } else {
-                Log_OC.d(TAG, "Yearly limit has been reached or minimum app restarts are not completed: $appReviewShownModel")
+                Log_OC.d(
+                    TAG,
+                    "Yearly limit has been reached or minimum app restarts are not completed: $appReviewShownModel"
+                )
             }
         }
     }

+ 1 - 0
app/src/huawei/java/com/owncloud/android/app_review/InAppReviewHelperImpl.kt

@@ -22,6 +22,7 @@
 package com.owncloud.android.app_review
 
 import androidx.appcompat.app.AppCompatActivity
+import com.nextcloud.app_review.InAppReviewHelper
 import com.nextcloud.client.preferences.AppPreferences
 
 class InAppReviewHelperImpl(appPreferences: AppPreferences) :

+ 30 - 0
app/src/main/java/com/nextcloud/app_review/AppReviewShownModel.kt

@@ -0,0 +1,30 @@
+/*
+ *
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2023 Tobias Kaminsky
+ * Copyright (C) 2023 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 <https://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.app_review
+
+data class AppReviewShownModel(
+    var firstShowYear: String?,
+    var appRestartCount: Int,
+    var reviewShownCount: Int,
+    var lastReviewShownDate: String?
+)

+ 23 - 2
app/src/main/java/com/nmc/android/app_review/InAppReviewHelper.kt → app/src/main/java/com/nextcloud/app_review/InAppReviewHelper.kt

@@ -1,5 +1,26 @@
-package com.nmc.android.app_review
+/*
+ *
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2023 Tobias Kaminsky
+ * Copyright (C) 2023 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 <https://www.gnu.org/licenses/>.
+ */
 
+package com.nextcloud.app_review
 
 import androidx.appcompat.app.AppCompatActivity
 
@@ -23,4 +44,4 @@ interface InAppReviewHelper {
      * once all the conditions satisfies it will trigger In-App Review manager to show the flow
      */
     fun showInAppReview(activity: AppCompatActivity)
-}
+}

+ 40 - 0
app/src/main/java/com/nextcloud/app_review/InAppReviewModule.kt

@@ -0,0 +1,40 @@
+/*
+ *
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2023 Tobias Kaminsky
+ * Copyright (C) 2023 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 <https://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.app_review
+
+import com.nextcloud.client.preferences.AppPreferences
+import com.owncloud.android.app_review.InAppReviewHelperImpl
+// import com.owncloud.android.app_review.InAppReviewHelperImpl
+import dagger.Module
+import dagger.Provides
+import javax.inject.Singleton
+
+@Module
+class InAppReviewModule {
+
+    @Provides
+    @Singleton
+    internal fun providesInAppReviewHelper(appPreferences: AppPreferences): InAppReviewHelper {
+        return InAppReviewHelperImpl(appPreferences)
+    }
+}

+ 1 - 1
app/src/main/java/com/nextcloud/client/di/AppComponent.java

@@ -22,13 +22,13 @@ package com.nextcloud.client.di;
 
 import android.app.Application;
 
+import com.nextcloud.app_review.InAppReviewModule;
 import com.nextcloud.client.appinfo.AppInfoModule;
 import com.nextcloud.client.database.DatabaseModule;
 import com.nextcloud.client.device.DeviceModule;
 import com.nextcloud.client.integrations.IntegrationsModule;
 import com.nextcloud.client.jobs.JobsModule;
 import com.nextcloud.client.network.NetworkModule;
-import com.nmc.android.app_review.InAppReviewModule;
 import com.nextcloud.client.onboarding.OnboardingModule;
 import com.nextcloud.client.preferences.PreferencesModule;
 import com.owncloud.android.MainApp;

+ 1 - 1
app/src/main/java/com/nextcloud/client/preferences/AppPreferences.java

@@ -20,9 +20,9 @@
 
 package com.nextcloud.client.preferences;
 
+import com.nextcloud.app_review.AppReviewShownModel;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.utils.FileSortOrder;
-import com.nmc.android.app_review.AppReviewShownModel;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;

+ 1 - 1
app/src/main/java/com/nextcloud/client/preferences/AppPreferencesImpl.java

@@ -26,10 +26,10 @@ import android.content.Context;
 import android.content.SharedPreferences;
 
 import com.google.gson.Gson;
+import com.nextcloud.app_review.AppReviewShownModel;
 import com.nextcloud.client.account.User;
 import com.nextcloud.client.account.UserAccountManager;
 import com.nextcloud.client.account.UserAccountManagerImpl;
-import com.nmc.android.app_review.AppReviewShownModel;
 import com.owncloud.android.datamodel.ArbitraryDataProvider;
 import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
 import com.owncloud.android.datamodel.FileDataStorageManager;

+ 25 - 2
app/src/main/java/com/nmc/android/utils/Extensions.kt → app/src/main/java/com/nextcloud/utils/Extensions.kt

@@ -1,4 +1,26 @@
-package com.nmc.android.utils
+/*
+ *
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2023 Tobias Kaminsky
+ * Copyright (C) 2023 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 <https://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.utils
 
 import android.text.Selection
 import android.text.Spannable
@@ -10,7 +32,8 @@ import android.text.style.ClickableSpan
 import android.view.View
 import android.widget.TextView
 import java.text.SimpleDateFormat
-import java.util.*
+import java.util.Date
+import java.util.Locale
 
 fun TextView.makeLinks(vararg links: Pair<String, View.OnClickListener>) {
     val spannableString = SpannableString(this.text)

+ 0 - 6
app/src/main/java/com/nmc/android/app_review/AppReviewShownModel.kt

@@ -1,6 +0,0 @@
-package com.nmc.android.app_review
-
-data class AppReviewShownModel(var firstShowYear: String?,
-    var appRestartCount: Int,
-    var reviewShownCount: Int,
-    var lastReviewShownDate: String?)

+ 0 - 18
app/src/main/java/com/nmc/android/app_review/InAppReviewModule.kt

@@ -1,18 +0,0 @@
-package com.nmc.android.app_review
-
-
-import com.nextcloud.client.preferences.AppPreferences
-import com.owncloud.android.app_review.InAppReviewHelperImpl
-import dagger.Module
-import dagger.Provides
-import javax.inject.Singleton
-
-@Module
-class InAppReviewModule {
-
-    @Provides
-    @Singleton
-    internal fun providesInAppReviewHelper(appPreferences: AppPreferences): InAppReviewHelper {
-        return InAppReviewHelperImpl(appPreferences)
-    }
-}

+ 1 - 1
app/src/main/java/com/owncloud/android/MainApp.java

@@ -40,7 +40,7 @@ import android.os.StrictMode;
 import android.text.TextUtils;
 import android.view.WindowManager;
 
-import com.nmc.android.app_review.InAppReviewHelper;
+import com.nextcloud.app_review.InAppReviewHelper;
 import com.nextcloud.client.account.User;
 import com.nextcloud.client.account.UserAccountManager;
 import com.nextcloud.client.appinfo.AppInfo;

+ 1 - 1
app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -57,7 +57,7 @@ import android.view.WindowManager;
 
 import com.google.android.material.appbar.AppBarLayout;
 import com.google.android.material.snackbar.Snackbar;
-import com.nmc.android.app_review.InAppReviewHelper;
+import com.nextcloud.app_review.InAppReviewHelper;
 import com.nextcloud.client.account.User;
 import com.nextcloud.client.appinfo.AppInfo;
 import com.nextcloud.client.core.AsyncRunner;

+ 1 - 1
app/src/qa/java/com/owncloud/android/app_review/InAppReviewHelperImpl.kt

@@ -23,8 +23,8 @@
 package com.owncloud.android.app_review
 
 import androidx.appcompat.app.AppCompatActivity
+import com.nextcloud.app_review.InAppReviewHelper
 import com.nextcloud.client.preferences.AppPreferences
-import com.nmc.android.app_review.InAppReviewHelper
 
 class InAppReviewHelperImpl(appPreferences: AppPreferences) :
     InAppReviewHelper {

+ 4 - 2
app/src/test/java/com/nmc/android/utils/ExtensionTest.kt → app/src/test/java/com/nextcloud/android/utils/ExtensionTest.kt

@@ -1,5 +1,7 @@
-package com.nmc.android.utils
+package com.nextcloud.android.utils
 
+import com.nextcloud.utils.getFormattedStringDate
+import com.nextcloud.utils.isCurrentYear
 import org.junit.Assert.assertFalse
 import org.junit.Assert.assertTrue
 import org.junit.Test
@@ -29,4 +31,4 @@ class ExtensionsTest {
         assertTrue(actualYearNewValue == "")
         assertFalse(actualYearNewValue == "2022")
     }
-}
+}

+ 1 - 0
app/src/versionDev/java/com/owncloud/android/app_review/InAppReviewHelperImpl.kt

@@ -24,6 +24,7 @@ package com.owncloud.android.app_review
 
 import androidx.appcompat.app.AppCompatActivity
 import com.nextcloud.client.preferences.AppPreferences
+import com.nextcloud.app_review.InAppReviewHelper
 
 class InAppReviewHelperImpl(appPreferences: AppPreferences) :
     InAppReviewHelper {