x1ongzhu 2 yıl önce
ebeveyn
işleme
a0f4cd9550

+ 13 - 4
android/app/src/main/AndroidManifest.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android">
+
     <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
@@ -9,12 +10,12 @@
         android:theme="@style/AppTheme"
         android:usesCleartextTraffic="true">
         <activity
-            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
             android:name=".MainActivity"
+            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
+            android:exported="true"
             android:label="@string/title_activity_main"
-            android:theme="@style/AppTheme.NoActionBarLaunch"
             android:launchMode="singleTask"
-            android:exported="true">
+            android:theme="@style/AppTheme.NoActionBarLaunch">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
@@ -26,7 +27,9 @@
             android:authorities="${applicationId}.fileprovider"
             android:exported="false"
             android:grantUriPermissions="true">
-            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
+            <meta-data
+                android:name="android.support.FILE_PROVIDER_PATHS"
+                android:resource="@xml/file_paths" />
         </provider>
     </application>
 
@@ -34,4 +37,10 @@
 
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="com.android.vending.BILLING" />
+    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
+    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
+    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
 </manifest>

+ 32 - 14
src/components/PosterPage.vue

@@ -4,16 +4,12 @@
             <img :src="posterUrl" alt="" />
 
             <div class="btns">
-                <van-button
-                    class="copy"
-                    @click="copyText(shareUrl)"
-                    round
-                    color="linear-gradient(180deg, #FFD1D8 , #FFEAD0 )"
-                    >複製連結</van-button
-                >
-                <van-button class="save" @click="save" round color="linear-gradient(180deg, #FF7340 , #FF3E3E )"
-                    >保存圖片</van-button
-                >
+                <van-button class="copy" @click="share()" round color="linear-gradient(180deg, #FFD1D8 , #FFEAD0 )">
+                    分享
+                </van-button>
+                <van-button class="save" @click="save" round color="linear-gradient(180deg, #FF7340 , #FF3E3E )">
+                    保存圖片
+                </van-button>
             </div>
         </div>
     </ion-modal>
@@ -30,6 +26,7 @@ import { useClipboard } from '@vueuse/core'
 import toast from '@/utils/toast'
 import { Filesystem, Directory, Encoding } from '@capacitor/filesystem'
 import { Media } from '@capacitor-community/media'
+import { Share } from '@capacitor/share'
 
 const show = ref(false)
 
@@ -59,9 +56,9 @@ const props = defineProps({
 const { user } = useUserStore()
 async function getInviteUrl() {
     if (props.pageType === 'mine') {
-        return 'https://shorts.izouma.com/share2.html?referrer=' + user.id
+        return 'https://shorts.izouma.com/static/share2.html?referrer=' + user.id
     } else {
-        return `https://shorts.izouma.com/share1.html?referrer=${user.id}&num=${props.episodeNum}&title=${
+        return `https://shorts.izouma.com/static/share1.html?referrer=${user.id}&num=${props.episodeNum}&title=${
             props.title
         }&cover=${encodeURIComponent(props.poster)}`
     }
@@ -127,11 +124,15 @@ async function save() {
             const savedFile = await Filesystem.writeFile({
                 path: 'share.png',
                 data: posterUrl.value,
-                directory: Directory.Data
+                directory: Directory.Cache
             })
+            const albums = (await Media.getAlbums()).albums
+            console.log(albums)
+            const album = albums?.length ? albums.find(a => a.name === 'Camera') || albums[0] : null
             await Media.savePhoto({
                 path: savedFile.uri,
-                album: 'FirstCash'
+                albumIdentifier: album.identifier,
+                name: 'share'
             })
             toast.success('保存成功')
         } catch (e) {
@@ -144,6 +145,23 @@ async function save() {
         link.click()
     }
 }
+
+async function share() {
+    if (Capacitor.isNativePlatform()) {
+        const savedFile = await Filesystem.writeFile({
+            path: 'share.png',
+            data: posterUrl.value,
+            directory: Directory.Cache
+        })
+        await Share.share({
+            title: '走馬短劇',
+            text: '海量短劇先睹為快',
+            url: savedFile.uri
+        })
+    } else {
+        copyText(shareUrl.value)
+    }
+}
 </script>
 
 <style lang="less" scoped>

+ 1 - 1
src/plugins/updater_meta.json

@@ -1 +1 @@
-{"version":41}
+{"version":42}

+ 1 - 1
src/views/MinePage.vue

@@ -128,7 +128,7 @@ import { useIonRouter } from '@ionic/vue'
 
 const buyPageRef = ref(null)
 function buy() {
-    toast(t('wait'))
+    // toast(t('wait'))
     // buyPageRef.value.changeShow(true)
     const { store, ProductType, Platform } = CdvPurchase
     store.verbosity = CdvPurchase.LogLevel.DEBUG