Class: AppEntitlementsStatistics::EntitlementsPlist

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb

Overview

iOS app.entitlements parser

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ EntitlementsPlist

Returns a new instance of EntitlementsPlist.



12
13
14
# File 'lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb', line 12

def initialize(file)
    @file = file
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



164
165
166
167
168
# File 'lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb', line 164

def method_missing(method_name, *args, &block)
    info.try(:[], method_name.to_s.ai_camelcase) ||
        info.send(method_name) ||
        super
end

Instance Method Details

#[](key) ⇒ Object



158
159
160
# File 'lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb', line 158

def [](key)
    info.try(:[], key.to_s)
end

#enabled_capabilitiesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb', line 23

def enabled_capabilities
    capabilities = Hash.new
    info.each do |key, value|
        case key
        when 'com.apple.developer.game-center'
            capabilities['Game Center'] = {
                key => value
            }
        when 'keychain-access-groups' 
            capabilities['Keychain sharing'] =   {
                key => value
            }
        # when 'aps-environment'
        #     capabilities['Push Notifications'] = {
        #         key => value
        #     }
        when 'com.apple.developer.applesignin'
            capabilities['Sign In with Apple'] = {
                key => value
            }
        when 'com.apple.developer.siri'
            capabilities['SiriKit'] = {
                key => value
            }
        when 'com.apple.security.application-groups'
            capabilities['App Groups'] = {
                key => value
            }
        when 'com.apple.developer.associated-domains'
            capabilities['Associated Domains']  =  {
                key => value
            }
        when 'com.apple.developer.default-data-protection'
            capabilities['Data Protection'] = {
                key => value
            }
        when 'com.apple.developer.networking.networkextension'
            capabilities ['Network Extensions'] = {
                key => value
            }
        when 'com.apple.developer.networking.vpn.api'
            capabilities ['Personal VPN'] =  {
                key => value
            }
        when 'com.apple.developer.healthkit',
            'com.apple.developer.healthkit.access'
            capabilities['HealthKit']  = {
                'com.apple.developer.healthkit' => info['com.apple.developer.healthkit'],
                'com.apple.developer.healthkit.access' => info['com.apple.developer.healthkit.access'],
            } unless capabilities.include?('HealthKit')
        when 'com.apple.developer.icloud-services',
            'com.apple.developer.icloud-container-identifiers'
            capabilities['iCloud']  = {
                'com.apple.developer.icloud-services' => info['com.apple.developer.icloud-services'],
                'com.apple.developer.icloud-container-identifiers' => info['com.apple.developer.icloud-container-identifiers'],
            } unless capabilities.include?('iCloud')
        when 'com.apple.developer.in-app-payments'
            capabilities['Apple Pay'] = {
                key => value
            }
        when 'com.apple.developer.homekit'
            capabilities['HomeKit'] =  {
                key => value
            }
        when 'com.apple.developer.user-fonts'
            capabilities['Fonts'] = {
                key => value
            }
        when 'com.apple.developer.pass-type-identifiers'
            capabilities['Wallet'] =  {
                key => value
            }
        when 'inter-app-audio'
            capabilities['Inter-App Audio'] =  {
                key => value
            }
        when 'com.apple.developer.networking.multipath'
            capabilities['Multipath'] = {
                key => value
            }
        when 'com.apple.developer.authentication-services.autofill-credential-provider'
            capabilities['AutoFill Credential Provider'] = {
                key => value
            }
        when 'com.apple.developer.networking.wifi-info'
            capabilities['Access WiFi Information'] = {
                key => value
            }
        when 'com.apple.external-accessory.wireless-configuration'
            capabilities['Wireless Accessory Configuration'] = {
                key => value
            }
        when 'com.apple.developer.kernel.extended-virtual-addressing'
            capabilities['Extended Virtual Address Space'] = {
                key => value
            }
        when 'com.apple.developer.nfc.readersession.formats'
            capabilities['NFC Tag Reading'] =  {
                key => value
            }
        when 'com.apple.developer.ClassKit-environment'
            capabilities['ClassKit'] =  {
                key => value
            }
        when 'com.apple.developer.networking.HotspotConfiguration'
            capabilities['Hotspot'] =  {
                key => value
            }
        when 'com.apple.developer.devicecheck.appattest-environment'
            capabilities['App Attest'] =  {
                key => value
            }
        when 'com.apple.developer.coremedia.hls.low-latency'
            capabilities['Low Latency HLS'] =  {
                key => value
            }
        when 'com.apple.developer.associated-domains.mdm-managed'
            capabilities['MDM Managed Associated Domains'] =  {
                key => value
            }
        end
    end
    capabilities
end

#game_centerObject



149
150
151
# File 'lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb', line 149

def game_center
    info.try(:[], 'com.apple.developer.game-center').nil?
end

#keychain_access_groupsObject



153
154
155
# File 'lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb', line 153

def keychain_access_groups
    info.try(:[], 'keychain-access-groups').nil?
end

#respond_to_missing?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


170
171
172
173
174
# File 'lib/cocoapods-entitlements-statistics/app_entitlements_statistics/entitlements.rb', line 170

def respond_to_missing?(method_name, *args)
    info.key?(method_name.to_s.ai_camelcase) ||
        info.respond_to?(method_name) ||
        super
end