@ -220,7 +220,7 @@ class QRCodeParser {
// 默 认 为 文 本 类 型
// 默 认 为 文 本 类 型
return ParsedQRData (
return ParsedQRData (
type : . text ,
type : . text ,
title : NSLocalizedString ( " text_information " , comment : " Text information " ) ,
title : " text_information " .localized ,
subtitle : trimmedContent . count > 50 ? String ( trimmedContent . prefix ( 50 ) ) + " ... " : trimmedContent ,
subtitle : trimmedContent . count > 50 ? String ( trimmedContent . prefix ( 50 ) ) + " ... " : trimmedContent ,
icon : " text.quote "
icon : " text.quote "
)
)
@ -245,8 +245,8 @@ class QRCodeParser {
}
}
}
}
let title = NSLocalizedString ( " wifi_network " , comment : " Wi-Fi network " )
let title = " wifi_network " . localized
let subtitle = String ( format : NSLocalizedString ( " wifi_network_info " , comment : " Wi-Fi network information " ) , ssid , encryption , password . isEmpty ? NSLocalizedString ( " not_set " , comment : " Not set " ) : NSLocalizedString ( " password_set " , comment : " Password set " ) )
let subtitle = String ( format : " wifi_network_info " .localized , ssid , encryption , password . isEmpty ? " not_set " . localized : " password_set " . localized )
return ParsedQRData (
return ParsedQRData (
type : . wifi ,
type : . wifi ,
@ -262,7 +262,7 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . mail ,
type : . mail ,
title : NSLocalizedString ( " email_address " , comment : " Email address " ) ,
title : " email_address " . localized ,
subtitle : email ,
subtitle : email ,
icon : " envelope "
icon : " envelope "
)
)
@ -274,7 +274,7 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . phone ,
type : . phone ,
title : NSLocalizedString ( " phone_number " , comment : " Phone number " ) ,
title : " phone_number " . localized ,
subtitle : phone ,
subtitle : phone ,
icon : " phone "
icon : " phone "
)
)
@ -288,8 +288,8 @@ class QRCodeParser {
let phone = components . first ? ? " "
let phone = components . first ? ? " "
let message = components . count > 1 ? components [ 1 ] : " "
let message = components . count > 1 ? components [ 1 ] : " "
let title = NSLocalizedString ( " sms " , comment : " SMS " )
let title = " sms " . localized
let subtitle = String ( format : NSLocalizedString ( " sms_number_content " , comment : " SMS number and content " ) , phone , message )
let subtitle = String ( format : " sms_number_content " .localized , phone , message )
return ParsedQRData (
return ParsedQRData (
type : . sms ,
type : . sms ,
@ -350,13 +350,13 @@ class QRCodeParser {
}
}
var subtitle = " "
var subtitle = " "
if ! name . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_name " , comment : " Contact name " ) , name ) + " \n " }
if ! name . isEmpty { subtitle += String ( format : " contact_name " . localized , name ) + " \n " }
if ! phone . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_phone " , comment : " Contact phone " ) , phone ) + " \n " }
if ! phone . isEmpty { subtitle += String ( format : " contact_phone " . localized , phone ) + " \n " }
if ! email . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_email " , comment : " Contact email " ) , email ) + " \n " }
if ! email . isEmpty { subtitle += String ( format : " contact_email " . localized , email ) + " \n " }
if ! company . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_company " , comment : " Contact company " ) , company ) + " \n " }
if ! company . isEmpty { subtitle += String ( format : " contact_company " .localized , company ) + " \n " }
if ! title . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_title " , comment : " Contact title " ) , title ) + " \n " }
if ! title . isEmpty { subtitle += String ( format : " contact_title " . localized , title ) + " \n " }
if ! address . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_address " , comment : " Contact address " ) , address ) + " \n " }
if ! address . isEmpty { subtitle += String ( format : " contact_address " .localized , address ) + " \n " }
if ! website . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_website " , comment : " Contact website " ) , website ) + " \n " }
if ! website . isEmpty { subtitle += String ( format : " contact_website " .localized , website ) + " \n " }
// 移 除 最 后 一 个 换 行 符
// 移 除 最 后 一 个 换 行 符
if subtitle . hasSuffix ( " \n " ) {
if subtitle . hasSuffix ( " \n " ) {
@ -365,7 +365,7 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . vcard ,
type : . vcard ,
title : NSLocalizedString ( " contact_information " , comment : " Contact information " ) ,
title : " contact_information " .localized ,
subtitle : subtitle ,
subtitle : subtitle ,
icon : " person.crop.rectangle "
icon : " person.crop.rectangle "
)
)
@ -418,7 +418,7 @@ class QRCodeParser {
let year = String ( birthdayValue . prefix ( 4 ) )
let year = String ( birthdayValue . prefix ( 4 ) )
let month = String ( birthdayValue . dropFirst ( 4 ) . prefix ( 2 ) )
let month = String ( birthdayValue . dropFirst ( 4 ) . prefix ( 2 ) )
let day = String ( birthdayValue . dropFirst ( 6 ) )
let day = String ( birthdayValue . dropFirst ( 6 ) )
birthday = String ( format : NSLocalizedString ( " birthday_format " , comment : " Birthday format " ) , year , month , day )
birthday = String ( format : " birthday_format " .localized , year , month , day )
} else {
} else {
birthday = birthdayValue
birthday = birthdayValue
}
}
@ -428,15 +428,15 @@ class QRCodeParser {
}
}
var subtitle = " "
var subtitle = " "
if ! name . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_name " , comment : " Contact name " ) , name ) + " \n " }
if ! name . isEmpty { subtitle += String ( format : " contact_name " . localized , name ) + " \n " }
if ! nickname . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_nickname " , comment : " Contact nickname " ) , nickname ) + " \n " }
if ! nickname . isEmpty { subtitle += String ( format : " contact_nickname " .localized , nickname ) + " \n " }
if ! phone . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_phone " , comment : " Contact phone " ) , phone ) + " \n " }
if ! phone . isEmpty { subtitle += String ( format : " contact_phone " . localized , phone ) + " \n " }
if ! email . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_email " , comment : " Contact email " ) , email ) + " \n " }
if ! email . isEmpty { subtitle += String ( format : " contact_email " . localized , email ) + " \n " }
if ! company . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_company " , comment : " Contact company " ) , company ) + " \n " }
if ! company . isEmpty { subtitle += String ( format : " contact_company " .localized , company ) + " \n " }
if ! address . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_address " , comment : " Contact address " ) , address ) + " \n " }
if ! address . isEmpty { subtitle += String ( format : " contact_address " .localized , address ) + " \n " }
if ! website . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_website " , comment : " Contact website " ) , website ) + " \n " }
if ! website . isEmpty { subtitle += String ( format : " contact_website " .localized , website ) + " \n " }
if ! birthday . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_birthday " , comment : " Contact birthday " ) , birthday ) + " \n " }
if ! birthday . isEmpty { subtitle += String ( format : " contact_birthday " .localized , birthday ) + " \n " }
if ! note . isEmpty { subtitle += String ( format : NSLocalizedString ( " contact_note " , comment : " Contact note " ) , note ) + " \n " }
if ! note . isEmpty { subtitle += String ( format : " contact_note " . localized , note ) + " \n " }
// 移 除 最 后 一 个 换 行 符
// 移 除 最 后 一 个 换 行 符
if subtitle . hasSuffix ( " \n " ) {
if subtitle . hasSuffix ( " \n " ) {
@ -445,7 +445,7 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . mecard ,
type : . mecard ,
title : NSLocalizedString ( " contact_information " , comment : " Contact information " ) ,
title : " contact_information " .localized ,
subtitle : subtitle ,
subtitle : subtitle ,
icon : " person.crop.rectangle "
icon : " person.crop.rectangle "
)
)
@ -478,13 +478,13 @@ class QRCodeParser {
let formattedStartTime = formatCalendarTime ( startTime )
let formattedStartTime = formatCalendarTime ( startTime )
let formattedEndTime = formatCalendarTime ( endTime )
let formattedEndTime = formatCalendarTime ( endTime )
let title = NSLocalizedString ( " calendar_event " , comment : " Calendar event " )
let title = " calendar_event " .localized
var subtitle = String ( format : NSLocalizedString ( " calendar_event_info " , comment : " Calendar event information " ) , summary , formattedStartTime , formattedEndTime )
var subtitle = String ( format : " calendar_event_info " .localized , summary , formattedStartTime , formattedEndTime )
if ! location . isEmpty {
if ! location . isEmpty {
subtitle += String ( format : NSLocalizedString ( " calendar_event_location " , comment : " Calendar event location " ) , location )
subtitle += String ( format : " calendar_event_location " .localized , location )
}
}
if ! description . isEmpty {
if ! description . isEmpty {
subtitle += String ( format : NSLocalizedString ( " calendar_event_description " , comment : " Calendar event description " ) , description )
subtitle += String ( format : " calendar_event_description " .localized , description )
}
}
return ParsedQRData (
return ParsedQRData (
@ -518,8 +518,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . instagram ,
type : . instagram ,
title : NSLocalizedString ( " instagram " , comment : " Instagram " ) ,
title : " instagram " . localized ,
subtitle : String ( format : NSLocalizedString ( " instagram_username " , comment : " Instagram username " ) , username ) ,
subtitle : String ( format : " instagram_username " .localized , username ) ,
icon : " camera "
icon : " camera "
)
)
}
}
@ -530,8 +530,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . facebook ,
type : . facebook ,
title : NSLocalizedString ( " facebook " , comment : " Facebook " ) ,
title : " facebook " . localized ,
subtitle : String ( format : NSLocalizedString ( " facebook_profile_id " , comment : " Facebook profile ID " ) , profileId ) ,
subtitle : String ( format : " facebook_profile_id " .localized , profileId ) ,
icon : " person.2 "
icon : " person.2 "
)
)
}
}
@ -542,8 +542,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . spotify ,
type : . spotify ,
title : NSLocalizedString ( " spotify " , comment : " Spotify " ) ,
title : " spotify " . localized ,
subtitle : String ( format : NSLocalizedString ( " spotify_search_query " , comment : " Spotify search query " ) , searchQuery ) ,
subtitle : String ( format : " spotify_search_query " .localized , searchQuery ) ,
icon : " music.note "
icon : " music.note "
)
)
}
}
@ -560,8 +560,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . twitter ,
type : . twitter ,
title : NSLocalizedString ( " x " , comment : " X " ) ,
title : " x " . localized ,
subtitle : String ( format : NSLocalizedString ( " twitter_username " , comment : " Twitter username " ) , username ) ,
subtitle : String ( format : " twitter_username " .localized , username ) ,
icon : " bird "
icon : " bird "
)
)
}
}
@ -572,8 +572,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . whatsapp ,
type : . whatsapp ,
title : NSLocalizedString ( " whatsapp " , comment : " WhatsApp " ) ,
title : " whatsapp " . localized ,
subtitle : String ( format : NSLocalizedString ( " whatsapp_phone_number " , comment : " WhatsApp phone number " ) , phone ) ,
subtitle : String ( format : " whatsapp_phone_number " .localized , phone ) ,
icon : " message.circle "
icon : " message.circle "
)
)
}
}
@ -584,8 +584,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . viber ,
type : . viber ,
title : NSLocalizedString ( " viber " , comment : " Viber " ) ,
title : " viber " . localized ,
subtitle : String ( format : NSLocalizedString ( " viber_phone_number " , comment : " Viber phone number " ) , phone ) ,
subtitle : String ( format : " viber_phone_number " .localized , phone ) ,
icon : " bubble.left.and.bubble.right "
icon : " bubble.left.and.bubble.right "
)
)
}
}
@ -596,8 +596,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . snapchat ,
type : . snapchat ,
title : NSLocalizedString ( " snapchat " , comment : " Snapchat " ) ,
title : " snapchat " . localized ,
subtitle : String ( format : NSLocalizedString ( " snapchat_username " , comment : " Snapchat username " ) , username ) ,
subtitle : String ( format : " snapchat_username " .localized , username ) ,
icon : " camera.viewfinder "
icon : " camera.viewfinder "
)
)
}
}
@ -620,8 +620,8 @@ class QRCodeParser {
return ParsedQRData (
return ParsedQRData (
type : . tiktok ,
type : . tiktok ,
title : NSLocalizedString ( " tiktok " , comment : " TikTok " ) ,
title : " tiktok " . localized ,
subtitle : String ( format : NSLocalizedString ( " tiktok_username " , comment : " TikTok username " ) , username ) ,
subtitle : String ( format : " tiktok_username " .localized , username ) ,
icon : " music.mic "
icon : " music.mic "
)
)
}
}
@ -630,7 +630,7 @@ class QRCodeParser {
private static func parseURL ( _ content : String ) -> ParsedQRData {
private static func parseURL ( _ content : String ) -> ParsedQRData {
return ParsedQRData (
return ParsedQRData (
type : . url ,
type : . url ,
title : NSLocalizedString ( " url_link " , comment : " URL link " ) ,
title : " url_link " . localized ,
subtitle : content ,
subtitle : content ,
icon : " link "
icon : " link "
)
)
@ -644,8 +644,8 @@ class QRCodeParser {
let latitude = coords . first ? ? " "
let latitude = coords . first ? ? " "
let longitude = coords . count > 1 ? coords [ 1 ] : " "
let longitude = coords . count > 1 ? coords [ 1 ] : " "
let title = NSLocalizedString ( " geolocation " , comment : " Geolocation " )
let title = " geolocation " . localized
let subtitle = String ( format : NSLocalizedString ( " geolocation_coordinates " , comment : " Geolocation coordinates " ) , latitude , longitude )
let subtitle = String ( format : " geolocation_coordinates " .localized , latitude , longitude )
return ParsedQRData (
return ParsedQRData (
type : . location ,
type : . location ,