Compare commits
2 Commits
f2a14ce23e
...
56f29b8306
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56f29b8306 | ||
|
|
7c1fbd6696 |
@@ -2,19 +2,13 @@ import Flutter
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@main
|
@main
|
||||||
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
override func application(
|
override func application(
|
||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
if self.window == nil {
|
let result = super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
self.window = UIWindow(frame: UIScreen.main.bounds)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
self.window?.rootViewController = UIViewController()
|
return result
|
||||||
}
|
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
|
|
||||||
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,27 +26,6 @@
|
|||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIApplicationSceneManifest</key>
|
|
||||||
<dict>
|
|
||||||
<key>UIApplicationSupportsMultipleScenes</key>
|
|
||||||
<false/>
|
|
||||||
<key>UISceneConfigurations</key>
|
|
||||||
<dict>
|
|
||||||
<key>UIWindowSceneSessionRoleApplication</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>UISceneClassName</key>
|
|
||||||
<string>UIWindowScene</string>
|
|
||||||
<key>UISceneConfigurationName</key>
|
|
||||||
<string>flutter</string>
|
|
||||||
<key>UISceneDelegateClassName</key>
|
|
||||||
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
|
||||||
<key>UISceneStoryboardFile</key>
|
|
||||||
<string>Main</string>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
|
|||||||
@@ -388,9 +388,25 @@ async function handleMessage(ws, raw) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[WS] Downloading media for message: ${messageId}`);
|
console.log(`[WS] Downloading media for message: ${messageId}`);
|
||||||
const media = await msg.downloadMedia();
|
|
||||||
if (!media) {
|
let media = null;
|
||||||
return respond({ type: 'error', message: 'Failed to download media file from WhatsApp servers' });
|
// Attempt to download media with retries and a delay to allow decryption
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
try {
|
||||||
|
media = await msg.downloadMedia();
|
||||||
|
if (media && media.data) {
|
||||||
|
console.log(`[WS] Successfully downloaded media on attempt ${i + 1}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`[WS] Media download attempt ${i + 1} failed:`, err.message);
|
||||||
|
}
|
||||||
|
// Wait 1.5 seconds before retrying
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!media || !media.data) {
|
||||||
|
return respond({ type: 'error', message: 'Failed to download media file from WhatsApp servers after multiple attempts' });
|
||||||
}
|
}
|
||||||
|
|
||||||
return respond({
|
return respond({
|
||||||
|
|||||||
Reference in New Issue
Block a user