Browse Source

【代码优化】新增免责声明

master
公司电脑 1 year ago
parent
commit
b99155eb13
  1. 8
      FireBoltt.xcodeproj/project.pbxproj
  2. BIN
      FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate
  3. 16
      FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  4. 43
      FireBoltt/Application/AppDelegate.swift
  5. 5
      FireBoltt/Const/MultiLanguageKey.swift
  6. 64
      FireBoltt/FB_Modules/FB_Device/Service/BluetoothService.swift
  7. 3
      FireBoltt/FB_Modules/FB_My/Controller/AboutVC.swift
  8. 8
      FireBoltt/FB_Modules/FB_My/Controller/MineViewController.swift
  9. 9
      FireBoltt/FB_Modules/FB_My/Controller/commWebViewController.m
  10. 4
      FireBoltt/FB_Modules/FB_My/ViewModel/MineViewModel.swift
  11. 5
      FireBoltt/FireBoltt.entitlements
  12. 1
      FireBoltt/Resource/Info.plist
  13. 2
      FireBoltt/Resource/en.lproj/Localizable.strings
  14. 1
      FireBoltt/Resource/nl.lproj/Localizable.strings
  15. 1
      FireBoltt/Resource/ru.lproj/Localizable.strings
  16. 1
      FireBoltt/Resource/zh-Hans.lproj/Localizable.strings
  17. 40
      R.generated.swift

8
FireBoltt.xcodeproj/project.pbxproj

@ -678,6 +678,7 @@ @@ -678,6 +678,7 @@
61DF3C522AB1460300E69AE9 /* UIColor+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Extension.m"; sourceTree = "<group>"; };
61DF3C532AB1460300E69AE9 /* XFGradientProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XFGradientProgressView.m; sourceTree = "<group>"; };
61DF3C562AB1A5EA00E69AE9 /* DeviceFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceFooterView.swift; sourceTree = "<group>"; };
61DF3C582AB555F400E69AE9 /* FireBoltt.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FireBoltt.entitlements; sourceTree = "<group>"; };
716B2A812AA8CA41006F17EB /* FireBoltt-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FireBoltt-Bridging-Header.h"; sourceTree = "<group>"; };
716B2A992AA8D264006F17EB /* BlueToothItemFireBoltt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BlueToothItemFireBoltt.m; sourceTree = "<group>"; };
716B2A9A2AA8D264006F17EB /* BluetoothToolFireBoltt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BluetoothToolFireBoltt.h; sourceTree = "<group>"; };
@ -1533,6 +1534,7 @@ @@ -1533,6 +1534,7 @@
CC97218A240B67E90075F8AA /* FireBoltt */ = {
isa = PBXGroup;
children = (
61DF3C582AB555F400E69AE9 /* FireBoltt.entitlements */,
61BFD4E32AA180E4002390B3 /* MobileModule */,
CC560D06242665AD00578115 /* Tool */,
CCE8FFE22413548500E5E23D /* Managers */,
@ -2530,6 +2532,7 @@ @@ -2530,6 +2532,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = FireBoltt/FireBoltt.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
@ -2555,7 +2558,7 @@ @@ -2555,7 +2558,7 @@
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.0.0;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.ecell.www.fireboltts;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -2574,6 +2577,7 @@ @@ -2574,6 +2577,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = FireBoltt/FireBoltt.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
@ -2599,7 +2603,7 @@ @@ -2599,7 +2603,7 @@
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
MARKETING_VERSION = 1.1.1;
MARKETING_VERSION = 1.0.0;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.ecell.www.fireboltts;
PRODUCT_NAME = "$(TARGET_NAME)";

BIN
FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/UserInterfaceState.xcuserstate generated

Binary file not shown.

16
FireBoltt.xcworkspace/xcuserdata/ecell.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@ -127,5 +127,21 @@ @@ -127,5 +127,21 @@
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "98E8661C-A7F4-489F-97C5-6D3E7D20EC67"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FireBoltt/Application/AppDelegate.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "119"
endingLineNumber = "119"
landmarkName = "userNotificationCenter(_:willPresent:withCompletionHandler:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

43
FireBoltt/Application/AppDelegate.swift

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
//
import UIKit
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
@ -18,6 +19,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD @@ -18,6 +19,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
let screen = UIScreen.main.bounds
window = UIWindow(frame: screen)
Application.shared.presentInitialScreen(in: window!)
///
// regisigerNotification(application)
JL_Tools.openLogTextFile()
// //
// Bluetooth.shareInstance()
@ -78,12 +82,47 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD @@ -78,12 +82,47 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
backTask = .invalid
}
}
func regisigerNotification(_ application: UIApplication){
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in
if !success {
NSLog("本地通知未打开,请授权APP使用您的本地通知")
}
}
if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted: Bool, error: Error?) in
DispatchQueue.main.async {
if granted { application.registerForRemoteNotifications() }
}
}
} else {
let settings = UIUserNotificationSettings(types: [.alert, .sound, .badge], categories: nil)
application.registerForRemoteNotifications()
application.registerUserNotificationSettings(settings)
}
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
NSLog("通知注册完毕")
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
NSLog("通知注册失败error:\(error)")
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler(UNNotificationPresentationOptions.alert)
}
}
extension AppDelegate {

5
FireBoltt/Const/MultiLanguageKey.swift

@ -111,8 +111,9 @@ struct MultiLanguageKey_FB { @@ -111,8 +111,9 @@ struct MultiLanguageKey_FB {
static let photoFB = "照片"
static let unitSetFB = "单位设置"
static let targetSetFB = "目标设置"
static let privacyFB = "隐私政策"
static let serviceFB = "用户协议"
static let privacyFB = "隐私政策"
static let serviceFB = "用户协议"
static let disclaimerFB = "免责声明"
static let aboutFB = "关于"
static let stepTipFB = ""
static let sleepFB = "睡眠"

64
FireBoltt/FB_Modules/FB_Device/Service/BluetoothService.swift

@ -465,7 +465,7 @@ extension BluetoothService { @@ -465,7 +465,7 @@ extension BluetoothService {
//
try? audioSession.setActive(true)
//
if let path = Bundle.main.path(forResource: "music", ofType: "m4r") {
if let path = Bundle.main.path(forResource: "fbs_music", ofType: "m4r") {
AudioServicesCreateSystemSoundID(URL(fileURLWithPath: path) as CFURL, &systemSoundID)
}
//
@ -520,37 +520,37 @@ extension BluetoothService { @@ -520,37 +520,37 @@ extension BluetoothService {
}
// MARK: -
func localNotification(title: String, body: String, dateComponents: DateComponents? = nil, userInfo : [AnyHashable : Any]? = nil) {
if #available(iOS 10, *) {
let content = UNMutableNotificationContent()
content.title = title
content.body = body
content.userInfo = userInfo ?? [:]
var trigger: UNNotificationTrigger?
if let dataCompontnts = dateComponents {
trigger = UNCalendarNotificationTrigger(dateMatching: dataCompontnts, repeats: false)
}
let random = Int(arc4random_uniform(999999999))
let request = UNNotificationRequest(identifier: "id\(random)", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: { error in
print(error ?? "error:nil")
})
} else {
let localNotification = UILocalNotification()
localNotification.fireDate = dateComponents?.date ?? Date()
localNotification.alertBody = body
localNotification.alertTitle = title
localNotification.userInfo = userInfo
localNotification.timeZone = NSTimeZone.default
localNotification.soundName = UILocalNotificationDefaultSoundName
UIApplication.shared.scheduleLocalNotification(localNotification)
}
}
func localNotification(title: String, body: String, dateComponents: DateComponents? = nil, userInfo : [AnyHashable : Any]? = nil) {
if #available(iOS 10, *) {
let content = UNMutableNotificationContent()
content.title = title
content.body = body
content.userInfo = userInfo ?? [:]
var trigger: UNNotificationTrigger?
if let dataCompontnts = dateComponents {
trigger = UNCalendarNotificationTrigger(dateMatching: dataCompontnts, repeats: false)
}
let random = Int(arc4random_uniform(999999999))
let request = UNNotificationRequest(identifier: "id\(random)", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: { error in
print(error ?? "error:nil")
})
} else {
let localNotification = UILocalNotification()
localNotification.fireDate = dateComponents?.date ?? Date()
localNotification.alertBody = body
localNotification.alertTitle = title
localNotification.userInfo = userInfo
localNotification.timeZone = NSTimeZone.default
localNotification.soundName = UILocalNotificationDefaultSoundName
UIApplication.shared.scheduleLocalNotification(localNotification)
}
}
}

3
FireBoltt/FB_Modules/FB_My/Controller/AboutVC.swift

@ -21,7 +21,8 @@ class AboutVC: ViewController { @@ -21,7 +21,8 @@ class AboutVC: ViewController {
constrain.constant = kScaleWidth(constrain.constant)
}
}
aboutLabel.text = "Version \(kAppCurrentVersion ?? "").\(kAppBuildVersion ?? "")"
// aboutLabel.text = "Version \(kAppCurrentVersion ?? "").\(kAppBuildVersion ?? "")"
aboutLabel.text = "Version \(kAppCurrentVersion ?? "")"
}
}

8
FireBoltt/FB_Modules/FB_My/Controller/MineViewController.swift

@ -116,6 +116,14 @@ class MineViewController: TableViewController { @@ -116,6 +116,14 @@ class MineViewController: TableViewController {
vc.url = "http://wx.ecellsz.com/mp/appAgreement.html"
vc.hidesBottomBarWhenPushed = true;
self?.navigationController!.pushViewController(vc, animated: true)
case .disclaimerFB:
print("免责声明")
let vc = commWebViewController()
vc.view.backgroundColor = UIColor.white;
vc.navTitle = MultiLanguageKey_FB.disclaimerFB.localized
vc.url = MultiLanguageKey_FB.disclaimerFB.localized
vc.hidesBottomBarWhenPushed = true;
self?.navigationController!.pushViewController(vc, animated: true)
}
})
.disposed(by: rx.disposeBag)

9
FireBoltt/FB_Modules/FB_My/Controller/commWebViewController.m

File diff suppressed because one or more lines are too long

4
FireBoltt/FB_Modules/FB_My/ViewModel/MineViewModel.swift

@ -32,7 +32,7 @@ class MineViewModel: ViewModel { @@ -32,7 +32,7 @@ class MineViewModel: ViewModel {
func loadMeList() {
//
var meList: [[MineSetType]] = [[], [.about,.privacy,.service]]
var meList: [[MineSetType]] = [[], [.about,.privacy,.service,.disclaimerFB]]
//
if let adapterInfo = UserDefaultsManagerFrieBoltt.getDeviceInfo()?.adapterInfo {
if adapterInfo.unitSet { meList[0].append(.unitSet) }
@ -78,6 +78,7 @@ enum MineSetType: String { @@ -78,6 +78,7 @@ enum MineSetType: String {
case about = "关于"
case privacy = "隐私政策"
case service = "用户协议"
case disclaimerFB = "免责声明"
var title: String {
switch self {
@ -86,6 +87,7 @@ enum MineSetType: String { @@ -86,6 +87,7 @@ enum MineSetType: String {
case .about: return MultiLanguageKey_FB.aboutFB.localized
case .privacy: return MultiLanguageKey_FB.privacyFB.localized
case .service: return MultiLanguageKey_FB.serviceFB.localized
case .disclaimerFB: return MultiLanguageKey_FB.disclaimerFB.localized
}
}
}

5
FireBoltt/FireBoltt.entitlements

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>

1
FireBoltt/Resource/Info.plist

@ -47,6 +47,7 @@ @@ -47,6 +47,7 @@
<string>开启后,FireBoltt才能获取相册的照片</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
</array>

2
FireBoltt/Resource/en.lproj/Localizable.strings

@ -254,4 +254,6 @@ @@ -254,4 +254,6 @@
"隐私政策" = "Privacy policy";
"用户协议" = "User protocol";
"清醒时长" = "awakeDuration";
"寻找手机指令" = "Find phone command";
"免责声明" = "disclaimer";

1
FireBoltt/Resource/nl.lproj/Localizable.strings

@ -245,3 +245,4 @@ @@ -245,3 +245,4 @@
//"支付宝" = "bedrag";
"隐私政策" = "privacybeleid";
"用户协议" = "gebruikersovereenkomst";
"寻找手机指令" = "Instructies voor mobiele telefoons zoeken";

1
FireBoltt/Resource/ru.lproj/Localizable.strings

@ -225,3 +225,4 @@ @@ -225,3 +225,4 @@
//"支付宝" = "Плати";
"隐私政策" = "Политика конфиденциальности";
"用户协议" = "Протокол пользователя";
"寻找手机指令" = "Поиск телефона.";

1
FireBoltt/Resource/zh-Hans.lproj/Localizable.strings

@ -255,3 +255,4 @@ @@ -255,3 +255,4 @@
"隐私政策" = "隐私政策";
"用户协议" = "用户协议";
"清醒时长" = "清醒时长";
"寻找手机指令" = "寻找手机指令";

40
R.generated.swift

@ -2002,7 +2002,7 @@ struct R: Rswift.Validatable { @@ -2002,7 +2002,7 @@ struct R: Rswift.Validatable {
fileprivate init() {}
}
/// This `R.string.localizable` struct is generated, and contains static references to 244 localization keys.
/// This `R.string.localizable` struct is generated, and contains static references to 246 localization keys.
struct localizable {
/// en translation: Synchronizing Succeed
///
@ -2232,6 +2232,10 @@ struct R: Rswift.Validatable { @@ -2232,6 +2232,10 @@ struct R: Rswift.Validatable {
///
/// Locales: en, zh-Hans, nl, ru, fr, de, pt-PT, es, tr, pl, ar, ms, th, ja, ko, zh-HK, zh-Hant
static let = Rswift.StringResource(key: "找设备", tableName: "Localizable", bundle: R.hostingBundle, locales: ["en", "zh-Hans", "nl", "ru", "fr", "de", "pt-PT", "es", "tr", "pl", "ar", "ms", "th", "ja", "ko", "zh-HK", "zh-Hant"], comment: nil)
/// en translation: Find phone command
///
/// Locales: en, zh-Hans, nl, ru, zh-HK, zh-Hant
static let = Rswift.StringResource(key: "寻找手机指令", tableName: "Localizable", bundle: R.hostingBundle, locales: ["en", "zh-Hans", "nl", "ru", "zh-HK", "zh-Hant"], comment: nil)
/// en translation: Firmware Upgrade
///
/// Locales: en, zh-Hans, nl, ru, fr, de, pt-PT, es, tr, pl, ar, ms, th, ja, ko, zh-HK, zh-Hant
@ -2844,6 +2848,10 @@ struct R: Rswift.Validatable { @@ -2844,6 +2848,10 @@ struct R: Rswift.Validatable {
///
/// Locales: en, zh-Hans, nl, ru, fr, de, pt-PT, es, tr, pl, ar, ms, th, ja, ko, zh-HK, zh-Hant
static let = Rswift.StringResource(key: "", tableName: "Localizable", bundle: R.hostingBundle, locales: ["en", "zh-Hans", "nl", "ru", "fr", "de", "pt-PT", "es", "tr", "pl", "ar", "ms", "th", "ja", "ko", "zh-HK", "zh-Hant"], comment: nil)
/// en translation: disclaimer
///
/// Locales: en
static let = Rswift.StringResource(key: "免责声明", tableName: "Localizable", bundle: R.hostingBundle, locales: ["en"], comment: nil)
/// en translation: distance
///
/// Locales: en, zh-Hans, nl, ru, fr, de, pt-PT, es, tr, pl, ar, ms, th, ja, ko, zh-HK, zh-Hant
@ -3836,6 +3844,21 @@ struct R: Rswift.Validatable { @@ -3836,6 +3844,21 @@ struct R: Rswift.Validatable {
return NSLocalizedString("找设备", bundle: bundle, comment: "")
}
/// en translation: Find phone command
///
/// Locales: en, zh-Hans, nl, ru, zh-HK, zh-Hant
static func (preferredLanguages: [String]? = nil) -> String {
guard let preferredLanguages = preferredLanguages else {
return NSLocalizedString("寻找手机指令", bundle: hostingBundle, comment: "")
}
guard let (_, bundle) = localeBundle(tableName: "Localizable", preferredLanguages: preferredLanguages) else {
return "寻找手机指令"
}
return NSLocalizedString("寻找手机指令", bundle: bundle, comment: "")
}
/// en translation: Firmware Upgrade
///
/// Locales: en, zh-Hans, nl, ru, fr, de, pt-PT, es, tr, pl, ar, ms, th, ja, ko, zh-HK, zh-Hant
@ -6131,6 +6154,21 @@ struct R: Rswift.Validatable { @@ -6131,6 +6154,21 @@ struct R: Rswift.Validatable {
return NSLocalizedString("", bundle: bundle, comment: "")
}
/// en translation: disclaimer
///
/// Locales: en
static func (preferredLanguages: [String]? = nil) -> String {
guard let preferredLanguages = preferredLanguages else {
return NSLocalizedString("免责声明", bundle: hostingBundle, comment: "")
}
guard let (_, bundle) = localeBundle(tableName: "Localizable", preferredLanguages: preferredLanguages) else {
return "免责声明"
}
return NSLocalizedString("免责声明", bundle: bundle, comment: "")
}
/// en translation: distance
///
/// Locales: en, zh-Hans, nl, ru, fr, de, pt-PT, es, tr, pl, ar, ms, th, ja, ko, zh-HK, zh-Hant

Loading…
Cancel
Save