1.2.1离线模式优化,AppLovin广告配置添加

This commit is contained in:
QinFendeZhou 2024-09-20 18:34:48 +08:00
parent 864f19ca7a
commit 0c4a1df6dd
62 changed files with 1993 additions and 291 deletions

View File

@ -29,6 +29,8 @@ pod "DownloadButton"
pod 'Tiercel' pod 'Tiercel'
#文本跑马灯 #文本跑马灯
pod 'MarqueeLabel' pod 'MarqueeLabel'
#广告组 #广告组
pod 'GoogleUserMessagingPlatform', '2.4.0' pod 'GoogleUserMessagingPlatform', '2.4.0'
pod 'Google-Mobile-Ads-SDK', '11.4.0' pod 'Google-Mobile-Ads-SDK', '11.4.0'

View File

@ -179,6 +179,6 @@ SPEC CHECKSUMS:
Tiercel: c0a73f876a72800333b15f4e7e48791f4ad21e90 Tiercel: c0a73f876a72800333b15f4e7e48791f4ad21e90
VungleAds: 4823f53e691ba140ff21e3a3a6897af789832a36 VungleAds: 4823f53e691ba140ff21e3a3a6897af789832a36
PODFILE CHECKSUM: 6a95ca6014572e024266fe6dd05d870b42d7be49 PODFILE CHECKSUM: 5af34d4e7dc09fde7b668a4368b6fc382756eebd
COCOAPODS: 1.15.2 COCOAPODS: 1.15.2

2
Pods/Manifest.lock generated
View File

@ -179,6 +179,6 @@ SPEC CHECKSUMS:
Tiercel: c0a73f876a72800333b15f4e7e48791f4ad21e90 Tiercel: c0a73f876a72800333b15f4e7e48791f4ad21e90
VungleAds: 4823f53e691ba140ff21e3a3a6897af789832a36 VungleAds: 4823f53e691ba140ff21e3a3a6897af789832a36
PODFILE CHECKSUM: 6a95ca6014572e024266fe6dd05d870b42d7be49 PODFILE CHECKSUM: 5af34d4e7dc09fde7b668a4368b6fc382756eebd
COCOAPODS: 1.15.2 COCOAPODS: 1.15.2

View File

@ -22,6 +22,7 @@
CB0B368D2C65AEEF004036E2 /* Wave_Animation.json in Resources */ = {isa = PBXBuildFile; fileRef = CB0B368C2C65AEEF004036E2 /* Wave_Animation.json */; }; CB0B368D2C65AEEF004036E2 /* Wave_Animation.json in Resources */ = {isa = PBXBuildFile; fileRef = CB0B368C2C65AEEF004036E2 /* Wave_Animation.json */; };
CB0B368F2C65B026004036E2 /* MP_WaveAnimationMaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0B368E2C65B026004036E2 /* MP_WaveAnimationMaskView.swift */; }; CB0B368F2C65B026004036E2 /* MP_WaveAnimationMaskView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0B368E2C65B026004036E2 /* MP_WaveAnimationMaskView.swift */; };
CB0B36912C65EBFC004036E2 /* MPPositive_BaseShowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0B36902C65EBFC004036E2 /* MPPositive_BaseShowView.swift */; }; CB0B36912C65EBFC004036E2 /* MPPositive_BaseShowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0B36902C65EBFC004036E2 /* MPPositive_BaseShowView.swift */; };
CB0D07BB2C9AACD2005B9768 /* MP_AppLovinManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0D07BA2C9AACD2005B9768 /* MP_AppLovinManager.swift */; };
CB0D33972C7EF73700C85816 /* MPPositive_PersonalListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0D33962C7EF73700C85816 /* MPPositive_PersonalListViewModel.swift */; }; CB0D33972C7EF73700C85816 /* MPPositive_PersonalListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0D33962C7EF73700C85816 /* MPPositive_PersonalListViewModel.swift */; };
CB0D339B2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0D339A2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift */; }; CB0D339B2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB0D339A2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift */; };
CB108C872C901A5E0017C40F /* MP_LuxServerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB108C862C901A5E0017C40F /* MP_LuxServerManager.swift */; }; CB108C872C901A5E0017C40F /* MP_LuxServerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB108C862C901A5E0017C40F /* MP_LuxServerManager.swift */; };
@ -32,6 +33,7 @@
CB20A0702C53BDBF00FC5AFC /* MP_WebVisitorDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB20A06F2C53BDBF00FC5AFC /* MP_WebVisitorDataManager.swift */; }; CB20A0702C53BDBF00FC5AFC /* MP_WebVisitorDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB20A06F2C53BDBF00FC5AFC /* MP_WebVisitorDataManager.swift */; };
CB2CAAD42C59DC1100EF691D /* MPPositive_TrashListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CAAD32C59DC1100EF691D /* MPPositive_TrashListModel.swift */; }; CB2CAAD42C59DC1100EF691D /* MPPositive_TrashListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CAAD32C59DC1100EF691D /* MPPositive_TrashListModel.swift */; };
CB2CAAD82C5A1AC500EF691D /* MP_IAPViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CAAD52C5A1AC500EF691D /* MP_IAPViewController.swift */; }; CB2CAAD82C5A1AC500EF691D /* MP_IAPViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CAAD52C5A1AC500EF691D /* MP_IAPViewController.swift */; };
CB51340E2C9C1E4800833AD5 /* MP_ADSimpleManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB51340D2C9C1E4800833AD5 /* MP_ADSimpleManager.swift */; };
CB6EEB8E2C5DFE6100AEC414 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB6EEB8D2C5DFE6100AEC414 /* StoreKit.framework */; }; CB6EEB8E2C5DFE6100AEC414 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB6EEB8D2C5DFE6100AEC414 /* StoreKit.framework */; };
CB7FC5422C2AA01F00292A43 /* FacebookAEM in Frameworks */ = {isa = PBXBuildFile; productRef = CB7FC5412C2AA01F00292A43 /* FacebookAEM */; }; CB7FC5422C2AA01F00292A43 /* FacebookAEM in Frameworks */ = {isa = PBXBuildFile; productRef = CB7FC5412C2AA01F00292A43 /* FacebookAEM */; };
CB7FC5442C2AA01F00292A43 /* FacebookBasics in Frameworks */ = {isa = PBXBuildFile; productRef = CB7FC5432C2AA01F00292A43 /* FacebookBasics */; }; CB7FC5442C2AA01F00292A43 /* FacebookBasics in Frameworks */ = {isa = PBXBuildFile; productRef = CB7FC5432C2AA01F00292A43 /* FacebookBasics */; };
@ -250,7 +252,7 @@
CBC2D6F82BFDF3D800E17703 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CBC2D6F72BFDF3D800E17703 /* Assets.xcassets */; }; CBC2D6F82BFDF3D800E17703 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CBC2D6F72BFDF3D800E17703 /* Assets.xcassets */; };
CBC2D6FB2BFDF3D800E17703 /* Base in Resources */ = {isa = PBXBuildFile; fileRef = CBC2D6FA2BFDF3D800E17703 /* Base */; }; CBC2D6FB2BFDF3D800E17703 /* Base in Resources */ = {isa = PBXBuildFile; fileRef = CBC2D6FA2BFDF3D800E17703 /* Base */; };
CBC2D7D42BFDF4B900E17703 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = CBC2D7792BFDF4B900E17703 /* PrivacyInfo.xcprivacy */; }; CBC2D7D42BFDF4B900E17703 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = CBC2D7792BFDF4B900E17703 /* PrivacyInfo.xcprivacy */; };
CBC3F2B22C3E76160075DC74 /* MPPositive_AdModelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC3F2B12C3E76160075DC74 /* MPPositive_AdModelModel.swift */; }; CBC3F2B22C3E76160075DC74 /* MPPositive_AdItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC3F2B12C3E76160075DC74 /* MPPositive_AdItemModel.swift */; };
CBC5E51D2C7D82A200336746 /* MPPositive_RecentlyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC5E51C2C7D82A200336746 /* MPPositive_RecentlyModel.swift */; }; CBC5E51D2C7D82A200336746 /* MPPositive_RecentlyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC5E51C2C7D82A200336746 /* MPPositive_RecentlyModel.swift */; };
CBC5E51F2C7DAB8600336746 /* MPPositive_RecentlyViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC5E51E2C7DAB8600336746 /* MPPositive_RecentlyViewModel.swift */; }; CBC5E51F2C7DAB8600336746 /* MPPositive_RecentlyViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC5E51E2C7DAB8600336746 /* MPPositive_RecentlyViewModel.swift */; };
CBC81FBA2C3694990028143B /* MPPositive_HomeSinglesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC81FB92C3694990028143B /* MPPositive_HomeSinglesTableViewCell.swift */; }; CBC81FBA2C3694990028143B /* MPPositive_HomeSinglesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC81FB92C3694990028143B /* MPPositive_HomeSinglesTableViewCell.swift */; };
@ -269,6 +271,7 @@
CBDBDDF62C40FFC600767F0B /* MPPositive_GrideMoodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBDBDDF52C40FFC600767F0B /* MPPositive_GrideMoodViewController.swift */; }; CBDBDDF62C40FFC600767F0B /* MPPositive_GrideMoodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBDBDDF52C40FFC600767F0B /* MPPositive_GrideMoodViewController.swift */; };
CBDC4A292C61B88300960649 /* relax.offline.mp3.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CBDC4A272C61B88300960649 /* relax.offline.mp3.xcdatamodeld */; }; CBDC4A292C61B88300960649 /* relax.offline.mp3.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CBDC4A272C61B88300960649 /* relax.offline.mp3.xcdatamodeld */; };
CBF3AEDA2C255B1200947AFC /* MPPositive_PlayListsShowTypeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF3AED92C255B1200947AFC /* MPPositive_PlayListsShowTypeView.swift */; }; CBF3AEDA2C255B1200947AFC /* MPPositive_PlayListsShowTypeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF3AED92C255B1200947AFC /* MPPositive_PlayListsShowTypeView.swift */; };
CBF769992C95678A00EF9B45 /* Devices.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF769982C95678A00EF9B45 /* Devices.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@ -298,6 +301,7 @@
CB0B368C2C65AEEF004036E2 /* Wave_Animation.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Wave_Animation.json; sourceTree = "<group>"; }; CB0B368C2C65AEEF004036E2 /* Wave_Animation.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = Wave_Animation.json; sourceTree = "<group>"; };
CB0B368E2C65B026004036E2 /* MP_WaveAnimationMaskView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_WaveAnimationMaskView.swift; sourceTree = "<group>"; }; CB0B368E2C65B026004036E2 /* MP_WaveAnimationMaskView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_WaveAnimationMaskView.swift; sourceTree = "<group>"; };
CB0B36902C65EBFC004036E2 /* MPPositive_BaseShowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_BaseShowView.swift; sourceTree = "<group>"; }; CB0B36902C65EBFC004036E2 /* MPPositive_BaseShowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_BaseShowView.swift; sourceTree = "<group>"; };
CB0D07BA2C9AACD2005B9768 /* MP_AppLovinManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_AppLovinManager.swift; sourceTree = "<group>"; };
CB0D33962C7EF73700C85816 /* MPPositive_PersonalListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PersonalListViewModel.swift; sourceTree = "<group>"; }; CB0D33962C7EF73700C85816 /* MPPositive_PersonalListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PersonalListViewModel.swift; sourceTree = "<group>"; };
CB0D339A2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PersonalisedRecommendationsTableViewCell.swift; sourceTree = "<group>"; }; CB0D339A2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PersonalisedRecommendationsTableViewCell.swift; sourceTree = "<group>"; };
CB108C862C901A5E0017C40F /* MP_LuxServerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_LuxServerManager.swift; sourceTree = "<group>"; }; CB108C862C901A5E0017C40F /* MP_LuxServerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_LuxServerManager.swift; sourceTree = "<group>"; };
@ -308,6 +312,7 @@
CB20A06F2C53BDBF00FC5AFC /* MP_WebVisitorDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_WebVisitorDataManager.swift; sourceTree = "<group>"; }; CB20A06F2C53BDBF00FC5AFC /* MP_WebVisitorDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_WebVisitorDataManager.swift; sourceTree = "<group>"; };
CB2CAAD32C59DC1100EF691D /* MPPositive_TrashListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_TrashListModel.swift; sourceTree = "<group>"; }; CB2CAAD32C59DC1100EF691D /* MPPositive_TrashListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_TrashListModel.swift; sourceTree = "<group>"; };
CB2CAAD52C5A1AC500EF691D /* MP_IAPViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_IAPViewController.swift; sourceTree = "<group>"; }; CB2CAAD52C5A1AC500EF691D /* MP_IAPViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_IAPViewController.swift; sourceTree = "<group>"; };
CB51340D2C9C1E4800833AD5 /* MP_ADSimpleManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MP_ADSimpleManager.swift; sourceTree = "<group>"; };
CB6EEB8D2C5DFE6100AEC414 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; CB6EEB8D2C5DFE6100AEC414 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
CB7FC5472C2AC25C00292A43 /* MPPositive_CenterListSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_CenterListSearchView.swift; sourceTree = "<group>"; }; CB7FC5472C2AC25C00292A43 /* MPPositive_CenterListSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_CenterListSearchView.swift; sourceTree = "<group>"; };
CBAFC9F22C0A10500054500E /* MP_BaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MP_BaseViewController.swift; sourceTree = "<group>"; }; CBAFC9F22C0A10500054500E /* MP_BaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MP_BaseViewController.swift; sourceTree = "<group>"; };
@ -543,7 +548,7 @@
CBC2D6FA2BFDF3D800E17703 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; CBC2D6FA2BFDF3D800E17703 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
CBC2D6FC2BFDF3D800E17703 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; CBC2D6FC2BFDF3D800E17703 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CBC2D7792BFDF4B900E17703 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; }; CBC2D7792BFDF4B900E17703 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
CBC3F2B12C3E76160075DC74 /* MPPositive_AdModelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_AdModelModel.swift; sourceTree = "<group>"; }; CBC3F2B12C3E76160075DC74 /* MPPositive_AdItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_AdItemModel.swift; sourceTree = "<group>"; };
CBC5E51C2C7D82A200336746 /* MPPositive_RecentlyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_RecentlyModel.swift; sourceTree = "<group>"; }; CBC5E51C2C7D82A200336746 /* MPPositive_RecentlyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_RecentlyModel.swift; sourceTree = "<group>"; };
CBC5E51E2C7DAB8600336746 /* MPPositive_RecentlyViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_RecentlyViewModel.swift; sourceTree = "<group>"; }; CBC5E51E2C7DAB8600336746 /* MPPositive_RecentlyViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_RecentlyViewModel.swift; sourceTree = "<group>"; };
CBC81FB92C3694990028143B /* MPPositive_HomeSinglesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_HomeSinglesTableViewCell.swift; sourceTree = "<group>"; }; CBC81FB92C3694990028143B /* MPPositive_HomeSinglesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_HomeSinglesTableViewCell.swift; sourceTree = "<group>"; };
@ -562,6 +567,7 @@
CBDBDDF52C40FFC600767F0B /* MPPositive_GrideMoodViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_GrideMoodViewController.swift; sourceTree = "<group>"; }; CBDBDDF52C40FFC600767F0B /* MPPositive_GrideMoodViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_GrideMoodViewController.swift; sourceTree = "<group>"; };
CBDC4A282C61B88300960649 /* MusicPlayer.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MusicPlayer.xcdatamodel; sourceTree = "<group>"; }; CBDC4A282C61B88300960649 /* MusicPlayer.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = MusicPlayer.xcdatamodel; sourceTree = "<group>"; };
CBF3AED92C255B1200947AFC /* MPPositive_PlayListsShowTypeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PlayListsShowTypeView.swift; sourceTree = "<group>"; }; CBF3AED92C255B1200947AFC /* MPPositive_PlayListsShowTypeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PlayListsShowTypeView.swift; sourceTree = "<group>"; };
CBF769982C95678A00EF9B45 /* Devices.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Devices.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -679,6 +685,7 @@
CBAFCA012C0A10500054500E /* Notification.swift */, CBAFCA012C0A10500054500E /* Notification.swift */,
CBAFCA032C0A10500054500E /* TableView.swift */, CBAFCA032C0A10500054500E /* TableView.swift */,
CBB75FDC2C4F7AA60041665D /* UIImageView.swift */, CBB75FDC2C4F7AA60041665D /* UIImageView.swift */,
CBF769982C95678A00EF9B45 /* Devices.swift */,
); );
path = "Extension(扩展)"; path = "Extension(扩展)";
sourceTree = "<group>"; sourceTree = "<group>";
@ -757,7 +764,9 @@
CBAFCA282C0A10500054500E /* MP_PlayerManager.swift */, CBAFCA282C0A10500054500E /* MP_PlayerManager.swift */,
CBAFCA202C0A10500054500E /* MP_AVURLAsset.swift */, CBAFCA202C0A10500054500E /* MP_AVURLAsset.swift */,
CBAFCA1F2C0A10500054500E /* MP_AnalyticsManager.swift */, CBAFCA1F2C0A10500054500E /* MP_AnalyticsManager.swift */,
CB51340D2C9C1E4800833AD5 /* MP_ADSimpleManager.swift */,
CBB6372B2C1C17C300F1DEC9 /* MP_AdMobManager.swift */, CBB6372B2C1C17C300F1DEC9 /* MP_AdMobManager.swift */,
CB0D07BA2C9AACD2005B9768 /* MP_AppLovinManager.swift */,
CBAFCA212C0A10500054500E /* MP_CacheManager.swift */, CBAFCA212C0A10500054500E /* MP_CacheManager.swift */,
CBAFCA232C0A10500054500E /* MP_CoreDataHandlerManager.swift */, CBAFCA232C0A10500054500E /* MP_CoreDataHandlerManager.swift */,
CBAFCA242C0A10500054500E /* MP_DownloadManager.swift */, CBAFCA242C0A10500054500E /* MP_DownloadManager.swift */,
@ -815,7 +824,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
CBAFCA3D2C0A10500054500E /* MPPositive_ArtistHeaderModel.swift */, CBAFCA3D2C0A10500054500E /* MPPositive_ArtistHeaderModel.swift */,
CBC3F2B12C3E76160075DC74 /* MPPositive_AdModelModel.swift */, CBC3F2B12C3E76160075DC74 /* MPPositive_AdItemModel.swift */,
CBAFCA3E2C0A10500054500E /* MPPositive_BrowseItemModel.swift */, CBAFCA3E2C0A10500054500E /* MPPositive_BrowseItemModel.swift */,
CBC5E51C2C7D82A200336746 /* MPPositive_RecentlyModel.swift */, CBC5E51C2C7D82A200336746 /* MPPositive_RecentlyModel.swift */,
CBC1FB792C50999800AC0633 /* MPPositive_LibraryItemModel.swift */, CBC1FB792C50999800AC0633 /* MPPositive_LibraryItemModel.swift */,
@ -969,8 +978,8 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
CBAFCA792C0A10500054500E /* MPPositive_CustomTabBar.swift */, CBAFCA792C0A10500054500E /* MPPositive_CustomTabBar.swift */,
CBAFCA7A2C0A10500054500E /* MPPositive_CustomTabBarItem.swift */,
CBAFCA7B2C0A10500054500E /* MPPositive_CustomTabBarView.swift */, CBAFCA7B2C0A10500054500E /* MPPositive_CustomTabBarView.swift */,
CBAFCA7A2C0A10500054500E /* MPPositive_CustomTabBarItem.swift */,
CBAFCA782C0A10500054500E /* MPPositive_BottomShowView.swift */, CBAFCA782C0A10500054500E /* MPPositive_BottomShowView.swift */,
CBAFCA7C2C0A10500054500E /* MPPositive_MoreOperationDownLoadTableViewCell.swift */, CBAFCA7C2C0A10500054500E /* MPPositive_MoreOperationDownLoadTableViewCell.swift */,
CB0033F52C295E3100B18FD3 /* MPPositive_MoreOperationShowTableViewCell.swift */, CB0033F52C295E3100B18FD3 /* MPPositive_MoreOperationShowTableViewCell.swift */,
@ -1637,7 +1646,7 @@
CBAFCB442C0A10500054500E /* MPPositive_PresentationController.swift in Sources */, CBAFCB442C0A10500054500E /* MPPositive_PresentationController.swift in Sources */,
CB0968752C2121410045E55B /* GADTSmallTemplateView.m in Sources */, CB0968752C2121410045E55B /* GADTSmallTemplateView.m in Sources */,
CBAFCB9B2C0A10500054500E /* MPSideA_CenterTableViewCell.swift in Sources */, CBAFCB9B2C0A10500054500E /* MPSideA_CenterTableViewCell.swift in Sources */,
CBC3F2B22C3E76160075DC74 /* MPPositive_AdModelModel.swift in Sources */, CBC3F2B22C3E76160075DC74 /* MPPositive_AdItemModel.swift in Sources */,
CBAFCB412C0A10500054500E /* MPPositive_BaseViewController.swift in Sources */, CBAFCB412C0A10500054500E /* MPPositive_BaseViewController.swift in Sources */,
CBCBA7D92C6DFD93004E5BEF /* MPPositive_SortTypeViewController.swift in Sources */, CBCBA7D92C6DFD93004E5BEF /* MPPositive_SortTypeViewController.swift in Sources */,
CBAFCB4E2C0A10500054500E /* MPPositive_PlayerListShowViewController.swift in Sources */, CBAFCB4E2C0A10500054500E /* MPPositive_PlayerListShowViewController.swift in Sources */,
@ -1685,17 +1694,20 @@
CBC1FB802C50E59C00AC0633 /* MPPositive_HomeLibraryListstableViewCell.swift in Sources */, CBC1FB802C50E59C00AC0633 /* MPPositive_HomeLibraryListstableViewCell.swift in Sources */,
CBAFCB792C0A10500054500E /* MPSideA_AddViewController.swift in Sources */, CBAFCB792C0A10500054500E /* MPSideA_AddViewController.swift in Sources */,
CBAFCB5A2C0A10500054500E /* MPPositive_ArtistDescriptionTableViewCell.swift in Sources */, CBAFCB5A2C0A10500054500E /* MPPositive_ArtistDescriptionTableViewCell.swift in Sources */,
CB51340E2C9C1E4800833AD5 /* MP_ADSimpleManager.swift in Sources */,
CBAFCB272C0A10500054500E /* MPPositive_CollectionSongModel.swift in Sources */, CBAFCB272C0A10500054500E /* MPPositive_CollectionSongModel.swift in Sources */,
CBAFCB562C0A10500054500E /* MPPositive_CustomTabBarView.swift in Sources */, CBAFCB562C0A10500054500E /* MPPositive_CustomTabBarView.swift in Sources */,
CBAFCB6C2C0A10500054500E /* MPPositive_PlayerSilder.swift in Sources */, CBAFCB6C2C0A10500054500E /* MPPositive_PlayerSilder.swift in Sources */,
CBAFCB332C0A10500054500E /* MPPositive_CollectionSongViewModel.swift in Sources */, CBAFCB332C0A10500054500E /* MPPositive_CollectionSongViewModel.swift in Sources */,
CBAFCB762C0A10500054500E /* MPSideA_LoadDataMusic.swift in Sources */, CBAFCB762C0A10500054500E /* MPSideA_LoadDataMusic.swift in Sources */,
CBAFCB172C0A10500054500E /* MPPositive_JsonArtist.swift in Sources */, CBAFCB172C0A10500054500E /* MPPositive_JsonArtist.swift in Sources */,
CBF769992C95678A00EF9B45 /* Devices.swift in Sources */,
CBAFCB1A2C0A10500054500E /* MPPositive_JsonListAlbum.swift in Sources */, CBAFCB1A2C0A10500054500E /* MPPositive_JsonListAlbum.swift in Sources */,
CBAFCB1F2C0A10500054500E /* MPPositive_JsonSearchResults.swift in Sources */, CBAFCB1F2C0A10500054500E /* MPPositive_JsonSearchResults.swift in Sources */,
CBAFCB362C0A10500054500E /* MPPositive_ListHeaderViewModel.swift in Sources */, CBAFCB362C0A10500054500E /* MPPositive_ListHeaderViewModel.swift in Sources */,
CBAFCB0F2C0A10500054500E /* MP_LocationManager.swift in Sources */, CBAFCB0F2C0A10500054500E /* MP_LocationManager.swift in Sources */,
CBAFCB5E2C0A10500054500E /* MPPositive_ArtistShowListCollectionViewCell.swift in Sources */, CBAFCB5E2C0A10500054500E /* MPPositive_ArtistShowListCollectionViewCell.swift in Sources */,
CB0D07BB2C9AACD2005B9768 /* MP_AppLovinManager.swift in Sources */,
CBAFCB6D2C0A10500054500E /* MPPositive_RecommendMemberCollectionViewCell.swift in Sources */, CBAFCB6D2C0A10500054500E /* MPPositive_RecommendMemberCollectionViewCell.swift in Sources */,
CB0D339B2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift in Sources */, CB0D339B2C7F2AAC00C85816 /* MPPositive_PersonalisedRecommendationsTableViewCell.swift in Sources */,
CBAFCB2B2C0A10500054500E /* MPPositive_SearchTagModel.swift in Sources */, CBAFCB2B2C0A10500054500E /* MPPositive_SearchTagModel.swift in Sources */,
@ -1899,7 +1911,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1.2.0.1; CURRENT_PROJECT_VERSION = 1.2.1.1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RAQJ4FNZUH; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RAQJ4FNZUH;
@ -1920,11 +1932,11 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.2.0; MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music; PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Musiclax_Development; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Musiclax_15ProDevelopment;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO; SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
@ -1945,7 +1957,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1.2.0.1; CURRENT_PROJECT_VERSION = 1.2.1.1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = RAQJ4FNZUH; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = RAQJ4FNZUH;
@ -1966,11 +1978,11 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.2.0; MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music; PRODUCT_BUNDLE_IDENTIFIER = relax.offline.mp3.music;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Musiclax_Development; "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Musiclax_15ProDevelopment;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO; SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;

View File

@ -16,6 +16,7 @@ import FacebookCore
import StoreKit import StoreKit
import UserMessagingPlatform import UserMessagingPlatform
@_exported import IQKeyboardManagerSwift @_exported import IQKeyboardManagerSwift
@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { class AppDelegate: UIResponder, UIApplicationDelegate {
@ -47,8 +48,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
ActiveDaysCalculation() ActiveDaysCalculation()
//FireBase //FireBase
FirebaseApp.configure() FirebaseApp.configure()
//广 //AdMob广
MP_AdMobManager.shared.start() MP_ADSimpleManager.shared.start()
// //
MP_DownloadManager.shared.cancelAllTasksIfNeeded() MP_DownloadManager.shared.cancelAllTasksIfNeeded()
setAudioSupport() setAudioSupport()
@ -195,9 +196,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// //
let duration = currentDate.timeIntervalSince(backDate) let duration = currentDate.timeIntervalSince(backDate)
// //
let times = MP_AdMobManager.shared.getOpenAppDuration() let times = MP_ADSimpleManager.shared.platform ? MP_AppLovinManager.shared.getOpenAppDuration():MP_AdMobManager.shared.getOpenAppDuration()
if duration >= times { if duration >= times {
MP_AdMobManager.shared.showOpenAdIfAvailable(.HOST, completion: nil) MP_ADSimpleManager.shared.showOpenAdIfAvailable(.HOST, completion: nil)
//广 //广
print("返回前台,并展示了热启动广告") print("返回前台,并展示了热启动广告")
}else { }else {

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "img_v3_02em_7d9ebc7f-0fde-40e7-ab5d-5b1c24a8ddbg.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "img_v3_02em_7d9ebc7f-0fde-40e7-ab5d-5b1c24a8ddbg 1.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -7,8 +7,9 @@
import UIKit import UIKit
import GoogleMobileAds import GoogleMobileAds
import AppLovinSDK
/// ///
class MP_LunchViewController: UIViewController, GADFullScreenContentDelegate { class MP_LunchViewController: UIViewController {
@IBOutlet weak var progressView: MP_Lunch_ProgressView!{ @IBOutlet weak var progressView: MP_Lunch_ProgressView!{
didSet{ didSet{
progressView.layer.masksToBounds = true progressView.layer.masksToBounds = true
@ -131,13 +132,13 @@ class MP_LunchViewController: UIViewController, GADFullScreenContentDelegate {
MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists() MPPositive_BrowseLoadViewModel.shared.reloadBrowseLists()
} }
} }
MP_AdMobManager.shared.loadMoreAdMobs() MP_ADSimpleManager.shared.loadMoreAds()
MP_AdMobManager.shared.showOpenAdIfAvailable(.ICE) { [weak self] (ad, isOpen) in MP_ADSimpleManager.shared.showOpenAdIfAvailable(.ICE) { [weak self] (ad, isOpen, platform) in
guard let self = self else {return} guard let self = self else {return}
addValue = 3 addValue = 3
//广 //广
adShowBlock = { adShowBlock = {
self.adPresent(ad: ad, isOpen: isOpen) self.adPresent(ad: ad, isOpen: isOpen, platform: platform)
} }
} }
//B //B
@ -170,13 +171,13 @@ class MP_LunchViewController: UIViewController, GADFullScreenContentDelegate {
guard let self = self else {return} guard let self = self else {return}
if open { if open {
//ID广 //ID广
MP_AdMobManager.shared.loadMoreAdMobs() MP_ADSimpleManager.shared.loadMoreAds()
MP_AdMobManager.shared.showOpenAdIfAvailable(.ICE) { [weak self] (ad,isOpen) in MP_ADSimpleManager.shared.showOpenAdIfAvailable(.ICE) { [weak self] (ad, isOpen, platform) in
guard let self = self else {return} guard let self = self else {return}
addValue = 3 addValue = 3
//广 //广
adShowBlock = { adShowBlock = {
self.adPresent(ad: ad, isOpen: isOpen) self.adPresent(ad: ad, isOpen: isOpen, platform: platform)
} }
} }
//ip //ip
@ -258,13 +259,13 @@ class MP_LunchViewController: UIViewController, GADFullScreenContentDelegate {
} }
}else { }else {
//ID广 //ID广
MP_AdMobManager.shared.loadMoreAdMobs() MP_ADSimpleManager.shared.loadMoreAds()
MP_AdMobManager.shared.showOpenAdIfAvailable(.ICE) { [weak self] (ad,isOpen) in MP_ADSimpleManager.shared.showOpenAdIfAvailable(.ICE) { [weak self] (ad, isOpen, platform) in
guard let self = self else {return} guard let self = self else {return}
addValue = 3 addValue = 3
//广 //广
adShowBlock = { adShowBlock = {
self.adPresent(ad: ad, isOpen: isOpen) self.adPresent(ad: ad, isOpen: isOpen, platform: platform)
} }
} }
print("ALog") print("ALog")
@ -299,43 +300,94 @@ class MP_LunchViewController: UIViewController, GADFullScreenContentDelegate {
} }
} }
//广 //广
private func adPresent(ad: GADFullScreenPresentingAd, isOpen:Bool) { private func adPresent(ad: AnyObject, isOpen:Bool, platform:Bool) {
DispatchQueue.main.async { DispatchQueue.main.async {
//printCallStack() if platform {
// //
MP_AdMobManager.shared.setInterstitialSwitch(true) MP_AppLovinManager.shared.setInterstitialSwitch(true)
MP_AdMobManager.shared.isShowingOpenAd = true MP_AppLovinManager.shared.isShowingOpenAd = true
if isOpen { //广
let new = ad as? GADAppOpenAd let new = ad as? MAInterstitialAd
// new?.delegate = self
new?.fullScreenContentDelegate = self new?.show()
do{
try new?.canPresent(fromRootViewController: self)
new?.present(fromRootViewController: self)
}catch{
print("开屏广告展示失败,失败原因:\(error)")
if MP_AdMobManager.shared.completeOpenAdBlock != nil {
MP_AdMobManager.shared.completeOpenAdBlock!()
}
}
}else { }else {
let new = ad as? GADInterstitialAd //
// MP_AdMobManager.shared.setInterstitialSwitch(true)
new?.fullScreenContentDelegate = self MP_AdMobManager.shared.isShowingOpenAd = true
do{ if isOpen {
try new?.canPresent(fromRootViewController: self) let new = ad as? GADAppOpenAd
new?.present(fromRootViewController: self) //
}catch{ new?.fullScreenContentDelegate = self
print("开屏广告展示失败,失败原因:\(error)") do{
if MP_AdMobManager.shared.completeOpenAdBlock != nil { try new?.canPresent(fromRootViewController: self)
MP_AdMobManager.shared.completeOpenAdBlock!() new?.present(fromRootViewController: self)
} }catch{
print("开屏广告展示失败,失败原因:\(error)")
if MP_AdMobManager.shared.completeOpenAdBlock != nil {
MP_AdMobManager.shared.completeOpenAdBlock!()
}
}
}else {
let new = ad as? GADInterstitialAd
//
new?.fullScreenContentDelegate = self
do{
try new?.canPresent(fromRootViewController: self)
new?.present(fromRootViewController: self)
}catch{
print("开屏广告展示失败,失败原因:\(error)")
if MP_AdMobManager.shared.completeOpenAdBlock != nil {
MP_AdMobManager.shared.completeOpenAdBlock!()
}
}
} }
} }
} }
} }
}
extension MP_LunchViewController: GADFullScreenContentDelegate, MAAdDelegate{
func didLoad(_ ad: MAAd) {
}
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
}
func didDisplay(_ ad: MAAd) {
if ad.adUnitIdentifier == MP_AppLovinManager.shared.appOpenAd?.adUnitIdentifier {
print("当前展示的广告是开屏广告广告ID--\(ad.adUnitIdentifier)")
//
MP_AnalyticsManager.shared.max_lunch_showSuccessAction()
}
}
func didHide(_ ad: MAAd) {
//广广
if switchBlock != nil {
switchBlock!()
}
if MP_AppLovinManager.shared.completeOpenAdBlock != nil {
MP_AppLovinManager.shared.completeOpenAdBlock!()
}
print("冷启动广告关闭")
MP_AnalyticsManager.shared.cold_ads_closeAction()
}
func didClick(_ ad: MAAd) {
}
func didFail(toDisplay ad: MAAd, withError error: MAError) {
//广广
if switchBlock != nil {
switchBlock!()
}
MP_AnalyticsManager.shared.max_lunch_showFailureAction(error.message)
if MP_AppLovinManager.shared.completeOpenAdBlock != nil {
MP_AppLovinManager.shared.completeOpenAdBlock!()
}
}
//MARK: - 广 GADFullScreenContentDelegate //MARK: - 广 GADFullScreenContentDelegate
//广 //广
func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) { func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {

View File

@ -0,0 +1,116 @@
//
// Devices.swift
// relax.offline.mp3.music
//
// Created by Mr.Zhou on 2024/9/14.
//
import UIKit
extension UIDevice {
var modelName: String {
var systemInfo = utsname()
uname(&systemInfo)
let machineMirror = Mirror(reflecting: systemInfo.machine)
let identifier = machineMirror.children.reduce("") { identifier, element in
guard let value = element.value as? Int8, value != 0 else { return identifier }
return identifier + String(UnicodeScalar(UInt8(value)))
}
return mapToDevice(identifier: identifier)
}
private func mapToDevice(identifier: String) -> String {
#if os(iOS)
switch identifier {
case "iPhone1,1": return "iPhone"
case "iPhone1,2": return "iPhone 3G"
case "iPhone2,1": return "iPhone 3GS"
case "iPhone3,1", "iPhone3,2", "iPhone3,3": return "iPhone 4"
case "iPhone4,1", "iPhone4,2", "iPhone4,3": return "iPhone 4S"
case "iPhone5,1", "iPhone5,2": return "iPhone 5"
case "iPhone5,3", "iPhone5,4": return "iPhone 5C"
case "iPhone6,1", "iPhone6,2": return "iPhone 5S"
case "iPhone7,2": return "iPhone 6"
case "iPhone7,1": return "iPhone 6 Plus"
case "iPhone8,1": return "iPhone 6S"
case "iPhone8,2": return "iPhone 6S Plus"
case "iPhone8,4": return "iPhone SE"
case "iPhone9,1", "iPhone9,3": return "iPhone 7"
case "iPhone9,2", "iPhone9,4": return "iPhone 7 Plus"
case "iPhone10,1", "iPhone10,4": return "iPhone 8"
case "iPhone10,2", "iPhone10,5": return "iPhone 8 Plus"
case "iPhone10,3", "iPhone10,6": return "iPhone X"
case "iPhone11,2": return "iPhone Xs"
case "iPhone11,4", "iPhone11,6": return "iPhone Xs Max"
case "iPhone11,8": return "iPhone Xʀ"
case "iPhone12,1": return "iPhone 11"
case "iPhone12,3": return "iPhone 11 Pro"
case "iPhone12,5": return "iPhone 11 Pro Max"
case "iPhone12,8": return "iPhone SE 2"
case "iPhone13,1": return "iPhone 12 mini"
case "iPhone13,2": return "iPhone 12"
case "iPhone13,3": return "iPhone 12 Pro"
case "iPhone13,4": return "iPhone 12 Pro Max"
case "iPhone14,4": return "iPhone 13 mini"
case "iPhone14,5": return "iPhone 13"
case "iPhone14,2": return "iPhone 13 Pro"
case "iPhone14,3": return "iPhone 13 Pro Max"
case "iPhone14,6": return "iPhone SE 3"
case "iPhone14,7": return "iPhone 14"
case "iPhone14,8": return "iPhone 14 Plus"
case "iPhone15,2": return "iPhone 14 Pro"
case "iPhone15,3": return "iPhone 14 Pro Max"
case "iPhone15,4": return "iPhone 15"
case "iPhone15,5": return "iPhone 15 Plus"
case "iPhone16,1": return "iPhone 15 Pro"
case "iPhone16,2": return "iPhone 15 Pro Max"
case "iPhone17,3": return "iPhone 16"
case "iPhone17,4": return "iPhone 16 Plus"
case "iPhone17,1": return "iPhone 16 Pro"
case "iPhone17,2": return "iPhone 16 Pro Max"
// iPad
case "iPad1,1": return "iPad"
case "iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4": return "iPad 2"
case "iPad3,1", "iPad3,2", "iPad3,3": return "iPad (3rd generation)"
case "iPad3,4", "iPad3,5", "iPad3,6": return "iPad (4th generation)"
case "iPad6,11", "iPad6,12": return "iPad (5th generation)"
case "iPad7,5", "iPad7,6": return "iPad (6th generation)"
case "iPad7,11", "iPad7,12": return "iPad (7th generation)"
case "iPad11,6", "iPad11,7": return "iPad (8th generation)"
case "iPad12,1", "iPad12,2": return "iPad (9th generation)"
case "iPad13,18", "iPad13,19": return "iPad (10th generation)"
// iPad Air
case "iPad4,1", "iPad4,2", "iPad4,3": return "iPad Air"
case "iPad5,3", "iPad5,4": return "iPad Air 2"
case "iPad11,3", "iPad11,4": return "iPad Air (3rd generation)"
case "iPad13,1", "iPad13,2": return "iPad Air (4th generation)"
case "iPad13,16", "iPad13,17": return "iPad Air (5th generation)"
// iPad mini
case "iPad2,5", "iPad2,6", "iPad2,7": return "iPad mini"
case "iPad4,4", "iPad4,5", "iPad4,6": return "iPad mini 2"
case "iPad4,7", "iPad4,8", "iPad4,9": return "iPad mini 3"
case "iPad5,1", "iPad5,2": return "iPad mini 4"
case "iPad11,1", "iPad11,2": return "iPad mini (5th generation)"
case "iPad14,1", "iPad14,2": return "iPad mini (6th generation)"
// iPad Pro
case "iPad6,7", "iPad6,8": return "iPad Pro (12.9-inch)"
case "iPad6,3", "iPad6,4": return "iPad Pro (9.7-inch)"
case "iPad7,1", "iPad7,2": return "iPad Pro (12.9-inch, 2nd generation)"
case "iPad7,3", "iPad7,4": return "iPad Pro (10.5-inch)"
case "iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4": return "iPad Pro (11-inch, 1st generation)"
case "iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8": return "iPad Pro (12.9-inch, 3rd generation)"
case "iPad8,9", "iPad8,10": return "iPad Pro (11-inch, 2nd generation)"
case "iPad8,11", "iPad8,12": return "iPad Pro (12.9-inch, 4th generation)"
case "iPad13,4", "iPad13,5", "iPad13,6", "iPad13,7": return "iPad Pro (11-inch, 3rd generation)"
case "iPad13,8", "iPad13,9", "iPad13,10", "iPad13,11": return "iPad Pro (12.9-inch, 5th generation)"
case "iPad14,3", "iPad14,4": return "iPad Pro (11-inch, 4th generation)"
case "iPad14,5", "iPad14,6": return "iPad Pro (12.9-inch, 6th generation)"
// Add more cases here as needed
default: return identifier
}
#else
return identifier
#endif
}
}

View File

@ -142,6 +142,8 @@
"Not now" = "ليس الآن"; "Not now" = "ليس الآن";
///更新提醒 ///更新提醒
"Update available" = "تحديث متاح"; "Update available" = "تحديث متاح";
///切换至离线歌单
"You are in offline mode" = "أنت في وضع عدم الاتصال بالإنترنت";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "تم نسخ عنوان البريد الإلكتروني بنجاح إلى الحافظة"; "Successfully copied the e-mail address to the clipboard" = "تم نسخ عنوان البريد الإلكتروني بنجاح إلى الحافظة";

View File

@ -142,6 +142,8 @@
"Not now" = "Nicht jetzt"; "Not now" = "Nicht jetzt";
///更新提醒 ///更新提醒
"Update available" = "Aktualisierung verfügbar"; "Update available" = "Aktualisierung verfügbar";
///切换至离线歌单
"You are in offline mode" = "Sie befinden sich im Offline-Modus";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "E-Mail-Adresse erfolgreich in die Zwischenablage kopiert"; "Successfully copied the e-mail address to the clipboard" = "E-Mail-Adresse erfolgreich in die Zwischenablage kopiert";

View File

@ -142,6 +142,8 @@
"Not now" = "Not now"; "Not now" = "Not now";
///更新提醒 ///更新提醒
"Update available" = "Update available"; "Update available" = "Update available";
///切换至离线歌单
"You are in offline mode" = "You are in offline mode";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "Successfully copied the e-mail address to the clipboard"; "Successfully copied the e-mail address to the clipboard" = "Successfully copied the e-mail address to the clipboard";

View File

@ -142,6 +142,8 @@
"Not now" = "Ahora no"; "Not now" = "Ahora no";
///更新提醒 ///更新提醒
"Update available" = "Actualización disponible"; "Update available" = "Actualización disponible";
///切换至离线歌单
"You are in offline mode" = "Estás en modo fuera de línea";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "Dirección de correo electrónico copiada correctamente al portapapeles"; "Successfully copied the e-mail address to the clipboard" = "Dirección de correo electrónico copiada correctamente al portapapeles";

View File

@ -142,6 +142,8 @@
"Not now" = "Pas maintenant"; "Not now" = "Pas maintenant";
///更新提醒 ///更新提醒
"Update available" = "Mise à jour disponible"; "Update available" = "Mise à jour disponible";
///切换至离线歌单
"You are in offline mode" = "Vous êtes en mode hors ligne";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "Adresse e-mail copiée avec succès dans le presse-papiers"; "Successfully copied the e-mail address to the clipboard" = "Adresse e-mail copiée avec succès dans le presse-papiers";

View File

@ -142,6 +142,8 @@
"Not now" = "Non ora"; "Not now" = "Non ora";
///更新提醒 ///更新提醒
"Update available" = "Aggiornamento disponibile"; "Update available" = "Aggiornamento disponibile";
///切换至离线歌单
"You are in offline mode" = "Sei in modalità offline";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "Indirizzo email copiato con successo negli appunti"; "Successfully copied the e-mail address to the clipboard" = "Indirizzo email copiato con successo negli appunti";

View File

@ -142,6 +142,8 @@
"Not now" = "Não agora"; "Not now" = "Não agora";
///更新提醒 ///更新提醒
"Update available" = "Atualização disponível"; "Update available" = "Atualização disponível";
///切换至离线歌单
"You are in offline mode" = "Você está no modo offline";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "Endereço de e-mail copiado com sucesso para a área de transferência"; "Successfully copied the e-mail address to the clipboard" = "Endereço de e-mail copiado com sucesso para a área de transferência";

View File

@ -142,6 +142,8 @@
"Not now" = "Şimdi değil"; "Not now" = "Şimdi değil";
///更新提醒 ///更新提醒
"Update available" = "Güncelleme mevcut"; "Update available" = "Güncelleme mevcut";
///切换至离线歌单
"You are in offline mode" = "Çevrimdışı moddasınız";
//MARK: - HUD文本 //MARK: - HUD文本
///已成功将电子邮件地址复制到剪贴板 ///已成功将电子邮件地址复制到剪贴板
"Successfully copied the e-mail address to the clipboard" = "Herhangi bir yorumunuz veya öneriniz varsa lütfen aşağıdaki e-posta adresinden bizimle iletişime geçin."; "Successfully copied the e-mail address to the clipboard" = "Herhangi bir yorumunuz veya öneriniz varsa lütfen aşağıdaki e-posta adresinden bizimle iletişime geçin.";

View File

@ -174,6 +174,34 @@ func coreDefaultValues() {
UserDefaults.standard.set(array, forKey: "LibraryNATIVEID") UserDefaults.standard.set(array, forKey: "LibraryNATIVEID")
} }
} }
if UserDefaults.standard.object(forKey: "Max_OpenICEIDs") == nil {
if let array = coreAdModelforJson([.init(level: 3, identifier: "1dd2cf325a0eb64d", ad: "AppLovin", type: .Insert)]) {
//广ID
UserDefaults.standard.set(array, forKey: "Max_OpenICEIDs")
}
}
if UserDefaults.standard.object(forKey: "Max_SearchINSERTIDs") == nil {
if let array = coreAdModelforJson([.init(level: 3, identifier: "43414b9a63224bc6", ad: "AppLovin", type: .Insert)]) {
//广ID
UserDefaults.standard.set(array, forKey: "Max_SearchINSERTIDs")
}
}
if UserDefaults.standard.object(forKey: "Max_PlayerINSERTIDs") == nil {
if let array = coreAdModelforJson([.init(level: 3, identifier: "e13ab66866fd6bf8", ad: "AppLovin", type: .Insert)]) {
//广ID
UserDefaults.standard.set(array, forKey: "Max_PlayerINSERTIDs")
}
}
if UserDefaults.standard.object(forKey: "Max_LibraryNATIVEIDs") == nil {
if let array = coreAdModelforJson([.init(level: 3, identifier: "4f3858556dc405ee", ad: "AppLovin", type: .Insert)]) {
//广ID
UserDefaults.standard.set(array, forKey: "Max_LibraryNATIVEIDs")
}
}
if UserDefaults.standard.object(forKey: "platform") == nil {
UserDefaults.standard.set(false, forKey: "platform")
}
// //
if UserDefaults.standard.string(forKey: "ClientVersion") == nil { if UserDefaults.standard.string(forKey: "ClientVersion") == nil {
UserDefaults.standard.set("1.20240618.01.00", forKey: "ClientVersion") UserDefaults.standard.set("1.20240618.01.00", forKey: "ClientVersion")
@ -205,7 +233,7 @@ func coreDefaultValues() {
} }
} }
///广Data ///广Data
func coreAdModelforJson(_ array:[MPPositive_AdModelModel]) -> Data? { func coreAdModelforJson(_ array:[MPPositive_AdItemModel]) -> Data? {
guard array.isEmpty != true else {return nil} guard array.isEmpty != true else {return nil}
do{ do{
let jsonData = try JSONEncoder().encode(array) let jsonData = try JSONEncoder().encode(array)
@ -217,9 +245,9 @@ func coreAdModelforJson(_ array:[MPPositive_AdModelModel]) -> Data? {
} }
} }
///data广 ///data广
func jsonforCoreAdModel(_ data:Data) -> [MPPositive_AdModelModel]? { func jsonforCoreAdModel(_ data:Data) -> [MPPositive_AdItemModel]? {
do{ do{
let array:[MPPositive_AdModelModel] = try JSONDecoder().decode([MPPositive_AdModelModel].self, from: data) let array:[MPPositive_AdItemModel] = try JSONDecoder().decode([MPPositive_AdItemModel].self, from: data)
return array return array
}catch{ }catch{
// //
@ -265,10 +293,12 @@ func improveDataforLycirsAndRelated(_ song:MPPositive_SongItemModel, completion:
} }
} }
///player ///player
func improveDataforResouceAndCover(_ song:MPPositive_SongItemModel, completion:@escaping((([String],[Int],[String])?, [String]?) -> Void)) { func improveDataforResouceAndCover(_ song:MPPositive_SongItemModel, completion:@escaping((([String],[Int],[String])?, [String]?) -> Void), failure: ((Bool) -> Void)? = nil) {
//player //player
MP_NetWorkManager.shared.requestAndroidPlayer(song.videoId ?? "", playlistId: "", clickTrackingParams: song.clickTrackingParams ?? "") { resourceUrls, coverUrls in MP_NetWorkManager.shared.requestAndroidPlayer(song.videoId ?? "", playlistId: "", clickTrackingParams: song.clickTrackingParams ?? "") { resourceUrls, coverUrls in
completion(resourceUrls,coverUrls) completion(resourceUrls,coverUrls)
} failure: {statu in
failure?(statu)
} }
} }
/// ///
@ -535,3 +565,43 @@ func postUpdateReminder(_ observe:UIViewController) {
MP_AnalyticsManager.shared.update_reminder_showAction() MP_AnalyticsManager.shared.update_reminder_showAction()
observe.present(alter, animated: true) observe.present(alter, animated: true)
} }
///线
func playOfflineSongs() {
if MPPositive_LoadCoreModel.shared.loadViewModels.isEmpty == false {
MP_HUD.text("You are in offline mode".localizableString(), delay: 2.0, completion: nil)
//线
MP_AnalyticsManager.shared.song_clickAction("Offline Song")
//
MP_PlayerManager.shared.loadPlayer = nil
//
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
MP_AnalyticsManager.shared.player_b_impAction()
//
var array:[MPPositive_SongItemModel] = []
for (index, song) in MPPositive_LoadCoreModel.shared.loadViewModels.enumerated() {
let item = MPPositive_SongItemModel()
item.index = index
item.coverUrls = [song.loadItem.coverImage ?? ""]
item.reviewUrls = [song.loadItem.reviewImage ?? ""]
item.title = song.loadItem.title
item.longBylineText = song.loadItem.longBylineText
item.lengthText = song.loadItem.lengthText
item.shortBylineText = song.loadItem.shortBylineText
item.lyricsID = song.loadItem.lyricsID
item.lyrics = song.loadItem.lyrics
item.videoId = song.loadItem.videoId
item.relatedID = song.loadItem.relatedID
array.append(item)
}
if let currentVideo = MPPositive_LoadCoreModel.shared.loadViewModels.first {
let lodaViewModel = MPPositive_PlayerLoadViewModel(array, currentVideoId: currentVideo.loadItem.videoId ?? "")
lodaViewModel.improveData(currentVideo.loadItem.videoId ?? "")
//
MP_PlayerManager.shared.setPlayType(.normal)
MP_PlayerManager.shared.loadPlayer = lodaViewModel
MP_AnalyticsManager.shared.player_b_listAction()
}
}else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil)
}
}

View File

@ -11,12 +11,16 @@ class MPPositive_Debouncer: NSObject {
static let shared = MPPositive_Debouncer() static let shared = MPPositive_Debouncer()
// //
private var timer: Timer? private var timer: Timer?
//
private var playerTimer:Timer?
private override init() { private override init() {
super.init() super.init()
} }
deinit { deinit {
timer?.invalidate() timer?.invalidate()
timer = nil timer = nil
playerTimer?.invalidate()
playerTimer = nil
} }
func call(_ delay:TimeInterval = 0.15, action:@escaping (() -> Void)) { func call(_ delay:TimeInterval = 0.15, action:@escaping (() -> Void)) {
// //
@ -27,4 +31,11 @@ class MPPositive_Debouncer: NSObject {
action() action()
} }
} }
func playCall(_ action:@escaping (() -> Void)) {
playerTimer?.invalidate()
playerTimer = nil
playerTimer = Timer.scheduledTimer(withTimeInterval: 10, repeats: false) { _ in
action()
}
}
} }

View File

@ -0,0 +1,198 @@
//
// MP_ADSimpleManager.swift
// relax.offline.mp3.music
//
// Created by Mr.Zhou on 2024/9/19.
//
import UIKit
import AVFoundation
import GoogleMobileAds
import AppLovinAdapter
import AppLovinSDK
import LiftoffMonetizeAdapter
import VungleAdsSDK
import PangleAdapter
import PAGAdSDK
import IronSourceAdapter
import IronSource
import MintegralAdapter
import MTGSDK
import ChartboostSDK
import ChartboostAdapter
//广
enum OpenType:Int {
//
case ICE = 0
//
case HOST = 1
var title:String{
switch self {
case .ICE:
return "是冷启动开屏广告"
case .HOST:
return "是热启动开屏广告"
}
}
}
///广
class MP_ADSimpleManager: NSObject {
static let shared = MP_ADSimpleManager()
//广 falseAdMobtureAppLovin
var platform:Bool{
if let newValue = UserDefaults.standard.object(forKey: "platform") as? Bool {
return newValue
}else {
return false
}
}
///广
var openAdStatus:Bool = true
///使广
var internalAdStatus:Bool = true
///广
func setOpenAdStatus(_ bool:Bool) {
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
openAdStatus = bool
}
}
///广
private var interstitialSwitch:Bool {
get {
if platform {
return MP_AppLovinManager.shared.getInterstitialSwitch()
}else {
return MP_AdMobManager.shared.getInterstitialSwitch()
}
}
}
///
func getInterstitialSwitch() -> Bool {
return interstitialSwitch
}
override init() {
super.init()
NotificationCenter.notificationKey.add(observer: self, selector: #selector(netWorkReachableAction(_:)), notificationName: .net_switch_reachable)
}
deinit{
NotificationCenter.default.removeObserver(self)
}
//广
func start() {
MP_AdMobManager.shared.start()
MP_AppLovinManager.shared.startConfig()
}
//
@objc private func netWorkReachableAction(_ sender:Notification) {
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
guard openAdStatus, internalAdStatus else {return}
if platform {
MP_AppLovinManager.shared.loadMoreAds()
}else {
MP_AdMobManager.shared.loadMoreAdMobs()
}
}
}
//广
func loadMoreAds() {
guard openAdStatus, internalAdStatus else {return}
if platform {
MP_AppLovinManager.shared.loadMoreAds()
}else {
MP_AdMobManager.shared.loadMoreAdMobs()
}
}
///广
func showOpenAdIfAvailable(_ type:OpenType, completion:((_ ad:AnyObject, _ isOpen:Bool, _ platform:Bool) -> Void)?) {
guard openAdStatus, internalAdStatus else {return}
if platform {
if let block = completion {
MP_AppLovinManager.shared.showOpenAdIfAvailable {[weak self] ad in
guard let self = self else {return}
block(ad, false, true)
}
}else {
MP_AppLovinManager.shared.showOpenAdIfAvailable(nil)
}
}else {
if let block = completion {
MP_AdMobManager.shared.showOpenAdIfAvailable(type) { [weak self] ad, isOpen in
guard let self = self else {return}
block(ad, isOpen, false)
}
}else {
MP_AdMobManager.shared.showOpenAdIfAvailable(type, completion: nil)
}
}
}
///广
func showSearchInterstitialAdIfAvailable(completion:((AnyObject, Bool) -> Void)?) {
guard openAdStatus, internalAdStatus else {return}
if platform {
if let block = completion {
MP_AppLovinManager.shared.showSearchInterstitialAdIfAvailable { ad in
block(ad, true)
}
}else {
MP_AppLovinManager.shared.showSearchInterstitialAdIfAvailable(nil)
}
}else {
if let block = completion {
MP_AdMobManager.shared.showSearchInterstitialAdIfAvailable { ad in
block(ad, false)
}
}else {
MP_AdMobManager.shared.showSearchInterstitialAdIfAvailable(completion: nil)
}
}
}
///广
func showPlayInterstitialAdIfAvailable(_ completion:((AnyObject?, Bool) -> Void)?) {
guard openAdStatus, internalAdStatus else {return}
if platform {
if let block = completion {
MP_AppLovinManager.shared.showPlayInterstitialAdIfAvailable { ad in
block(ad, true)
}
}else {
MP_AppLovinManager.shared.showPlayInterstitialAdIfAvailable(nil)
}
}else {
if let block = completion {
MP_AdMobManager.shared.showPlayInterstitialAdIfAvailable { ad in
block(ad, false)
}
}else {
MP_AdMobManager.shared.showPlayInterstitialAdIfAvailable(completion: nil)
}
}
}
///广
func showLibraryInterstitialAdIfAvailable(completion:((AnyObject) -> Void)?) {
guard openAdStatus, internalAdStatus else {return}
if platform {
if let block = completion {
MP_AppLovinManager.shared.showLibraryInterstitialAdIfAvailable { ad in
block(ad)
}
}else {
MP_AppLovinManager.shared.showLibraryInterstitialAdIfAvailable(nil)
}
}else {
if let block = completion {
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable { ad in
block(ad)
}
}else {
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
}
}
}
}

View File

@ -21,23 +21,15 @@ import MTGSDK
import ChartboostSDK import ChartboostSDK
import ChartboostAdapter import ChartboostAdapter
///广 ///AdMob广
class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenContentDelegate, GADNativeAdLoaderDelegate, GADNativeAdDelegate, GADVideoControllerDelegate { class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenContentDelegate, GADNativeAdLoaderDelegate, GADNativeAdDelegate, GADVideoControllerDelegate {
static let shared = MP_AdMobManager() static let shared = MP_AdMobManager()
private let sharedInstance = GADMobileAds.sharedInstance()
///广 ///广
private var openAdStatus:Bool = true private var openAdStatus:Bool = MP_ADSimpleManager.shared.openAdStatus
///使广 ///使广
private var internalAdStatus:Bool = true private var internalAdStatus:Bool = MP_ADSimpleManager.shared.internalAdStatus
///广 private let sharedInstance = GADMobileAds.sharedInstance()
func setOpenAdStatus(_ bool:Bool) {
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
openAdStatus = bool
}
}
///广(50) ///广(50)
private let expirationTime:TimeInterval = 3000 private let expirationTime:TimeInterval = 3000
@ -53,7 +45,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
didSet{ didSet{
DispatchQueue.main.async { DispatchQueue.main.async {
[weak self] in [weak self] in
// MP_PlayerManager.shared.isAdLate = self?.interstitialSwitch
MPSideA_MediaCenterManager.shared.isAdLate = self?.interstitialSwitch MPSideA_MediaCenterManager.shared.isAdLate = self?.interstitialSwitch
} }
} }
@ -326,7 +317,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
} }
///广 ///广
func loadMoreAdMobs() { func loadMoreAdMobs() {
guard openAdStatus, internalAdStatus else {return}
loadPlayInterstitialAd{status in loadPlayInterstitialAd{status in
if status { if status {
print("成功加载播放插页广告") print("成功加载播放插页广告")
@ -341,13 +331,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
print("搜索插页广告加载失败") print("搜索插页广告加载失败")
} }
} }
// loadSwitchInterstitialAd { status in
// if status {
// print("广")
// }else {
// print("广")
// }
// }
loadLibraryInterstitialAd { status in loadLibraryInterstitialAd { status in
if status { if status {
print("成功加载曲库插页广告") print("成功加载曲库插页广告")
@ -356,20 +339,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
} }
} }
// loadGlobalInterstitialAd { status in
// if status {
// print("广")
// }else {
// print("广")
// }
// }
// loadLoadInterstitialAd { status in
// if status {
// print("广")
// }else {
// print("广")
// }
// }
} }
// //
@objc private func netWorkReachableAction(_ sender:Notification) { @objc private func netWorkReachableAction(_ sender:Notification) {
@ -411,24 +380,9 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
} }
//MARK: - //MARK: -
//广ID //广ID
private var OpenICEID:[MPPositive_AdModelModel] = [] private var OpenICEID:[MPPositive_AdItemModel] = []
//广ID //广ID
private var OpenHOSTID:[MPPositive_AdModelModel] = [] private var OpenHOSTID:[MPPositive_AdItemModel] = []
//广
enum OpenType:Int {
//
case ICE = 0
//
case HOST = 1
var title:String{
switch self {
case .ICE:
return "是冷启动开屏广告"
case .HOST:
return "是热启动开屏广告"
}
}
}
//广 //广
var appOpenAd:GADAppOpenAd? var appOpenAd:GADAppOpenAd?
//广 //广
@ -439,7 +393,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
var isShowingOpenAd:Bool = false var isShowingOpenAd:Bool = false
//广 //广
private var loadOpenAdTime:Date? private var loadOpenAdTime:Date?
//广(5) //广(10)
private var openAppDuration:TimeInterval{ private var openAppDuration:TimeInterval{
get{ get{
if let times = UserDefaults.standard.object(forKey: "OpenAppDuration") as? TimeInterval { if let times = UserDefaults.standard.object(forKey: "OpenAppDuration") as? TimeInterval {
@ -470,7 +424,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
return return
} }
//id //id
var item:MPPositive_AdModelModel var item:MPPositive_AdItemModel
switch type { switch type {
case .ICE: case .ICE:
guard OpenICEID.isEmpty == false else { guard OpenICEID.isEmpty == false else {
@ -517,13 +471,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
} }
isLoadingOpenAd = true isLoadingOpenAd = true
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
//广 //广
if item.type == .Open { if item.type == .Open {
@ -673,9 +620,9 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
//MARK: - //MARK: -
//广ID //广ID
private var SearchINSERTID:[MPPositive_AdModelModel] = [] private var SearchINSERTID:[MPPositive_AdItemModel] = []
//广ID //广ID
private var SearchNATIVEID:[MPPositive_AdModelModel] = [] private var SearchNATIVEID:[MPPositive_AdItemModel] = []
///广 ///广
private var searchInterstitialAd:GADInterstitialAd? private var searchInterstitialAd:GADInterstitialAd?
///广 ///广
@ -725,13 +672,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
searchAdLoader = GADAdLoader(adUnitID: first.identifier, rootViewController: vc, adTypes: [.native], options: [multipleAdOptions, imageAdOptions, videoAdOptions]) searchAdLoader = GADAdLoader(adUnitID: first.identifier, rootViewController: vc, adTypes: [.native], options: [multipleAdOptions, imageAdOptions, videoAdOptions])
searchAdLoader?.delegate = self searchAdLoader?.delegate = self
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
searchAdLoader?.load(request) searchAdLoader?.load(request)
} }
} }
@ -814,13 +754,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
isLoadingSearchInterstitialAd = true isLoadingSearchInterstitialAd = true
let item = SearchINSERTID[level] let item = SearchINSERTID[level]
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
//广 //广
GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in
DispatchQueue.main.async { [weak self] in DispatchQueue.main.async { [weak self] in
@ -889,7 +822,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
//MARK: - //MARK: -
//广ID //广ID
private var PlayerINSERTID:[MPPositive_AdModelModel] = [] private var PlayerINSERTID:[MPPositive_AdItemModel] = []
///广 ///广
var playInterstitialAd:GADInterstitialAd? var playInterstitialAd:GADInterstitialAd?
///广 ///广
@ -938,13 +871,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
isLoadingPlayInterstitialAd = true isLoadingPlayInterstitialAd = true
let item = PlayerINSERTID[level] let item = PlayerINSERTID[level]
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
//广 //广
GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in
DispatchQueue.main.async { [weak self] in DispatchQueue.main.async { [weak self] in
@ -1025,7 +951,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
//MARK: - //MARK: -
//广ID //广ID
private var SwitchINSERTID:[MPPositive_AdModelModel] = [] private var SwitchINSERTID:[MPPositive_AdItemModel] = []
///广 ///广
var switchInterstitialAd:GADInterstitialAd? var switchInterstitialAd:GADInterstitialAd?
///广 ///广
@ -1073,13 +999,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
isLoadingSwitchInterstitialAd = true isLoadingSwitchInterstitialAd = true
let item = SwitchINSERTID[level] let item = SwitchINSERTID[level]
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
//广 //广
GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in
DispatchQueue.main.async { [weak self] in DispatchQueue.main.async { [weak self] in
@ -1150,7 +1069,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
//MARK: - //MARK: -
//广ID //广ID
private var LoadINSERTID:[MPPositive_AdModelModel] = [] private var LoadINSERTID:[MPPositive_AdItemModel] = []
///广 ///广
var loadInterstitialAd:GADInterstitialAd? var loadInterstitialAd:GADInterstitialAd?
///广 ///广
@ -1198,13 +1117,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
isLoadingLoadInterstitialAd = true isLoadingLoadInterstitialAd = true
let item = LoadINSERTID[level] let item = LoadINSERTID[level]
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
//广 //广
GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in
DispatchQueue.main.async { [weak self] in DispatchQueue.main.async { [weak self] in
@ -1274,9 +1186,9 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
} }
//MARK: - //MARK: -
//ID //ID
private var LibraryINSERTID:[MPPositive_AdModelModel] = [] private var LibraryINSERTID:[MPPositive_AdItemModel] = []
//ID //ID
private var LibraryNATIVEID:[MPPositive_AdModelModel] = [] private var LibraryNATIVEID:[MPPositive_AdItemModel] = []
///广 ///广
private var libraryInterstitialAd:GADInterstitialAd? private var libraryInterstitialAd:GADInterstitialAd?
///广 ///广
@ -1333,12 +1245,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
libraryAdLoader?.delegate = self libraryAdLoader?.delegate = self
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource //广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
libraryAdLoader?.load(request) libraryAdLoader?.load(request)
libraryNativeAds = [] libraryNativeAds = []
} }
@ -1446,7 +1352,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
MP_AnalyticsManager.shared.listclk_ads_loadFailureAction("No Ads Fill") MP_AnalyticsManager.shared.listclk_ads_loadFailureAction("No Ads Fill")
DispatchQueue.main.asyncAfter(deadline: .now() + 10) { DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
[weak self] in [weak self] in
self?.loadLoadInterstitialAd { status in self?.loadLibraryInterstitialAd { status in
if status { if status {
print("重新加载曲库插页广告") print("重新加载曲库插页广告")
}else { }else {
@ -1459,13 +1365,6 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
isLoadingLibraryInterstitialAd = true isLoadingLibraryInterstitialAd = true
let item = LibraryINSERTID[level] let item = LibraryINSERTID[level]
let request = GADRequest() let request = GADRequest()
//广-Mintegral,Pangle,Liftoff,ironsource
// let mintegralExtra = GADMAdapterMintegralExtras()
// mintegralExtra.muteVideoAudio = true
// let appLovinExtra = GADMAdapterAppLovinExtras()
// appLovinExtra.muteAudio = true
// request.register(appLovinExtra)
// request.register(mintegralExtra)
//广 //广
GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in GADInterstitialAd.load(withAdUnitID: item.identifier, request: request) { ad, error in
DispatchQueue.main.async { [weak self] in DispatchQueue.main.async { [weak self] in
@ -1538,7 +1437,7 @@ class MP_AdMobManager: NSObject, GADAudioVideoManagerDelegate, GADFullScreenCont
//MARK: - //MARK: -
//ID //ID
private var GlobalINSERTID:[MPPositive_AdModelModel] = [] private var GlobalINSERTID:[MPPositive_AdItemModel] = []
///广 ///广
private var globalInterstitialAd:GADInterstitialAd? private var globalInterstitialAd:GADInterstitialAd?
///广 ///广

View File

@ -190,6 +190,10 @@ class MP_AnalyticsManager: NSObject {
// //
scheduleDailyNotifications() scheduleDailyNotifications()
} }
//广
let platform = self.remoteConfig.configValue(forKey: "platform").boolValue
print("广告平台为\(platform ? "AppLovin":"AdMob")")
UserDefaults.standard.set(platform, forKey: "platform")
// //
if let updateReminder = self.remoteConfig.configValue(forKey: "updateReminder").jsonValue as? [String:Any] { if let updateReminder = self.remoteConfig.configValue(forKey: "updateReminder").jsonValue as? [String:Any] {
// //
@ -229,11 +233,13 @@ class MP_AnalyticsManager: NSObject {
if open { if open {
//广ID- //广ID-
self.reloadAdMobIDs("adMobNewLevelIDs") self.reloadAdMobIDs("adMobNewLevelIDs")
self.reloadAdMobIDs("maxAdLevelIDs")
//b //b
completion(true) completion(true)
}else { }else {
//广ID- //广ID-
self.reloadAdMobIDs("lowPriceAdModIDs") self.reloadAdMobIDs("lowPriceAdModIDs")
self.reloadAdMobIDs("maxAdLevelIDs")
//a //a
completion(false) completion(false)
} }
@ -241,6 +247,7 @@ class MP_AnalyticsManager: NSObject {
//B //B
//广ID- //广ID-
self.reloadAdMobIDs("adMobNewLevelIDs") self.reloadAdMobIDs("adMobNewLevelIDs")
self.reloadAdMobIDs("maxAdLevelIDs")
completion(true) completion(true)
} }
} }
@ -272,14 +279,14 @@ class MP_AnalyticsManager: NSObject {
} }
} }
} }
///广 ///AdMob广
private func reloadAdMobIDs(_ adMob:String) { private func reloadAdMobIDs(_ adMob:String) {
//使广ID //使广ID
//广ID //广ID
if let adTextIDs = self.remoteConfig.configValue(forKey: adMob).jsonValue as? [String:[[String:Any]]] { if let adTextIDs = self.remoteConfig.configValue(forKey: adMob).jsonValue as? [String:[[String:Any]]] {
//广ID //广ID
for (key, values) in adTextIDs { for (key, values) in adTextIDs {
var array:[MPPositive_AdModelModel] = [] var array:[MPPositive_AdItemModel] = []
values.forEach { value in values.forEach { value in
if let level = value["level"] as? Int, let identifier = value["identifier"] as? String, let ad = value["ad"] as? String, let item = value["type"] as? String, let type = MPPositive_AdModelType(rawValue: item) { if let level = value["level"] as? Int, let identifier = value["identifier"] as? String, let ad = value["ad"] as? String, let item = value["type"] as? String, let type = MPPositive_AdModelType(rawValue: item) {
array.append(.init(level: level, identifier: identifier, ad: ad, type: type)) array.append(.init(level: level, identifier: identifier, ad: ad, type: type))
@ -631,6 +638,43 @@ class MP_AnalyticsManager: NSObject {
// //
private let ad_session_total_value:String = "ad_session_total_value" private let ad_session_total_value:String = "ad_session_total_value"
//AppLovin广
//
private let max_lunch_chance:String = "max_lunch_chance"
//
private let max_lunch_loadFailure:String = "max_lunch_loadFailure"
//
private let max_lunch_showSuccess:String = "max_lunch_showSuccess"
//
private let max_lunch_showFailure:String = "max_lunch_showFailure"
//
private let max_search_chance:String = "max_search_chance"
//
private let max_search_loadFailure:String = "max_search_loadFailure"
//
private let max_search_showSuccess:String = "max_search_showSuccess"
//
private let max_search_showFailure:String = "max_search_showFailure"
//
private let max_play_chance:String = "max_play_chance"
//
private let max_play_loadFailure:String = "max_play_loadFailure"
//
private let max_play_showSuccess:String = "max_play_showSuccess"
//
private let max_play_showFailure:String = "max_play_showFailure"
//
private let max_library_chance:String = "max_library_chance"
//
private let max_library_loadFailure:String = "max_library_loadFailure"
//
private let max_library_showSuccess:String = "max_library_showSuccess"
//
private let max_library_showFailure:String = "max_library_showFailure"
//广 //广
private func infoToParameters(_ responseInfo:GADResponseInfo, adValue:GADAdValue) -> [String:Any] { private func infoToParameters(_ responseInfo:GADResponseInfo, adValue:GADAdValue) -> [String:Any] {
var mediation = "Unknown" var mediation = "Unknown"
@ -888,5 +932,78 @@ class MP_AnalyticsManager: NSObject {
let losAngelesTimeString = dateFormatter.string(from: now) let losAngelesTimeString = dateFormatter.string(from: now)
return losAngelesTimeString return losAngelesTimeString
} }
///AppLovin广
func max_lunch_chanceAction() {
Analytics.logEvent(max_lunch_chance, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_lunch_loadFailureAction(_ error:String) {
Analytics.logEvent(max_lunch_loadFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
///AppLovin广
func max_lunch_showSuccessAction() {
Analytics.logEvent(max_lunch_showSuccess, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_lunch_showFailureAction(_ error:String) {
Analytics.logEvent(max_lunch_showFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
///AppLovin广
func max_search_chanceAction() {
Analytics.logEvent(max_search_chance, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_search_loadFailureAction(_ error:String) {
Analytics.logEvent(max_search_loadFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
///AppLovin广
func max_search_showSuccessAction() {
Analytics.logEvent(max_search_showSuccess, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_search_showFailureAction(_ error:String) {
Analytics.logEvent(max_search_showFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
///AppLovin广
func max_play_chanceACtion() {
Analytics.logEvent(max_play_chance, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_play_loadFailureAction(_ error:String) {
Analytics.logEvent(max_play_loadFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
///AppLovin广
func max_play_showSuccessAction() {
Analytics.logEvent(max_play_showSuccess, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_play_showFailureAction(_ error:String) {
Analytics.logEvent(max_play_showFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
///AppLovin广
func max_library_chanceAction() {
Analytics.logEvent(max_library_chance, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_library_loadFailureAction(_ error:String) {
Analytics.logEvent(max_library_loadFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
///AppLovin广
func max_library_showSuccessAction() {
Analytics.logEvent(max_library_showSuccess, parameters: ["CS_STATUS":isOLD ? "Old":"New"])
}
///AppLovin广
func max_library_showFailureAction(_ error:String) {
Analytics.logEvent(max_library_showFailure, parameters: ["CS_STATUS":isOLD ? "Old":"New",
"CS_ERROR":error])
}
} }

View File

@ -0,0 +1,874 @@
//
// MP_AppLovinManager.swift
// relax.offline.mp3.music
//
// Created by Mr.Zhou on 2024/9/18.
//
import UIKit
import AppLovinSDK
///AppLovin
class MP_AppLovinManager: NSObject {
static let shared = MP_AppLovinManager()
///广
private var openAdStatus:Bool = MP_ADSimpleManager.shared.openAdStatus
///使广
private var internalAdStatus:Bool = MP_ADSimpleManager.shared.internalAdStatus
//AppLovinSDk
private var SDKKey:String {
return "1z4AGzagANHydAtmbNQmAcrt1O5_HtPpt4iNTNW5Bb0RQhaXVByUEQTq5cMcR0l9NnfDtuobQqhSQE0kfEWwAC"
}
///广(50)
private let expirationTime:TimeInterval = 3000
//广
private func wasAdexpirationTime(_ date:Date?) -> Bool {
guard let loadTime = date else { return false }
// Check if ad was loaded more than four hours ago.
return Date().timeIntervalSince(loadTime) < expirationTime
}
//MARK: - 广
///广
private var interstitialSwitch:Bool = false{
didSet{
DispatchQueue.main.async {
[weak self] in
MPSideA_MediaCenterManager.shared.isAdLate = self?.interstitialSwitch
}
}
}
///广
var interstitialDate:Date?
///广(40)
private var interstitialDuration:TimeInterval{
get{
if let times = UserDefaults.standard.object(forKey: "InterstitialDuration") as? TimeInterval {
return times
}else {
return 40
}
}
}
///
private var intermediaryDuration:TimeInterval{
get{
if let times = UserDefaults.standard.object(forKey: "IntermediaryDuration") as? TimeInterval {
return times
}else {
return 40
}
}
}
///
func setInterstitialSwitch(_ status:Bool) {
interstitialSwitch = status
}
///
func getInterstitialSwitch() -> Bool {
return interstitialSwitch
}
///
private var intermediaryOpenShowTime:Date?
///
private var intermediaryInterstitialShowTime:Date?
///广
private func retrieveIntermediaryInterstitial() -> Bool {
//
guard let date = intermediaryInterstitialShowTime else {return true}
return Date().timeIntervalSince(date) > intermediaryDuration
}
///广
private func retrieveIntermediaryOpen() -> Bool {
//
guard let date = intermediaryOpenShowTime else {return true}
return Date().timeIntervalSince(date) > intermediaryDuration
}
///广
private func isShowInterstitialADAvailable(_ date:Date) -> Bool {
return Date().timeIntervalSince(date) > interstitialDuration
}
override init() {
super.init()
reloadAppLovinIDs()
//广
completeOpenAdBlock = {
[weak self] in
guard let self = self, interstitialSwitch == true else {return}
//广
appOpenAd = nil
isShowingOpenAd = false
loadOpenAdTime = nil
//广
interstitialSwitch = false
//广
intermediaryOpenShowTime = Date()
//广
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
[weak self] in
self?.loadOpenAd{ status in
if status == true {
print("新的开屏广告加载成功")
}else {
print("开屏广告加载失败了")
}
}
}
}
//广
completeSearchInterstitialAdBlock = {
[weak self] in
guard let self = self, interstitialSwitch == true else {return}
//广
searchInterstitialAd = nil
isShowingSearchInterstitialAd = false
loadSearchInterstitialAdTime = nil
//广
interstitialSwitch = false
//广
intermediaryInterstitialShowTime = Date()
//广
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
[weak self] in
self?.loadSearchInterstitialAd { status in
if status {
print("成功加载搜索插页广告")
}else {
print("搜索插页广告加载失败")
}
}
}
}
//广
completePlayInterstitialAdBlock = {
[weak self] in
guard let self = self, interstitialSwitch == true else {return}
//广
playInterstitialAd = nil
isShowingPlayInterstitialAd = false
loadPlayInterstitialAdTime = nil
//广
interstitialSwitch = false
//广
intermediaryInterstitialShowTime = Date()
//广
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
[weak self] in
self?.loadPlayInterstitialAd { status in
if status {
print("成功加载播放插页广告")
}else {
print("播放插页广告加载失败")
}
}
}
}
//广
completeLibraryInterstitialAdBlock = {
[weak self] in
guard let self = self, interstitialSwitch == true else {return}
//广
libraryInterstitialAd = nil
isShowingLibraryInterstitialAd = false
loadLibraryInterstitialAdTime = nil
//广
interstitialSwitch = false
//广
intermediaryInterstitialShowTime = Date()
//广
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
[weak self] in
self?.loadLibraryInterstitialAd { status in
if status {
print("成功加载曲库插页广告")
}else {
print("曲库插页广告加载失败")
}
}
}
}
}
///
func startConfig() {
//AppLovin
let initConfig = ALSdkInitializationConfiguration(sdkKey: SDKKey) { builder in
builder.mediationProvider = ALMediationProviderMAX
}
//AppLovin
ALSdk.shared().initialize(with: initConfig) { sdkConfig in
//AppLovin广
}
//
ALSdk.shared().settings.isMuted = true
}
///广ID
func reloadAppLovinIDs() {
//广
if let data = UserDefaults.standard.object(forKey: "Max_OpenICEIDs") as? Data, let array = jsonforCoreAdModel(data) {
print("成功提取ID")
OpenIDs = array.sorted(by: {$0.level > $1.level})
}
if let data = UserDefaults.standard.object(forKey: "Max_SearchINSERTIDs") as? Data, let array = jsonforCoreAdModel(data) {
SearchINSERTIDs = array.sorted(by: {$0.level > $1.level})
}
if let data = UserDefaults.standard.object(forKey: "Max_PlayerINSERTIDs") as? Data, let array = jsonforCoreAdModel(data) {
PlayerINSERTIDs = array.sorted(by: {$0.level > $1.level})
}
if let data = UserDefaults.standard.object(forKey: "Max_LibraryNATIVEIDs") as? Data, let array = jsonforCoreAdModel(data) {
LibraryINSERTIDs = array.sorted(by: {$0.level > $1.level})
}
}
///广
func loadMoreAds(){
loadPlayInterstitialAd{status in
if status {
print("成功加载播放插页广告")
}else {
print("播放插页广告加载失败")
}
}
loadSearchInterstitialAd { status in
if status {
print("成功加载搜索插页广告")
}else {
print("搜索插页广告加载失败")
}
}
loadLibraryInterstitialAd { status in
if status {
print("成功加载曲库插页广告")
}else {
print("曲库插页广告加载失败")
}
}
}
//MARK: - 广
///广ID
private var OpenIDs:[MPPositive_AdItemModel] = []
///广
var appOpenAd:MAInterstitialAd?
///广
private var isLoadingOpenAd:Bool = false
///广
var isShowingOpenAd:Bool = false
//广
private var loadOpenAdTime:Date?
//广
private var loadStatuOpenAdBlock:((Bool) -> Void)?
//广
var completeOpenAdBlock:(() -> Void)?
//IDLevel0
private var openLevel:Int = 0
//广(10)
private var openAppDuration:TimeInterval{
get{
if let times = UserDefaults.standard.object(forKey: "OpenAppDuration") as? TimeInterval {
return times
}else {
return 10
}
}
}
//广
func setOpenAppDuration(_ duration:TimeInterval) {
UserDefaults.standard.set(duration, forKey: "OpenAppDuration")
}
//广
func getOpenAppDuration() -> TimeInterval {
return self.openAppDuration
}
///广
func loadOpenAd(_ level:Int = 0, completion: @escaping (Bool) -> Void) {
guard openAdStatus, internalAdStatus else {return}
// 广广
if isLoadingOpenAd || isOpenAdAvailable() {
// 广广
completion(false)
return
}
//id
guard OpenIDs.isEmpty == false else {
//
MP_AnalyticsManager.shared.max_lunch_showFailureAction("No IDs")
//
reloadAppLovinIDs()
completion(false)
return
}
guard level < (OpenIDs.count) else {
print("开屏广告组已经全部加载失败,停止继续加载")
MP_AnalyticsManager.shared.max_lunch_loadFailureAction("No Ads Fill")
completion(false)
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
[weak self] in
self?.loadOpenAd( completion: { status in
if status {
print("重新加载启动广告成功")
}else {
print("重新加载启动广告失败")
}
})
}
return
}
let item = OpenIDs[level]
openLevel = level
//
loadStatuOpenAdBlock = completion
//ID广
appOpenAd = MAInterstitialAd(adUnitIdentifier: item.identifier)
appOpenAd?.delegate = self
//广
appOpenAd?.load()
}
///广
func showOpenAdIfAvailable(_ completion:((_ T:MAInterstitialAd) -> Void)?) {
guard openAdStatus, internalAdStatus else {return}
// 广广广
guard !interstitialSwitch, !isShowingOpenAd, retrieveIntermediaryInterstitial() else { return }
// 广广
if !isOpenAdAvailable() {
loadOpenAd{ [weak self] success in
guard let self = self else { return }
if success {
self.showOpenAdIfAvailable(completion)
}
}
return
}
MP_AnalyticsManager.shared.max_lunch_chanceAction()
if let ad = appOpenAd, ad.isReady {
//
if let block = completion {
block(ad)
}else {
isShowingOpenAd = true
interstitialSwitch = true
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
//
ad.show()
}
}
}else {
print("开屏广告展示失败")
MP_AnalyticsManager.shared.max_lunch_showFailureAction("Ad loading failed")
}
}
///广
func isOpenAdAvailable() -> Bool {
return (appOpenAd != nil) && wasAdexpirationTime(loadOpenAdTime)
}
//MARK: -
///广ID
private var SearchINSERTIDs:[MPPositive_AdItemModel] = []
///广
private var searchInterstitialAd:MAInterstitialAd?
///广
private var isLoadingSearchInterstitialAd:Bool = false
///广
var isShowingSearchInterstitialAd:Bool = false
///
private var loadSearchInterstitialAdTime:Date?
///广
var completeSearchInterstitialAdBlock:(() -> Void)?
//广
private var loadStatuSearchAdBlock:((Bool) -> Void)?
//IDLevel0
private var searchLevel:Int = 0
//广
func loadSearchInterstitialAd(_ level:Int = 0, completion: @escaping (Bool) -> Void) {
guard openAdStatus, internalAdStatus else {return}
if isLoadingSearchInterstitialAd || isSearchInterstitialAdAvailable() {
// 广广
completion(false)
return
}
guard SearchINSERTIDs.isEmpty == false else {
MP_AnalyticsManager.shared.max_search_showFailureAction("No IDs")
//
reloadAppLovinIDs()
completion(false)
return
}
guard level < (SearchINSERTIDs.count) else {
print("搜索插页广告组已经全部加载失败,停止继续加载")
MP_AnalyticsManager.shared.max_search_loadFailureAction("No Ads Fill")
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
[weak self] in
self?.loadSearchInterstitialAd { status in
if status {
print("重新加载搜索插页广告")
}else {
print("加载搜索插页广告失败")
}
}
}
return
}
isLoadingSearchInterstitialAd = true
searchLevel = level
//
loadStatuSearchAdBlock = completion
let item = SearchINSERTIDs[level]
//ID广
searchInterstitialAd = MAInterstitialAd(adUnitIdentifier: item.identifier)
searchInterstitialAd?.delegate = self
//广
searchInterstitialAd?.load()
}
///广
func showSearchInterstitialAdIfAvailable(_ completion:((MAInterstitialAd) -> Void)?) {
guard openAdStatus, internalAdStatus else {return}
// 广广广
guard !interstitialSwitch, !isShowingSearchInterstitialAd, retrieveIntermediaryOpen() else { return }
//
if let date = interstitialDate {
if isShowInterstitialADAvailable(date) == false {
//
print("距上一次展示插页广告时长未超过要求,此次插页广告展示滞后")
return
}
}
// 广广
if !isSearchInterstitialAdAvailable() {
loadSearchInterstitialAd { [weak self] success in
guard let self = self else { return }
if success {
self.showSearchInterstitialAdIfAvailable(completion)
}
}
return
}
MP_AnalyticsManager.shared.max_search_chanceAction()
//广
if let ad = searchInterstitialAd, ad.isReady {
//
if let block = completion {
block(ad)
}else {
isShowingSearchInterstitialAd = true
interstitialSwitch = true
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
//
ad.show()
}
}
}else {
MP_AnalyticsManager.shared.max_search_showFailureAction("Ad loading failed")
}
}
//广
func isSearchInterstitialAdAvailable() -> Bool {
return searchInterstitialAd != nil && wasAdexpirationTime(loadSearchInterstitialAdTime)
}
//MARK: - /广
///广ID
private var PlayerINSERTIDs:[MPPositive_AdItemModel] = []
///广
var playInterstitialAd:MAInterstitialAd?
///广
private var isLoadingPlayInterstitialAd:Bool = false
///广
var isShowingPlayInterstitialAd:Bool = false
///
private var loadPlayInterstitialAdTime:Date?
///广
var completePlayInterstitialAdBlock:(() -> Void)?
//广
private var loadStatuPlayAdBlock:((Bool) -> Void)?
//IDLevel0
private var playLevel:Int = 0
//广
func loadPlayInterstitialAd(_ level:Int = 0, completion: @escaping (Bool) -> Void) {
guard openAdStatus, internalAdStatus else {
completion(false)
return
}
// 广广
if isLoadingPlayInterstitialAd || isPlayInterstitialAdAvailable() {
// 广广
completion(false)
return
}
guard PlayerINSERTIDs.isEmpty == false else {
MP_AnalyticsManager.shared.max_play_showFailureAction("No IDs")
//
reloadAppLovinIDs()
completion(false)
return
}
guard level < (PlayerINSERTIDs.count) else {
print("播放插页广告组已经全部加载失败,停止继续加载")
MP_AnalyticsManager.shared.max_play_loadFailureAction("No Ads Fill")
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
[weak self] in
self?.loadPlayInterstitialAd { status in
if status {
print("重新加载播放插页广告")
}else {
print("加载播放插页广告失败")
}
}
}
return
}
isLoadingPlayInterstitialAd = true
playLevel = level
//
loadStatuPlayAdBlock = completion
let item = PlayerINSERTIDs[level]
//ID广
playInterstitialAd = MAInterstitialAd(adUnitIdentifier: item.identifier)
playInterstitialAd?.delegate = self
//广
playInterstitialAd?.load()
}
///广
func showPlayInterstitialAdIfAvailable(_ completion:((MAInterstitialAd?) -> Void)?) {
guard openAdStatus, internalAdStatus else {
completion?(nil)
return
}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
completion?(nil)
return
}
// 广广广
guard !interstitialSwitch, !isShowingPlayInterstitialAd, retrieveIntermediaryOpen() else {
completion?(nil)
return
}
//
if let date = interstitialDate {
if isShowInterstitialADAvailable(date) == false {
//
print("距上一次展示插页广告时长未超过要求,此次插页广告展示滞后")
completion?(nil)
return
}
}
// 广广
if !isPlayInterstitialAdAvailable() {
loadPlayInterstitialAd{ [weak self] success in
guard let self = self else { return }
if success {
print("播放广告已加载")
}
}
completion?(nil)
return
}
MP_AnalyticsManager.shared.max_play_chanceACtion()
//广
if let ad = playInterstitialAd, ad.isReady {
//
if let block = completion {
block(ad)
}else {
isShowingPlayInterstitialAd = true
interstitialSwitch = true
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
//
ad.show()
}
}
}else {
MP_AnalyticsManager.shared.max_play_showFailureAction("Ad loading failed")
completion?(nil)
}
}
//广
func isPlayInterstitialAdAvailable() -> Bool {
return playInterstitialAd != nil && wasAdexpirationTime(loadPlayInterstitialAdTime)
}
//MARK: - /广
///ID
private var LibraryINSERTIDs:[MPPositive_AdItemModel] = []
///广
private var libraryInterstitialAd:MAInterstitialAd?
///广
private var isLoadingLibraryInterstitialAd:Bool = false
///广
var isShowingLibraryInterstitialAd:Bool = false
///
private var loadLibraryInterstitialAdTime:Date?
///广
var completeLibraryInterstitialAdBlock:(() -> Void)?
//广
private var loadStatuLibraryAdBlock:((Bool) -> Void)?
//IDLevel0
private var libraryLevel:Int = 0
//广
func loadLibraryInterstitialAd(_ level:Int = 0, completion: @escaping (Bool) -> Void) {
guard openAdStatus, internalAdStatus else {
completion(false)
return
}
// 广广
if isLoadingLibraryInterstitialAd || isLibraryInterstitialAdAvailable() {
// 广广
completion(false)
return
}
guard LibraryINSERTIDs.isEmpty == false else {
MP_AnalyticsManager.shared.max_library_showFailureAction("No IDs")
//
reloadAppLovinIDs()
completion(false)
return
}
guard level < (LibraryINSERTIDs.count) else {
print("曲库插页广告组已经全部加载失败,停止继续加载")
MP_AnalyticsManager.shared.max_library_loadFailureAction("No Ads Fill")
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
[weak self] in
self?.loadLibraryInterstitialAd { status in
if status {
print("重新加载曲库插页广告")
}else {
print("加载曲库插页广告失败")
}
}
}
return
}
isLoadingLibraryInterstitialAd = true
libraryLevel = level
//
loadStatuLibraryAdBlock = completion
let item = LibraryINSERTIDs[level]
//ID广
libraryInterstitialAd = MAInterstitialAd(adUnitIdentifier: item.identifier)
libraryInterstitialAd?.delegate = self
//广
libraryInterstitialAd?.load()
}
///广
func showLibraryInterstitialAdIfAvailable(_ completion:((MAInterstitialAd) -> Void)?) {
// 广广广
guard !interstitialSwitch, !isShowingLibraryInterstitialAd, retrieveIntermediaryOpen() else { return }
//
if let date = interstitialDate {
if isShowInterstitialADAvailable(date) == false {
//
print("距上一次展示插页广告时长未超过要求,此次插页广告展示滞后")
return
}
}
// 广广
if !isLibraryInterstitialAdAvailable() {
loadLibraryInterstitialAd { [weak self] success in
guard let self = self else { return }
if success {
self.showLibraryInterstitialAdIfAvailable(completion)
}
}
return
}
MP_AnalyticsManager.shared.max_library_chanceAction()
//广
if let ad = libraryInterstitialAd, ad.isReady {
//
if let block = completion {
block(ad)
}else {
isShowingPlayInterstitialAd = true
interstitialSwitch = true
DispatchQueue.main.async {
[weak self] in
guard let self = self else {return}
//
ad.show()
}
}
}else {
MP_AnalyticsManager.shared.max_library_showFailureAction("Ad loading failed")
}
}
//广
func isLibraryInterstitialAdAvailable() -> Bool {
return libraryInterstitialAd != nil && wasAdexpirationTime(loadLibraryInterstitialAdTime)
}
}
//MARK: - 广
extension MP_AppLovinManager: MAAdDelegate {
//广
func didLoad(_ ad: MAAd) {
let adUnitIdentifier = ad.adUnitIdentifier
//广
if adUnitIdentifier == appOpenAd?.adUnitIdentifier {
//广
isLoadingOpenAd = false
//广
loadOpenAdTime = Date()
//广
if let block = loadStatuOpenAdBlock {
block(true)
}
}else if adUnitIdentifier == searchInterstitialAd?.adUnitIdentifier {
//广
isLoadingSearchInterstitialAd = false
//广
loadSearchInterstitialAdTime = Date()
//广
if let block = loadStatuSearchAdBlock {
block(true)
}
}else if adUnitIdentifier == playInterstitialAd?.adUnitIdentifier {
//广
isLoadingPlayInterstitialAd = false
//广
loadPlayInterstitialAdTime = Date()
//广
if let block = loadStatuPlayAdBlock {
block(true)
}
}else if adUnitIdentifier == libraryInterstitialAd?.adUnitIdentifier {
//广
isLoadingLibraryInterstitialAd = false
//广
loadLibraryInterstitialAdTime = Date()
//广
if let block = loadStatuLibraryAdBlock {
block(true)
}
}
}
//广
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
//广
if adUnitIdentifier == appOpenAd?.adUnitIdentifier {
//广
isLoadingOpenAd = false
//广广
appOpenAd = nil
MP_AnalyticsManager.shared.max_lunch_loadFailureAction(error.message)
if let block = loadStatuOpenAdBlock {
//广
loadOpenAd(openLevel + 1, completion: block)
}
}else if adUnitIdentifier == searchInterstitialAd?.adUnitIdentifier {
//广
isLoadingSearchInterstitialAd = false
searchInterstitialAd = nil
MP_AnalyticsManager.shared.max_search_loadFailureAction(error.message)
if let block = loadStatuSearchAdBlock {
loadSearchInterstitialAd(searchLevel + 1, completion: block)
}
}else if adUnitIdentifier == playInterstitialAd?.adUnitIdentifier {
//广
isLoadingPlayInterstitialAd = false
playInterstitialAd = nil
MP_AnalyticsManager.shared.max_play_loadFailureAction(error.message)
if let block = loadStatuPlayAdBlock {
loadPlayInterstitialAd(playLevel + 1, completion: block)
}
}else if adUnitIdentifier == libraryInterstitialAd?.adUnitIdentifier {
//广
isLoadingLibraryInterstitialAd = false
libraryInterstitialAd = nil
MP_AnalyticsManager.shared.max_library_loadFailureAction(error.message)
if let block = loadStatuLibraryAdBlock {
loadLibraryInterstitialAd(libraryLevel + 1, completion: block)
}
}
}
//广
func didDisplay(_ ad: MAAd) {
let adUnitIdentifier = ad.adUnitIdentifier
//广
if adUnitIdentifier == appOpenAd?.adUnitIdentifier {
//广
print("当前展示的广告是开屏广告广告ID--\(ad.adUnitIdentifier)")
//广
}else if adUnitIdentifier == searchInterstitialAd?.adUnitIdentifier {
//广
print("当前展示的广告是搜索插页广告广告ID--\(ad.adUnitIdentifier)")
//广
}else if adUnitIdentifier == playInterstitialAd?.adUnitIdentifier {
//广
print("当前展示的广告是播放插页广告广告ID--\(ad.adUnitIdentifier)")
}else if adUnitIdentifier == libraryInterstitialAd?.adUnitIdentifier {
//广
print("当前展示的广告是曲库插页广告广告ID--\(ad.adUnitIdentifier)")
}
}
//广
func didHide(_ ad: MAAd) {
let adUnitIdentifier = ad.adUnitIdentifier
//广
interstitialDate = Date()
if adUnitIdentifier == appOpenAd?.adUnitIdentifier {
print("当前消失的广告是开屏广告广告ID--\(ad.adUnitIdentifier)")
if let block = completeOpenAdBlock {
block()
}
}else if adUnitIdentifier == searchInterstitialAd?.adUnitIdentifier {
//广
print("当前消失的广告是搜索插页广告广告ID--\(ad.adUnitIdentifier)")
if let block = completeSearchInterstitialAdBlock {
block()
}
}else if adUnitIdentifier == playInterstitialAd?.adUnitIdentifier {
//广
print("当前消失的广告是播放插页广告广告ID--\(ad.adUnitIdentifier)")
if let block = completePlayInterstitialAdBlock {
block()
}
}else if adUnitIdentifier == libraryInterstitialAd?.adUnitIdentifier {
//广
print("当前消失的广告是曲库插页广告广告ID--\(ad.adUnitIdentifier)")
if let block = completeLibraryInterstitialAdBlock {
block()
}
}
}
//广
func didClick(_ ad: MAAd) {
}
//广
func didFail(toDisplay ad: MAAd, withError error: MAError) {
let adUnitIdentifier = ad.adUnitIdentifier
//广
interstitialDate = Date()
if adUnitIdentifier == appOpenAd?.adUnitIdentifier {
print("开屏广告展示时出错广告ID--\(ad.adUnitIdentifier),具体错误原因:\(error.message)")
MP_AnalyticsManager.shared.max_lunch_showFailureAction(error.message)
if let block = completeOpenAdBlock {
block()
}
}else if adUnitIdentifier == searchInterstitialAd?.adUnitIdentifier {
//广
print("搜索插页广告展示时出错广告ID--\(ad.adUnitIdentifier),具体错误原因:\(error.message)")
MP_AnalyticsManager.shared.max_search_showFailureAction(error.message)
if let block = completeSearchInterstitialAdBlock {
block()
}
}else if adUnitIdentifier == playInterstitialAd?.adUnitIdentifier {
//广
print("播放插页广告展示时出错广告ID--\(ad.adUnitIdentifier),具体错误原因:\(error.message)")
MP_AnalyticsManager.shared.max_play_showFailureAction(error.message)
if let block = completePlayInterstitialAdBlock {
block()
}
}else if adUnitIdentifier == libraryInterstitialAd?.adUnitIdentifier {
//广
print("曲库插页广告展示时出错广告ID--\(ad.adUnitIdentifier),具体错误原因:\(error.message)")
MP_AnalyticsManager.shared.max_library_showFailureAction(error.message)
if let block = completeLibraryInterstitialAdBlock {
block()
}
}
}
}

View File

@ -114,6 +114,8 @@ class MP_DownloadManager: NSObject {
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
}failure: { statu in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in

View File

@ -31,7 +31,7 @@ class MP_HUD: NSObject {
SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.15)) SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.15))
SVProgressHUD.setForegroundColor(.init(hex: "#80F988")) SVProgressHUD.setForegroundColor(.init(hex: "#80F988"))
SVProgressHUD.setOffsetFromCenter(.init(horizontal: 0, vertical: 0)) SVProgressHUD.setOffsetFromCenter(.init(horizontal: 0, vertical: 0))
if MP_AdMobManager.shared.getInterstitialSwitch() { if MP_ADSimpleManager.shared.getInterstitialSwitch() {
// //
}else { }else {
@ -46,7 +46,7 @@ class MP_HUD: NSObject {
SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.15)) SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.15))
SVProgressHUD.setForegroundColor(.init(hex: "#80F988")) SVProgressHUD.setForegroundColor(.init(hex: "#80F988"))
SVProgressHUD.setOffsetFromCenter(.init(horizontal: 0, vertical: 0)) SVProgressHUD.setOffsetFromCenter(.init(horizontal: 0, vertical: 0))
if MP_AdMobManager.shared.getInterstitialSwitch() { if MP_ADSimpleManager.shared.getInterstitialSwitch() {
// //
guard let completion = completion else{ guard let completion = completion else{
return return
@ -104,7 +104,7 @@ class MP_HUD: NSObject {
SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.15)) SVProgressHUD.setBackgroundColor(.init(hex: "#80F988", alpha: 0.15))
SVProgressHUD.setForegroundColor(.init(hex: "#80F988")) SVProgressHUD.setForegroundColor(.init(hex: "#80F988"))
SVProgressHUD.setOffsetFromCenter(.init(horizontal: 0, vertical: 0)) SVProgressHUD.setOffsetFromCenter(.init(horizontal: 0, vertical: 0))
if MP_AdMobManager.shared.getInterstitialSwitch() { if MP_ADSimpleManager.shared.getInterstitialSwitch() {
// //
guard let completion = completion else{ guard let completion = completion else{
return return

View File

@ -76,7 +76,7 @@ class MP_IAPManager: NSObject {
// //
print("没有收据,广告默认开") print("没有收据,广告默认开")
//AppStore,使广 //AppStore,使广
MP_AdMobManager.shared.setOpenAdStatus(true) MP_ADSimpleManager.shared.setOpenAdStatus(true)
return return
} }
// //
@ -90,7 +90,7 @@ class MP_IAPManager: NSObject {
// //
print("没有收据,广告默认开") print("没有收据,广告默认开")
//AppStore,使广 //AppStore,使广
MP_AdMobManager.shared.setOpenAdStatus(true) MP_ADSimpleManager.shared.setOpenAdStatus(true)
return return
} }
// //
@ -102,9 +102,9 @@ class MP_IAPManager: NSObject {
//广 //广
if isProductPurchased(productId: productIdentifiers[0]) || isProductPurchased(productId: productIdentifiers[1]) || isProductPurchased(productId: productIdentifiers[2]){ if isProductPurchased(productId: productIdentifiers[0]) || isProductPurchased(productId: productIdentifiers[1]) || isProductPurchased(productId: productIdentifiers[2]){
//广 //广
MP_AdMobManager.shared.setOpenAdStatus(false) MP_ADSimpleManager.shared.setOpenAdStatus(false)
}else { }else {
MP_AdMobManager.shared.setOpenAdStatus(true) MP_ADSimpleManager.shared.setOpenAdStatus(true)
} }
} }
@ -162,7 +162,7 @@ extension MP_IAPManager: SKProductsRequestDelegate, SKPaymentTransactionObserver
productIdentifiers.forEach { item in productIdentifiers.forEach { item in
cleanPurchase(productId: item) cleanPurchase(productId: item)
} }
MP_AdMobManager.shared.setOpenAdStatus(true) MP_ADSimpleManager.shared.setOpenAdStatus(true)
} }
} }
func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: any Error) { func paymentQueue(_ queue: SKPaymentQueue, restoreCompletedTransactionsFailedWithError error: any Error) {
@ -172,7 +172,7 @@ extension MP_IAPManager: SKProductsRequestDelegate, SKPaymentTransactionObserver
productIdentifiers.forEach { item in productIdentifiers.forEach { item in
cleanPurchase(productId: item) cleanPurchase(productId: item)
} }
MP_AdMobManager.shared.setOpenAdStatus(true) MP_ADSimpleManager.shared.setOpenAdStatus(true)
} }
// //
private func storePurchase(productId: String) { private func storePurchase(productId: String) {

View File

@ -9,6 +9,7 @@ import UIKit
import Alamofire import Alamofire
import Security import Security
import AdSupport import AdSupport
/// ///
class MP_LuxServerManager: NSObject { class MP_LuxServerManager: NSObject {
// //
@ -60,7 +61,7 @@ class MP_LuxServerManager: NSObject {
} }
/// ///
private var deviceVersion: String { private var deviceVersion: String {
return UIDevice.current.name return UIDevice.current.modelName
} }
/// ///
private var osVersion:String { private var osVersion:String {

View File

@ -973,7 +973,7 @@ extension MP_NetWorkManager {
//MARK: - player //MARK: - player
/// Player(/) /// Player(/)
/// - Parameter item: /// - Parameter item:
func requestAndroidPlayer(_ videoId: String, playlistId: String, clickTrackingParams: String?, completion:@escaping ((([String],[Int],[String])?, [String]?) -> Void)){ func requestAndroidPlayer(_ videoId: String, playlistId: String, clickTrackingParams: String?, completion:@escaping ((([String],[Int],[String])?, [String]?) -> Void), failure: ((Bool) -> Void)? = nil){
guard netWorkStatu != .notReachable else { guard netWorkStatu != .notReachable else {
completion(nil,nil) completion(nil,nil)
return return
@ -1006,9 +1006,11 @@ extension MP_NetWorkManager {
//guard netWorkStatu != .notReachable else {return} //guard netWorkStatu != .notReachable else {return}
requestAndroidPostPlayer(url, videoId: videoId, parameters: parameters){ resourceUlrs, coverUrls in requestAndroidPostPlayer(url, videoId: videoId, parameters: parameters){ resourceUlrs, coverUrls in
completion(resourceUlrs, coverUrls) completion(resourceUlrs, coverUrls)
} failure: { statu in
failure?(statu)
} }
} }
private func requestAndroidPostPlayer(_ url:URL, videoId:String, parameters:Parameters, completion:@escaping((([String],[Int],[String])?, [String]?) -> Void)) { private func requestAndroidPostPlayer(_ url:URL, videoId:String, parameters:Parameters, completion:@escaping((([String],[Int],[String])?, [String]?) -> Void), failure:((Bool) -> Void)? = nil) {
//post //post
let request = PlayerSeesion.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default).responseDecodable(of: JsonAndroidPlayer.self) { [weak self] (response) in let request = PlayerSeesion.request(url, method: .post, parameters: parameters, encoding: JSONEncoding.default).responseDecodable(of: JsonAndroidPlayer.self) { [weak self] (response) in
guard let self = self else {return} guard let self = self else {return}
@ -1016,11 +1018,16 @@ extension MP_NetWorkManager {
switch response.result { switch response.result {
case .success(let value): case .success(let value):
parsingAndroidPlayer(value) { resourceUlrs, coverUrls in parsingAndroidPlayer(value) { resourceUlrs, coverUrls in
//
completion(resourceUlrs, coverUrls) completion(resourceUlrs, coverUrls)
} failure: { statu in
//
failure?(statu)
} }
case .failure(let error): case .failure(let error):
// //
completion(nil,nil) failure?(false)
// //
handleError(url, error: error, status: false) handleError(url, error: error, status: false)
} }
@ -2034,17 +2041,20 @@ extension MP_NetWorkManager {
// } // }
// } // }
// } // }
private func parsingAndroidPlayer(_ player:JsonAndroidPlayer,completion:@escaping((([String],[Int],[String]), [String]?) -> Void)){ private func parsingAndroidPlayer(_ player:JsonAndroidPlayer,completion:@escaping((([String],[Int],[String]), [String]?) -> Void), failure:((Bool) -> Void)? = nil){
var infos:[String]? var infos:[String]?
//player //player
if let videoDetails = player.videoDetails { if let videoDetails = player.videoDetails {
infos = parsingAndroidPlayerVideoDetails(videoDetails) infos = parsingAndroidPlayerVideoDetails(videoDetails)
} }
if let streamingData = player.streamingData { if let streamingData = player.streamingData {
//
parsingAndroidPlayerStreamingData(streamingData){ videos,itags,mimeType in parsingAndroidPlayerStreamingData(streamingData){ videos,itags,mimeType in
completion((videos,itags,mimeType),infos) completion((videos,itags,mimeType),infos)
} }
}else { }else {
//IP
failure?(true)
MP_HUD.error("Failed to obtain resource, please try again later", delay: 1.0, completion: nil) MP_HUD.error("Failed to obtain resource, please try again later", delay: 1.0, completion: nil)
MP_AnalyticsManager.shared.player_resource_failureAction(locaton ?? "HK") MP_AnalyticsManager.shared.player_resource_failureAction(locaton ?? "HK")
} }

View File

@ -232,6 +232,8 @@ class MP_PlayerManager:NSObject{
private var playbackLikelyToKeepUpObservation:NSKeyValueObservation? private var playbackLikelyToKeepUpObservation:NSKeyValueObservation?
/// ///
private var errorObservation:NSKeyValueObservation? private var errorObservation:NSKeyValueObservation?
///
private var playEntitlementObservation:NSKeyValueObservation?
private override init() { private override init() {
super.init() super.init()
// //
@ -314,6 +316,14 @@ class MP_PlayerManager:NSObject{
if startAction != nil { if startAction != nil {
startActionBlock = startAction startActionBlock = startAction
} }
//
guard loadPlayer?.currentVideo?.isPlayEntitlement != false else {
//,
if MP_NetWorkManager.shared.netWorkStatu == .reachable {
nextEvent()
}
return
}
if let currentVideo = loadPlayer?.currentVideo { if let currentVideo = loadPlayer?.currentVideo {
//playerItem //playerItem
player.replaceCurrentItem(with: currentVideo.resourcePlayerItem) player.replaceCurrentItem(with: currentVideo.resourcePlayerItem)
@ -412,6 +422,15 @@ class MP_PlayerManager:NSObject{
MP_AnalyticsManager.shared.player_b_failure_errorAction(currentVideo.song.videoId ?? "", videoname: currentVideo.title ?? "", artistname: currentVideo.song.shortBylineText ?? "", error: nsError.localizedDescription) MP_AnalyticsManager.shared.player_b_failure_errorAction(currentVideo.song.videoId ?? "", videoname: currentVideo.title ?? "", artistname: currentVideo.song.shortBylineText ?? "", error: nsError.localizedDescription)
} }
}) })
//
playEntitlementObservation?.invalidate()
playEntitlementObservation = currentVideo.observe(\.isPlayEntitlement, options: [.old,.new], changeHandler: { [weak self] item, change in
guard let self = self, MP_NetWorkManager.shared.netWorkStatu == .reachable else {return}
if change.newValue == 0 {
//
nextEvent()
}
})
currentVideo.isKVO = true currentVideo.isKVO = true
//0 //0
player.seek(to: .zero) player.seek(to: .zero)
@ -485,7 +504,17 @@ class MP_PlayerManager:NSObject{
} }
} }
} }
//
func playerStatuTimerAction() {
MPPositive_Debouncer.shared.playCall {
[weak self] in
guard let self = self else {return}
//10
if playState != .Playing {
MP_HUD.text("Failed to obtain resource, please try again later".localizableString(), delay: 2.0, completion: nil)
}
}
}
// //
private func cacheLoadTimes() { private func cacheLoadTimes() {
//Item //Item

View File

@ -1,5 +1,5 @@
// //
// MPPositive_AdModelModel.swift // MPPositive_AdItemModel.swift
// relax.offline.mp3.music // relax.offline.mp3.music
// //
// Created by Mr.Zhou on 2024/7/10. // Created by Mr.Zhou on 2024/7/10.
@ -7,7 +7,7 @@
import UIKit import UIKit
///广 ///广
class MPPositive_AdModelModel: NSObject, Codable { class MPPositive_AdItemModel: NSObject, Codable {
/// ///
var level:Int var level:Int
///id ///id

View File

@ -16,12 +16,15 @@ class MPPositive_LibraryItemModel: NSObject {
var title:String var title:String
/// ///
var identifier:String? var identifier:String?
///
var count:Int
init(libraryType: LibraryType, coverUrl: URL?, title: String, identifier: String? = nil) { init(libraryType: LibraryType, coverUrl: URL?, title: String, identifier: String? = nil, count:Int) {
self.libraryType = libraryType self.libraryType = libraryType
self.coverUrl = coverUrl self.coverUrl = coverUrl
self.title = title self.title = title
self.identifier = identifier self.identifier = identifier
self.count = count
} }
} }
///Library ///Library

View File

@ -56,30 +56,30 @@ class MPPositive_LibraryListViewModel: NSObject {
} }
if songs.isEmpty == false, let lastUrl = songs.first?.coverURL { if songs.isEmpty == false, let lastUrl = songs.first?.coverURL {
// //
let item = MPPositive_LibraryViewModel(.init(libraryType: .love_songs, coverUrl: lastUrl, title: "Love Songs".localizableString())) let item = MPPositive_LibraryViewModel(.init(libraryType: .love_songs, coverUrl: lastUrl, title: "Love Songs".localizableString(), count: songs.count))
array.append(item) array.append(item)
}else { }else {
let item = MPPositive_LibraryViewModel(.init(libraryType: .love_songs, coverUrl: nil, title: "Love Songs".localizableString())) let item = MPPositive_LibraryViewModel(.init(libraryType: .love_songs, coverUrl: nil, title: "Love Songs".localizableString(), count: 0))
array.append(item) array.append(item)
} }
if artists.isEmpty == false, let lastUrl = artists.first?.coverURL { if artists.isEmpty == false, let lastUrl = artists.first?.coverURL {
let item = MPPositive_LibraryViewModel(.init(libraryType: .love_aritists, coverUrl: lastUrl, title: "Love Artists".localizableString())) let item = MPPositive_LibraryViewModel(.init(libraryType: .love_aritists, coverUrl: lastUrl, title: "Love Artists".localizableString(), count: artists.count))
array.append(item) array.append(item)
}else { }else {
let item = MPPositive_LibraryViewModel(.init(libraryType: .love_aritists, coverUrl: nil, title: "Love Artists".localizableString())) let item = MPPositive_LibraryViewModel(.init(libraryType: .love_aritists, coverUrl: nil, title: "Love Artists".localizableString(), count: 0))
array.append(item) array.append(item)
} }
if offlines.isEmpty == false, let lastUrl = offlines.first?.reviewURL { if offlines.isEmpty == false, let lastUrl = offlines.first?.reviewURL {
let item = MPPositive_LibraryViewModel(.init(libraryType: .offline_songs, coverUrl: lastUrl, title: "Offline Songs".localizableString())) let item = MPPositive_LibraryViewModel(.init(libraryType: .offline_songs, coverUrl: lastUrl, title: "Offline Songs".localizableString(), count: offlines.count))
array.append(item) array.append(item)
}else { }else {
let item = MPPositive_LibraryViewModel(.init(libraryType: .offline_songs, coverUrl: nil, title: "Offline Songs".localizableString())) let item = MPPositive_LibraryViewModel(.init(libraryType: .offline_songs, coverUrl: nil, title: "Offline Songs".localizableString(), count: 0))
array.append(item) array.append(item)
} }
// //
MPPositive_LoadCoreModel.shared.playLists.forEach { list in MPPositive_LoadCoreModel.shared.playLists.forEach { list in
if list.playList.videosArray.isEmpty == false, let lastUrl = list.coverImageURL, let title = list.title, let identifier = list.playList.playListId { if list.playList.videosArray.isEmpty == false, let lastUrl = list.coverImageURL, let title = list.title, let identifier = list.playList.playListId {
let item = MPPositive_LibraryViewModel(.init(libraryType: .custom_playlist, coverUrl: lastUrl, title: title, identifier: identifier)) let item = MPPositive_LibraryViewModel(.init(libraryType: .custom_playlist, coverUrl: lastUrl, title: title, identifier: identifier, count: 0))
array.append(item) array.append(item)
} }
} }

View File

@ -36,6 +36,11 @@ class MPPositive_SongViewModel: NSObject {
var isKVO:Bool = false var isKVO:Bool = false
/// ///
var isPreload:Bool = false var isPreload:Bool = false
///
var isEmptyResource:Bool = false
///()
@objc dynamic var isPlayEntitlement:NSNumber?
/// ///
var song:MPPositive_SongItemModel! var song:MPPositive_SongItemModel!
init(_ song:MPPositive_SongItemModel) { init(_ song:MPPositive_SongItemModel) {
@ -80,7 +85,10 @@ class MPPositive_SongViewModel: NSObject {
if song.lyricsID == nil || song.relatedID == nil { if song.lyricsID == nil || song.relatedID == nil {
// //
improveDataforLycirsAndRelated(song) {[weak self] (result) in improveDataforLycirsAndRelated(song) {[weak self] (result) in
guard let self = self else {return} guard let self = self else {
group.leave()
return
}
if let resultID = result.0 { if let resultID = result.0 {
song.lyricsID = resultID song.lyricsID = resultID
} }
@ -104,13 +112,31 @@ class MPPositive_SongViewModel: NSObject {
// //
// //
improveDataforResouceAndCover(song) { [weak self] resourceUrls, coverUrls in improveDataforResouceAndCover(song) { [weak self] resourceUrls, coverUrls in
guard let self = self else {return} guard let self = self else {
group.leave()
return
}
if let resourceUrls = resourceUrls { if let resourceUrls = resourceUrls {
song.resourceUrls = resourceUrls.0 song.resourceUrls = resourceUrls.0
song.itags = resourceUrls.1 song.itags = resourceUrls.1
song.mimeTypes = resourceUrls.2 song.mimeTypes = resourceUrls.2
} }
song.coverUrls = coverUrls song.coverUrls = coverUrls
isEmptyResource = false
isPlayEntitlement = true
group.leave()
}failure: { [weak self] statu in
guard let self = self else {
group.leave()
return
}
//statufalsetrue
if statu == false {
isEmptyResource = false
}else {
//
isEmptyResource = true
}
group.leave() group.leave()
} }
} }
@ -120,9 +146,9 @@ class MPPositive_SongViewModel: NSObject {
guard let self = self else {return} guard let self = self else {return}
// //
if let first = song.resourceUrls?.first { if let first = song.resourceUrls?.first {
//
resourcePlayerURL = .init(string:first) resourcePlayerURL = .init(string:first)
if isDlownd == true { if isDlownd == true {
// //
resourcePlayerAsset = .init(LocalURL: resourcePlayerURL!, videoId: song.videoId ?? "", title: title ?? "") resourcePlayerAsset = .init(LocalURL: resourcePlayerURL!, videoId: song.videoId ?? "", title: title ?? "")
}else { }else {
@ -130,6 +156,11 @@ class MPPositive_SongViewModel: NSObject {
resourcePlayerAsset = .init(resourcePlayerURL!, videoId: song.videoId ?? "", title: title ?? "") resourcePlayerAsset = .init(resourcePlayerURL!, videoId: song.videoId ?? "", title: title ?? "")
} }
resourcePlayerItem = .init(asset: resourcePlayerAsset) resourcePlayerItem = .init(asset: resourcePlayerAsset)
}else {
//
if isEmptyResource == false {
isPlayEntitlement = false
}
} }
// //
if song.lyrics != nil { if song.lyrics != nil {

View File

@ -140,6 +140,7 @@ class MPPositive_PlayerLoadViewModel: NSObject {
self.currentVideo = self.listViewVideos.first(where: {$0.song.videoId == targetVideoId}) self.currentVideo = self.listViewVideos.first(where: {$0.song.videoId == targetVideoId})
//7 //7
self.listViewVideos = self.listViewVideos.suffix(7) self.listViewVideos = self.listViewVideos.suffix(7)
MP_PlayerManager.shared.playerStatuTimerAction()
} }
/// ///
func remakeImproveData(_ completion:@escaping (() -> Void)) { func remakeImproveData(_ completion:@escaping (() -> Void)) {

View File

@ -111,6 +111,8 @@ class MPPositive_MoreSongOperationsViewController: UIViewController, UIViewContr
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in
@ -149,6 +151,8 @@ class MPPositive_MoreSongOperationsViewController: UIViewController, UIViewContr
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in
@ -187,6 +191,8 @@ class MPPositive_MoreSongOperationsViewController: UIViewController, UIViewContr
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in
@ -226,6 +232,8 @@ class MPPositive_MoreSongOperationsViewController: UIViewController, UIViewContr
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in

View File

@ -6,8 +6,9 @@
// //
import UIKit import UIKit
import AppLovinSDK
///btabBar ///btabBar
class MPPositive_TabBarController: UITabBarController, UIViewControllerTransitioningDelegate, GADFullScreenContentDelegate { class MPPositive_TabBarController: UITabBarController, UIViewControllerTransitioningDelegate, GADFullScreenContentDelegate, MAAdDelegate {
//tabBar //tabBar
private lazy var customTabBar:MPPositive_CustomTabBar = .init(frame: .init(x: 0, y: 0, width: screen_Width, height: 72*width)) private lazy var customTabBar:MPPositive_CustomTabBar = .init(frame: .init(x: 0, y: 0, width: screen_Width, height: 72*width))
private lazy var bottomView:MPPositive_BottomShowView = .init(frame: .init(x: 0, y: 0, width: 351, height: 82)) private lazy var bottomView:MPPositive_BottomShowView = .init(frame: .init(x: 0, y: 0, width: 351, height: 82))
@ -62,6 +63,13 @@ class MPPositive_TabBarController: UITabBarController, UIViewControllerTransitio
addNotification() addNotification()
// //
updateVersionEvent() updateVersionEvent()
//线
guard MP_NetWorkManager.shared.netWorkStatu != .reachable else {
return
}
//线
selectedIndex = 2
} }
// //
private func addNotification() { private func addNotification() {
@ -129,18 +137,32 @@ extension MPPositive_TabBarController {
self?.present(playerVC, animated: true) self?.present(playerVC, animated: true)
} }
} }
MP_AdMobManager.shared.showPlayInterstitialAdIfAvailable { [weak self] ad in MP_ADSimpleManager.shared.showPlayInterstitialAdIfAvailable { [weak self] (ad, platform) in
guard let self = self else {return} guard let self = self else {return}
if let ad = ad { if platform {
// if let ad = ad as? MAInterstitialAd {
MP_AdMobManager.shared.isShowingPlayInterstitialAd = true //
//广 MP_AppLovinManager.shared.setInterstitialSwitch(true)
MP_AdMobManager.shared.setInterstitialSwitch(true) MP_AppLovinManager.shared.isShowingPlayInterstitialAd = true
ad.fullScreenContentDelegate = self ad.delegate = self
ad.present(fromRootViewController: self) ad.show()
}else {
if let block = self.pushPlayerBlock {
block()
}
}
}else { }else {
if let block = self.pushPlayerBlock { if let ad = ad as? GADInterstitialAd {
block() //
MP_AdMobManager.shared.isShowingPlayInterstitialAd = true
//广
MP_AdMobManager.shared.setInterstitialSwitch(true)
ad.fullScreenContentDelegate = self
ad.present(fromRootViewController: self)
}else {
if let block = self.pushPlayerBlock {
block()
}
} }
} }
} }
@ -236,18 +258,58 @@ extension MPPositive_TabBarController {
if MP_AdMobManager.shared.completePlayInterstitialAdBlock != nil { if MP_AdMobManager.shared.completePlayInterstitialAdBlock != nil {
MP_AdMobManager.shared.completePlayInterstitialAdBlock!() MP_AdMobManager.shared.completePlayInterstitialAdBlock!()
} }
// //
// DispatchQueue.main.async {
// [weak self] in
// let playerVC = MPPositive_PlayerViewController()
// playerVC.modalPresentationStyle = .fullScreen
// playerVC.recommendBlock = {
// let recommendVC = MPPositive_RecommendViewController(MP_PlayerManager.shared.loadPlayer.currentVideo.song.relatedID)
// self?.viewControllers![self?.selectedIndex ?? 0].children[0].navigationController?.pushViewController(recommendVC, animated: false)
// }
// self?.present(playerVC, animated: true)
// }
} }
} }
//MARK: - AppLovin
func didLoad(_ ad: MAAd) {
}
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
}
func didDisplay(_ ad: MAAd) {
if ad.adUnitIdentifier == MP_AppLovinManager.shared.playInterstitialAd?.adUnitIdentifier {
print("当前展示的广告是播放插页广告广告ID--\(ad.adUnitIdentifier)")
MP_AnalyticsManager.shared.max_play_showSuccessAction()
}
}
func didHide(_ ad: MAAd) {
MP_AppLovinManager.shared.interstitialDate = Date()
if ad.adUnitIdentifier == MP_AppLovinManager.shared.playInterstitialAd?.adUnitIdentifier {
print("当前消失的广告是播放插页广告广告ID--\(ad.adUnitIdentifier)")
//广
if MP_AppLovinManager.shared.completePlayInterstitialAdBlock != nil {
MP_AppLovinManager.shared.completePlayInterstitialAdBlock!()
}
if let block = self.pushPlayerBlock {
block()
}
}
}
func didClick(_ ad: MAAd) {
}
func didFail(toDisplay ad: MAAd, withError error: MAError) {
MP_AppLovinManager.shared.interstitialDate = Date()
if ad.adUnitIdentifier == MP_AppLovinManager.shared.playInterstitialAd?.adUnitIdentifier {
print("播放插页广告展示时出错广告ID--\(ad.adUnitIdentifier)")
MP_AnalyticsManager.shared.max_play_showFailureAction(error.message)
//广
if MP_AppLovinManager.shared.completePlayInterstitialAdBlock != nil {
MP_AppLovinManager.shared.completePlayInterstitialAdBlock!()
}
if let block = self.pushPlayerBlock {
block()
}
}
}
} }

View File

@ -243,7 +243,7 @@ class MPPositive_LibraryViewController: MPPositive_BaseViewController, UIViewCon
let offlineVC = MPPositive_OfflineSongsViewController() let offlineVC = MPPositive_OfflineSongsViewController()
navigationController?.pushViewController(offlineVC, animated: true) navigationController?.pushViewController(offlineVC, animated: true)
} }
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
} }
} }
//MARK: - JXSegmentedTitleDataSource //MARK: - JXSegmentedTitleDataSource
@ -289,7 +289,7 @@ extension MPPositive_LibraryViewController:JXSegmentedListContainerViewDataSourc
// //
let playListVC = MPPositive_CustomPlayListViewController(item.playList) let playListVC = MPPositive_CustomPlayListViewController(item.playList)
navigationController?.pushViewController(playListVC, animated: true) navigationController?.pushViewController(playListVC, animated: true)
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
} }
return showView return showView
default:// default://

View File

@ -280,7 +280,11 @@ class MPPositive_HomeViewController: MPPositive_BaseViewController, UIViewContro
} }
// //
@objc private func footerRefreshContinuationData() { @objc private func footerRefreshContinuationData() {
guard MP_NetWorkManager.shared.continuationAndItct != nil else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
tableView.mj_footer?.endRefreshing()
return
}
guard (MP_NetWorkManager.shared.continuationAndItct != nil) || (MPPositive_BrowseLoadViewModel.shared.browseModuleLists.isEmpty == true) else {
tableView.mj_footer?.endRefreshing() tableView.mj_footer?.endRefreshing()
return return
} }
@ -588,7 +592,7 @@ extension MPPositive_HomeViewController: UITableViewDataSource, UITableViewDeleg
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("Home") MP_AnalyticsManager.shared.song_clickAction("Home")

View File

@ -249,7 +249,7 @@ class MPPositive_ListShowViewController: MPPositive_BaseViewController, UIViewCo
[weak self] in [weak self] in
guard let self = self, let item = listOrAlbum.items.first else {return} guard let self = self, let item = listOrAlbum.items.first else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("List") MP_AnalyticsManager.shared.song_clickAction("List")
@ -277,7 +277,7 @@ class MPPositive_ListShowViewController: MPPositive_BaseViewController, UIViewCo
[weak self] in [weak self] in
guard let self = self, let item = listOrAlbum.items.randomElement() else {return} guard let self = self, let item = listOrAlbum.items.randomElement() else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("List") MP_AnalyticsManager.shared.song_clickAction("List")
@ -396,7 +396,7 @@ extension MPPositive_ListShowViewController: UITableViewDataSource, UITableViewD
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("List") MP_AnalyticsManager.shared.song_clickAction("List")

View File

@ -139,7 +139,7 @@ extension MPPositive_MoreContentViewController: UICollectionViewDataSource, UICo
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("MoreContent") MP_AnalyticsManager.shared.song_clickAction("MoreContent")

View File

@ -154,6 +154,26 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
activityIndicator.color = .black activityIndicator.color = .black
return activityIndicator return activityIndicator
}() }()
//
private lazy var leadMaskView:UIView = {
let maskView = UIView(frame: .init(x: 0, y: 0, width: screen_Width, height: screen_Height))
maskView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(maskMissClick(_ :))))
maskView.isUserInteractionEnabled = true
maskView.backgroundColor = .init(hex: "#000000", alpha: 0.6)
return maskView
}()
//
private lazy var leadNoticeView:UIView = {
let noticeView:UIView = .init(frame: .init(x: 0, y: 0, width: 120*width, height: 43*width))
noticeView.backgroundColor = .clear
//
let noticeImageView = UIImageView(image: .init(named: "Click_Download'logo"))
noticeView.addSubview(noticeImageView)
noticeImageView.snp.makeConstraints { make in
make.left.top.right.bottom.equalToSuperview()
}
return noticeView
}()
//View(View) //View(View)
private lazy var coverView:MPPositive_PlayerCoverView = .init(frame: .init(x: 0, y: 0, width: screen_Width, height: 480*width)) private lazy var coverView:MPPositive_PlayerCoverView = .init(frame: .init(x: 0, y: 0, width: screen_Width, height: 480*width))
//View //View
@ -274,6 +294,12 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
// print("Layer") // print("Layer")
// MP_PlayerManager.shared.videoLayer.removeFromSuperlayer() // MP_PlayerManager.shared.videoLayer.removeFromSuperlayer()
} }
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
if leadMaskView.superview != nil {
setMaskLayer()
}
}
// //
private func configure() { private func configure() {
//View //View
@ -347,6 +373,11 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
make.height.equalTo(42*width) make.height.equalTo(42*width)
} }
maskNotReachableView.isHidden = (MP_NetWorkManager.shared.netWorkStatu == .reachable) maskNotReachableView.isHidden = (MP_NetWorkManager.shared.netWorkStatu == .reachable)
guard UserDefaults.standard.bool(forKey: "isFristPlayer") != true else {
return
}
UserDefaults.standard.set(true, forKey: "isFristPlayer")
view.addSubview(leadMaskView)
} }
//View //View
private func createSwitchActionView() -> UIView { private func createSwitchActionView() -> UIView {
@ -436,6 +467,30 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
} }
return bottomView return bottomView
} }
//
private func setMaskLayer() {
//
let maskLayer = CAShapeLayer()
//
let path = UIBezierPath(rect: leadMaskView.bounds)
// frame
let buttonFrame = self.coverView.downloadButton.convert(self.coverView.downloadButton.bounds, to: leadMaskView)
let circlePath = UIBezierPath(ovalIn: buttonFrame.insetBy(dx: -15, dy: -15)) //
// 使 `.byReversingPath()`
path.append(circlePath.reversing())
//
maskLayer.path = path.cgPath
//
leadMaskView.layer.mask = maskLayer
view.addSubview(leadNoticeView)
leadNoticeView.snp.makeConstraints { make in
make.right.equalTo(self.coverView.downloadButton.snp.centerX).offset(43.5*width)
make.centerY.equalTo(self.coverView.downloadButton.snp.centerY).offset(-60*width)
make.width.equalTo(180*width)
make.height.equalTo(64.5*width)
}
}
//MARK: - //MARK: -
private func uploadUI() { private func uploadUI() {
DispatchQueue.main.async { DispatchQueue.main.async {
@ -557,6 +612,13 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
@objc private func disMissClick(_ sender:UIButton) { @objc private func disMissClick(_ sender:UIButton) {
dismiss(animated: true) dismiss(animated: true)
} }
//
@objc private func maskMissClick(_ sender:UITapGestureRecognizer) {
view.endEditing(true)
sender.view?.removeFromSuperview()
leadNoticeView.removeFromSuperview()
}
//| //|
@objc private func switchActionClick(_ sender:UIButton) { @objc private func switchActionClick(_ sender:UIButton) {
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
@ -694,7 +756,7 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
} }
//广 //广
if MP_NetWorkManager.shared.netWorkStatu == .reachable { if MP_NetWorkManager.shared.netWorkStatu == .reachable {
MP_AdMobManager.shared.showPlayInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showPlayInterstitialAdIfAvailable(nil)
} }
MPPositive_Debouncer.shared.call { MPPositive_Debouncer.shared.call {
[weak self] in [weak self] in
@ -712,7 +774,7 @@ class MPPositive_PlayerViewController: MPPositive_BaseViewController, UIViewCont
} }
//广 //广
if MP_NetWorkManager.shared.netWorkStatu == .reachable { if MP_NetWorkManager.shared.netWorkStatu == .reachable {
MP_AdMobManager.shared.showPlayInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showPlayInterstitialAdIfAvailable(nil)
} }
MPPositive_Debouncer.shared.call { MPPositive_Debouncer.shared.call {
[weak self] in [weak self] in

View File

@ -144,7 +144,7 @@ extension MPPositive_GrideMoodViewController: UITableViewDataSource, UITableView
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("Mood") MP_AnalyticsManager.shared.song_clickAction("Mood")

View File

@ -125,7 +125,7 @@ extension MPPositive_SearchViewController: UICollectionViewDataSource, UICollect
MP_AnalyticsManager.shared.grid_mood_clickAction(item.title ?? "") MP_AnalyticsManager.shared.grid_mood_clickAction(item.title ?? "")
let moodVC = MPPositive_GrideMoodViewController(item.grid.browseId, params: item.grid.params, title: item.title ?? "") let moodVC = MPPositive_GrideMoodViewController(item.grid.browseId, params: item.grid.params, title: item.title ?? "")
navigationController?.pushViewController(moodVC, animated: false) navigationController?.pushViewController(moodVC, animated: false)
MP_AdMobManager.shared.showSearchInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showSearchInterstitialAdIfAvailable(completion: nil)
} }
} }
} }

View File

@ -61,8 +61,16 @@ class MPPositive_CustomTabBarView: UIView {
make.centerX.equalToSuperview().multipliedBy(0.45 + 0.55*Double(item.tag)) make.centerX.equalToSuperview().multipliedBy(0.45 + 0.55*Double(item.tag))
} }
} }
//item //线
tabBarItems[0].isSelected = true guard MP_NetWorkManager.shared.netWorkStatu != .reachable else {
//item
tabBarItems.first?.isSelected = true
selectedItemIndex = 0
return
}
//线
tabBarItems.last?.isSelected = true
selectedItemIndex = 2
} }
// //

View File

@ -249,7 +249,7 @@ class MPPositive_ArtistShowSongTableViewCell: UITableViewCell, PKDownloadButtonD
return return
} }
// //
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
// //
downloadButton.state = .pending downloadButton.state = .pending
//(Song) //(Song)
@ -277,6 +277,8 @@ class MPPositive_ArtistShowSongTableViewCell: UITableViewCell, PKDownloadButtonD
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in

View File

@ -278,7 +278,7 @@ extension MPPositive_ArtistShowTypeView:UITableViewDataSource, UITableViewDelega
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("Artist") MP_AnalyticsManager.shared.song_clickAction("Artist")

View File

@ -18,14 +18,19 @@ class MPPositive_HomeLibraryListCollectionViewCell: UICollectionViewCell {
}() }()
//Label //Label
private lazy var titleLabel:UILabel = createLabel("Title", font: .systemFont(ofSize: 14*width, weight: .regular), textColor: .white, textAlignment: .left) private lazy var titleLabel:UILabel = createLabel("Title", font: .systemFont(ofSize: 14*width, weight: .regular), textColor: .white, textAlignment: .left)
//Label
private lazy var countsLabel:UILabel = createLabel("0", font: .systemFont(ofSize: 25*width, weight: .bold), textColor: .white, textAlignment: .left)
var library:MPPositive_LibraryViewModel!{ var library:MPPositive_LibraryViewModel!{
didSet{ didSet{
switch library.library.libraryType { switch library.library.libraryType {
case .custom_playlist: case .custom_playlist:
coverImageView.kf.setImage(with: library.cover, placeholder: library.library.libraryType.image) coverImageView.kf.setImage(with: library.cover, placeholder: library.library.libraryType.image)
countsLabel.isHidden = true
default: default:
coverImageView.image = library.library.libraryType.image coverImageView.image = library.library.libraryType.image
countsLabel.isHidden = false
} }
countsLabel.text = "\(library.library.count)"
titleLabel.text = library.title titleLabel.text = library.title
} }
} }
@ -51,5 +56,11 @@ class MPPositive_HomeLibraryListCollectionViewCell: UICollectionViewCell {
make.top.equalTo(coverImageView.snp.bottom).offset(9*width) make.top.equalTo(coverImageView.snp.bottom).offset(9*width)
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
} }
addSubview(countsLabel)
countsLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(8*width)
make.right.equalToSuperview().offset(-8*width)
make.top.equalToSuperview().offset(8*width)
}
} }
} }

View File

@ -121,6 +121,6 @@ extension MPPositive_HomeLibraryListstableViewCell:UICollectionViewDataSource, U
} }
} }
} }
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
} }
} }

View File

@ -240,7 +240,7 @@ class MPPositive_HomeSingleCollectionViewCell: UICollectionViewCell, PKDownloadB
guard let videoId = itemViewModel.browseItem.videoId else { guard let videoId = itemViewModel.browseItem.videoId else {
return return
} }
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
// //
downloadButton.state = .pending downloadButton.state = .pending
//(Song) //(Song)
@ -268,6 +268,8 @@ class MPPositive_HomeSingleCollectionViewCell: UICollectionViewCell, PKDownloadB
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in

View File

@ -167,7 +167,7 @@ extension MPPositive_HomeSinglesTableViewCell:UICollectionViewDataSource, UIColl
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
guard let item = (self.browseViewModel?.items[indexPath.row] ?? self.personlViewModel?.items[indexPath.row]) else { guard let item = (self.browseViewModel?.items[indexPath.row] ?? self.personlViewModel?.items[indexPath.row]) else {

View File

@ -273,7 +273,7 @@ class MPPositive_MusicItemShowTableViewCell: UITableViewCell, PKDownloadButtonDe
guard let videoId = itemView.browseItem.videoId else { guard let videoId = itemView.browseItem.videoId else {
return return
} }
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
// //
downloadButton.state = .pending downloadButton.state = .pending
//(Song) //(Song)
@ -301,6 +301,8 @@ class MPPositive_MusicItemShowTableViewCell: UITableViewCell, PKDownloadButtonDe
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in

View File

@ -197,7 +197,7 @@ class MPPositive_PersonalisedRecommendationsTableViewCell: UITableViewCell, UIVi
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.home_b_module_clickAction(titleLabel.text ?? "") MP_AnalyticsManager.shared.home_b_module_clickAction(titleLabel.text ?? "")
@ -328,7 +328,7 @@ extension MPPositive_PersonalisedRecommendationsTableViewCell:UICollectionViewDa
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.home_b_module_clickAction(item.browseItem.pageType ?? "") MP_AnalyticsManager.shared.home_b_module_clickAction(item.browseItem.pageType ?? "")

View File

@ -347,7 +347,7 @@ class MPPositive_PlayerCoverView: UIView, PKDownloadButtonDelegate {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil)
return return
} }
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
// //
downloadButton.state = .pending downloadButton.state = .pending
// //

View File

@ -94,7 +94,7 @@ class MPPositive_SearchResultPreviewShowView: MPPositive_BaseShowView, JXSegment
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("Search") MP_AnalyticsManager.shared.song_clickAction("Search")

View File

@ -314,7 +314,7 @@ class MPPositive_SearchResultShowTableViewCell: UITableViewCell, PKDownloadButto
return return
} }
// //
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
// //
downloadButton.state = .pending downloadButton.state = .pending
//(Song) //(Song)
@ -342,6 +342,8 @@ class MPPositive_SearchResultShowTableViewCell: UITableViewCell, PKDownloadButto
} }
first.coverUrls = coverUrls first.coverUrls = coverUrls
group.leave() group.leave()
} failure: {_ in
group.leave()
} }
group.notify(queue: .main, execute: { group.notify(queue: .main, execute: {
[weak self] in [weak self] in

View File

@ -123,7 +123,7 @@ class MPPositive_SearchResultTypeShowView: MPPositive_BaseShowView, JXSegmentedL
[weak self] in [weak self] in
guard let self = self else {return} guard let self = self else {return}
guard MP_NetWorkManager.shared.netWorkStatu == .reachable else { guard MP_NetWorkManager.shared.netWorkStatu == .reachable else {
MP_HUD.text("Bad connection~".localizableString(), delay: 2.0, completion: nil) playOfflineSongs()
return return
} }
MP_AnalyticsManager.shared.song_clickAction("Search") MP_AnalyticsManager.shared.song_clickAction("Search")

View File

@ -6,7 +6,7 @@
// //
import UIKit import UIKit
import AppLovinSDK
class MPPositive_SearchResultsShowView: UIView { class MPPositive_SearchResultsShowView: UIView {
/// ///
var loadModel:MPPositive_SearchResultsLoadViewModel!{ var loadModel:MPPositive_SearchResultsLoadViewModel!{
@ -18,17 +18,32 @@ class MPPositive_SearchResultsShowView: UIView {
emptyImageView.isHidden = false emptyImageView.isHidden = false
}else { }else {
if isShowAd == true { if isShowAd == true {
MP_AdMobManager.shared.showSearchInterstitialAdIfAvailable { [weak self] ad in MP_ADSimpleManager.shared.showSearchInterstitialAdIfAvailable { [weak self] ad, platform in
guard let self = self else {return} guard let self = self else {return}
// //
if loadModel?.sectionLists?.count != nil { if loadModel?.sectionLists?.count != nil {
// if platform {
MP_AdMobManager.shared.setInterstitialSwitch(false) MP_AppLovinManager.shared.setInterstitialSwitch(false)
}else {
//
MP_AdMobManager.shared.setInterstitialSwitch(false)
}
}else { }else {
MP_AdMobManager.shared.isShowingSearchInterstitialAd = true if platform {
// if let new = ad as? MAInterstitialAd {
MP_AdMobManager.shared.setInterstitialSwitch(true) MP_AppLovinManager.shared.isShowingSearchInterstitialAd = true
ad.present(fromRootViewController: nil) //
MP_AppLovinManager.shared.setInterstitialSwitch(true)
new.show()
}
}else {
if let new = ad as? GADInterstitialAd {
MP_AdMobManager.shared.isShowingSearchInterstitialAd = true
//
MP_AdMobManager.shared.setInterstitialSwitch(true)
new.present(fromRootViewController: nil)
}
}
} }
} }
} }

View File

@ -6,8 +6,9 @@
// //
import UIKit import UIKit
import AppLovinSDK
///A ///A
class MPSideA_TabBarController: UITabBarController, GADFullScreenContentDelegate { class MPSideA_TabBarController: UITabBarController, GADFullScreenContentDelegate, MAAdDelegate {
//tabBar //tabBar
private lazy var customTabBar:MPSideA_CustomTabBar = .init(frame: .init(x: 0, y: 0, width: screen_Width, height: 72*width)) private lazy var customTabBar:MPSideA_CustomTabBar = .init(frame: .init(x: 0, y: 0, width: screen_Width, height: 72*width))
//View //View
@ -169,21 +170,6 @@ extension MPSideA_TabBarController: UIViewControllerTransitioningDelegate {
// //
private func pushPlayer() { private func pushPlayer() {
print("Go to player") print("Go to player")
MP_AdMobManager.shared.showPlayInterstitialAdIfAvailable { [weak self] ad in
guard let self = self else {return}
if let ad = ad {
//
MP_AdMobManager.shared.isShowingPlayInterstitialAd = true
//广
MP_AdMobManager.shared.setInterstitialSwitch(true)
ad.fullScreenContentDelegate = self
ad.present(fromRootViewController: self)
}else {
if let block = self.pushPlayerBlock {
block()
}
}
}
self.pushPlayerBlock = { self.pushPlayerBlock = {
[weak self] in [weak self] in
// //
@ -194,6 +180,35 @@ extension MPSideA_TabBarController: UIViewControllerTransitioningDelegate {
self?.present(playerVC, animated: true) self?.present(playerVC, animated: true)
} }
} }
MP_ADSimpleManager.shared.showPlayInterstitialAdIfAvailable { [weak self] (ad, platform) in
guard let self = self else {return}
if platform {
if let ad = ad as? MAInterstitialAd {
//
MP_AppLovinManager.shared.setInterstitialSwitch(true)
MP_AppLovinManager.shared.isShowingPlayInterstitialAd = true
ad.delegate = self
ad.show()
}else {
if let block = self.pushPlayerBlock {
block()
}
}
}else {
if let ad = ad as? GADInterstitialAd {
//
MP_AdMobManager.shared.isShowingPlayInterstitialAd = true
//广
MP_AdMobManager.shared.setInterstitialSwitch(true)
ad.fullScreenContentDelegate = self
ad.present(fromRootViewController: self)
}else {
if let block = self.pushPlayerBlock {
block()
}
}
}
}
} }
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? { func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
return MPSideA_PresentationController(presentedViewController: presented, presenting: presenting) return MPSideA_PresentationController(presentedViewController: presented, presenting: presenting)
@ -325,18 +340,60 @@ extension MPSideA_TabBarController {
print("播放插页广告展示时出错广告ID--\(UUID),具体错误原因:\(error.localizedDescription)") print("播放插页广告展示时出错广告ID--\(UUID),具体错误原因:\(error.localizedDescription)")
MP_AnalyticsManager.shared.play_ads_showFailureAction(error.localizedDescription) MP_AnalyticsManager.shared.play_ads_showFailureAction(error.localizedDescription)
//广 //广
//广
if MP_AdMobManager.shared.completePlayInterstitialAdBlock != nil { if MP_AdMobManager.shared.completePlayInterstitialAdBlock != nil {
MP_AdMobManager.shared.completePlayInterstitialAdBlock!() MP_AdMobManager.shared.completePlayInterstitialAdBlock!()
} }
//
// DispatchQueue.main.async {
// [weak self] in
// //
// let playerVC = MPSideA_PlayerViewController()
// self?.present(playerVC, animated: true)
// }
} }
} }
//MARK: - AppLovin
func didLoad(_ ad: MAAd) {
}
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
}
func didDisplay(_ ad: MAAd) {
if ad.adUnitIdentifier == MP_AppLovinManager.shared.playInterstitialAd?.adUnitIdentifier {
print("当前展示的广告是播放插页广告广告ID--\(ad.adUnitIdentifier)")
MP_AnalyticsManager.shared.max_play_showSuccessAction()
}
}
func didHide(_ ad: MAAd) {
MP_AppLovinManager.shared.interstitialDate = Date()
if ad.adUnitIdentifier == MP_AppLovinManager.shared.playInterstitialAd?.adUnitIdentifier {
print("当前消失的广告是播放插页广告广告ID--\(ad.adUnitIdentifier)")
//广
if MP_AppLovinManager.shared.completePlayInterstitialAdBlock != nil {
MP_AppLovinManager.shared.completePlayInterstitialAdBlock!()
}
if let block = self.pushPlayerBlock {
block()
}
}
}
func didClick(_ ad: MAAd) {
}
func didFail(toDisplay ad: MAAd, withError error: MAError) {
MP_AppLovinManager.shared.interstitialDate = Date()
if ad.adUnitIdentifier == MP_AppLovinManager.shared.playInterstitialAd?.adUnitIdentifier {
print("播放插页广告展示时出错广告ID--\(ad.adUnitIdentifier)")
MP_AnalyticsManager.shared.max_play_showFailureAction(error.message)
//广
if MP_AppLovinManager.shared.completePlayInterstitialAdBlock != nil {
MP_AppLovinManager.shared.completePlayInterstitialAdBlock!()
}
if let block = self.pushPlayerBlock {
block()
}
}
}
} }

View File

@ -115,7 +115,7 @@ class MPSideA_CenterViewController: MPSideA_BaseViewController {
[weak self] in [weak self] in
DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.3) { DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.3) {
[weak self] in [weak self] in
MP_AdMobManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showLibraryInterstitialAdIfAvailable(completion: nil)
} }
} }
navigationController?.pushViewController(setVC, animated: true) navigationController?.pushViewController(setVC, animated: true)

View File

@ -254,7 +254,7 @@ extension MPSideA_PlayerViewController {
// //
MPSideA_MediaCenterManager.shared.stopMonitor() MPSideA_MediaCenterManager.shared.stopMonitor()
//广 //广
MP_AdMobManager.shared.showPlayInterstitialAdIfAvailable(completion: nil) MP_ADSimpleManager.shared.showPlayInterstitialAdIfAvailable(nil)
guard let music = MPSideA_MediaCenterManager.shared.getMusic() else { guard let music = MPSideA_MediaCenterManager.shared.getMusic() else {
// //
print("No Data Music") print("No Data Music")